packages feed

hercules-ci-cli 0.2.2 → 0.2.3

raw patch · 3 files changed

+18/−8 lines, 3 files

Files

CHANGELOG.md view
@@ -5,6 +5,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## 0.2.3 - 2021-10-12++### Fixed++ - Remove a redundant API call that is not available using the Effect-provided token+ ## 0.2.2 - 2021-09-06  ### Added
hercules-ci-cli.cabal view
@@ -1,7 +1,7 @@ cabal-version: 1.12  name:           hercules-ci-cli-version:        0.2.2+version:        0.2.3 synopsis:       The hci command for working with Hercules CI homepage:       https://docs.hercules-ci.com bug-reports:    https://github.com/hercules-ci/hercules-ci-agent/issues
src/Hercules/CLI/State.hs view
@@ -11,7 +11,7 @@ import Hercules.CLI.Client import Hercules.CLI.Common (runAuthenticated) import Hercules.CLI.Options (mkCommand, subparser)-import Hercules.CLI.Project (ProjectPath (projectPathOwner, projectPathProject, projectPathSite), getProjectIdAndPath, projectOption)+import Hercules.CLI.Project (ProjectPath (projectPathOwner, projectPathProject, projectPathSite), findProjectContextually, projectOption) import Options.Applicative (bashCompleter, completer, help, long, metavar, strOption) import qualified Options.Applicative as Optparse import Protolude hiding (option)@@ -74,10 +74,14 @@ fileOption = strOption $ long "file" <> metavar "FILE" <> help "Local path of the state file or - for stdio" <> completer (bashCompleter "file")  getProjectAndClient :: (Has HerculesClientToken r, Has HerculesClientEnv r) => Maybe ProjectPath -> RIO r (ProjectStateResourceGroup ClientAuth (AsClientT ClientM))-getProjectAndClient projectMaybe = do-  (projectIdMaybe, projectPath) <- getProjectIdAndPath projectMaybe-  case projectIdMaybe of-    Just projectId ->-      pure (stateClient `enterApiE` \api -> byProjectId api projectId)-    Nothing ->+getProjectAndClient projectMaybe =+  case projectMaybe of+    Just projectPath ->       pure (stateClient `enterApiE` \api -> byProjectName api (Name $ projectPathSite projectPath) (Name $ projectPathOwner projectPath) (Name $ projectPathProject projectPath))+    Nothing -> do+      (projectIdMaybe, projectPath) <- findProjectContextually+      case projectIdMaybe of+        Just projectId ->+          pure (stateClient `enterApiE` \api -> byProjectId api projectId)+        Nothing ->+          pure (stateClient `enterApiE` \api -> byProjectName api (Name $ projectPathSite projectPath) (Name $ projectPathOwner projectPath) (Name $ projectPathProject projectPath))