Skip to content

Commit

Permalink
Fixes an issue where the CLI was displaying an incorrect time for the…
Browse files Browse the repository at this point in the history
… duration to be extended by (#84)
  • Loading branch information
ckluy31 authored Aug 5, 2024
1 parent 00d15d1 commit d6d3599
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/selfish-pumas-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@common-fate/cli": patch
---

Fixes an issue where the CLI was displaying an incorrect time for the duration to be extended by.
6 changes: 5 additions & 1 deletion cmd/cli/command/access/dry_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ func DryRun(ctx context.Context, apiURL *url.URL, client accessv1alpha1connect.A
continue

case accessv1alpha1.GrantChange_GRANT_CHANGE_EXTENDED:
extendedTime := ""
if g.Grant.Extension != nil {
extendedTime = ShortDur(g.Grant.Extension.ExtensionDurationSeconds.AsDuration())
}
color.New(color.BgBlue).Printf("[WILL EXTEND]")
color.New(color.FgBlue).Printf(" %s will be extended for another %s: %s\n", g.Grant.Name, exp, RequestURL(apiURL, g.Grant))
color.New(color.FgBlue).Printf(" %s will be extended for another %s: %s\n", g.Grant.Name, extendedTime, RequestURL(apiURL, g.Grant))
continue

case accessv1alpha1.GrantChange_GRANT_CHANGE_REQUESTED:
Expand Down
7 changes: 6 additions & 1 deletion cmd/cli/command/access/ensure.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,13 @@ var ensureCommand = cli.Command{
continue

case accessv1alpha1.GrantChange_GRANT_CHANGE_EXTENDED:
extendedTime := ""
if g.Grant.Extension != nil {
extendedTime = ShortDur(g.Grant.Extension.ExtensionDurationSeconds.AsDuration())
}
color.New(color.BgBlue).Printf("[EXTENDED]")
color.New(color.FgBlue).Printf(" %s was extended for another %s: %s\n", g.Grant.Name, exp, RequestURL(apiURL, g.Grant))
color.New(color.FgBlue).Printf(" %s was extended for another %s: %s\n", g.Grant.Name, extendedTime, RequestURL(apiURL, g.Grant))
color.New(color.FgGreen).Printf(" %s will now expire in %s\n", g.Grant.Name, exp)
continue

case accessv1alpha1.GrantChange_GRANT_CHANGE_REQUESTED:
Expand Down

0 comments on commit d6d3599

Please sign in to comment.