Match color of the success icon with the end state of the record
This commit is contained in:
parent
683ebee6ef
commit
23d68705bc
14 changed files with 26 additions and 25 deletions
|
|
@ -63,7 +63,7 @@ func deleteRun(opts *DeleteOptions) error {
|
|||
|
||||
if opts.IO.IsStdoutTTY() {
|
||||
cs := opts.IO.ColorScheme()
|
||||
fmt.Fprintf(opts.IO.ErrOut, "%s Deleted alias %s; was %s\n", cs.SuccessIcon(), opts.Name, expansion)
|
||||
fmt.Fprintf(opts.IO.ErrOut, "%s Deleted alias %s; was %s\n", cs.SuccessIconOfColor(cs.Red), opts.Name, expansion)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ func createRun(opts *CreateOptions) error {
|
|||
return fmt.Errorf("%s Failed to create gist: %w", cs.Red("X"), err)
|
||||
}
|
||||
|
||||
fmt.Fprintf(errOut, "%s %s\n", cs.SuccessIcon(), completionMessage)
|
||||
fmt.Fprintf(errOut, "%s %s\n", cs.SuccessIconOfColor(cs.Green), completionMessage)
|
||||
|
||||
if opts.WebMode {
|
||||
fmt.Fprintf(opts.IO.Out, "Opening %s in your browser.\n", utils.DisplayURL(gist.HTMLURL))
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ func closeRun(opts *CloseOptions) error {
|
|||
return err
|
||||
}
|
||||
|
||||
fmt.Fprintf(opts.IO.ErrOut, "%s Closed issue #%d (%s)\n", cs.SuccessIcon(), issue.Number, issue.Title)
|
||||
fmt.Fprintf(opts.IO.ErrOut, "%s Closed issue #%d (%s)\n", cs.SuccessIconOfColor(cs.Red), issue.Number, issue.Title)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ func reopenRun(opts *ReopenOptions) error {
|
|||
return err
|
||||
}
|
||||
|
||||
fmt.Fprintf(opts.IO.ErrOut, "%s Reopened issue #%d (%s)\n", cs.SuccessIcon(), issue.Number, issue.Title)
|
||||
fmt.Fprintf(opts.IO.ErrOut, "%s Reopened issue #%d (%s)\n", cs.SuccessIconOfColor(cs.Green), issue.Number, issue.Title)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ func closeRun(opts *CloseOptions) error {
|
|||
return fmt.Errorf("API call failed: %w", err)
|
||||
}
|
||||
|
||||
fmt.Fprintf(opts.IO.ErrOut, "%s Closed pull request #%d (%s)\n", cs.SuccessIcon(), pr.Number, pr.Title)
|
||||
fmt.Fprintf(opts.IO.ErrOut, "%s Closed pull request #%d (%s)\n", cs.SuccessIconOfColor(cs.Red), pr.Number, pr.Title)
|
||||
|
||||
crossRepoPR := pr.HeadRepositoryOwner.Login != baseRepo.RepoOwner()
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ func closeRun(opts *CloseOptions) error {
|
|||
return err
|
||||
}
|
||||
}
|
||||
fmt.Fprintf(opts.IO.ErrOut, "%s Deleted branch %s%s\n", cs.SuccessIcon(), cs.Cyan(pr.HeadRefName), branchSwitchString)
|
||||
fmt.Fprintf(opts.IO.ErrOut, "%s Deleted branch %s%s\n", cs.SuccessIconOfColor(cs.Red), cs.Cyan(pr.HeadRefName), branchSwitchString)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ func mergeRun(opts *MergeOptions) error {
|
|||
case api.PullRequestMergeMethodSquash:
|
||||
action = "Squashed and merged"
|
||||
}
|
||||
fmt.Fprintf(opts.IO.ErrOut, "%s %s pull request #%d (%s)\n", cs.SuccessIcon(), action, pr.Number, pr.Title)
|
||||
fmt.Fprintf(opts.IO.ErrOut, "%s %s pull request #%d (%s)\n", cs.SuccessIconOfColor(cs.Magenta), action, pr.Number, pr.Title)
|
||||
}
|
||||
} else if !opts.IsDeleteBranchIndicated && opts.InteractiveMode {
|
||||
err := prompt.SurveyAskOne(&survey.Confirm{
|
||||
|
|
@ -221,7 +221,7 @@ func mergeRun(opts *MergeOptions) error {
|
|||
}
|
||||
|
||||
if isTerminal {
|
||||
fmt.Fprintf(opts.IO.ErrOut, "%s Deleted branch %s%s\n", cs.SuccessIcon(), cs.Cyan(pr.HeadRefName), branchSwitchString)
|
||||
fmt.Fprintf(opts.IO.ErrOut, "%s Deleted branch %s%s\n", cs.SuccessIconOfColor(cs.Red), cs.Cyan(pr.HeadRefName), branchSwitchString)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ func readyRun(opts *ReadyOptions) error {
|
|||
return fmt.Errorf("API call failed: %w", err)
|
||||
}
|
||||
|
||||
fmt.Fprintf(opts.IO.ErrOut, "%s Pull request #%d is marked as \"ready for review\"\n", cs.SuccessIcon(), pr.Number)
|
||||
fmt.Fprintf(opts.IO.ErrOut, "%s Pull request #%d is marked as \"ready for review\"\n", cs.SuccessIconOfColor(cs.Green), pr.Number)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ func reopenRun(opts *ReopenOptions) error {
|
|||
return fmt.Errorf("API call failed: %w", err)
|
||||
}
|
||||
|
||||
fmt.Fprintf(opts.IO.ErrOut, "%s Reopened pull request #%d (%s)\n", cs.SuccessIcon(), pr.Number, pr.Title)
|
||||
fmt.Fprintf(opts.IO.ErrOut, "%s Reopened pull request #%d (%s)\n", cs.SuccessIconOfColor(cs.Green), pr.Number, pr.Title)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ func deleteRun(opts *DeleteOptions) error {
|
|||
}
|
||||
|
||||
iofmt := opts.IO.ColorScheme()
|
||||
fmt.Fprintf(opts.IO.ErrOut, "%s Deleted release %s\n", iofmt.SuccessIcon(), release.TagName)
|
||||
fmt.Fprintf(opts.IO.ErrOut, "%s Deleted release %s\n", iofmt.SuccessIconOfColor(iofmt.Red), release.TagName)
|
||||
if !release.IsDraft {
|
||||
fmt.Fprintf(opts.IO.ErrOut, "%s Note that the %s git tag still remains in the repository\n", iofmt.WarningIcon(), release.TagName)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ func createRun(opts *CreateOptions) error {
|
|||
isTTY := opts.IO.IsStdoutTTY()
|
||||
|
||||
if isTTY {
|
||||
fmt.Fprintf(stderr, "%s Created repository %s on GitHub\n", cs.SuccessIcon(), ghrepo.FullName(repo))
|
||||
fmt.Fprintf(stderr, "%s Created repository %s on GitHub\n", cs.SuccessIconOfColor(cs.Green), ghrepo.FullName(repo))
|
||||
} else {
|
||||
fmt.Fprintln(stdout, repo.URL)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ func forkRun(opts *ForkOptions) error {
|
|||
}
|
||||
} else {
|
||||
if connectedToTerminal {
|
||||
fmt.Fprintf(stderr, "%s Created fork %s\n", cs.SuccessIcon(), cs.Bold(ghrepo.FullName(forkedRepo)))
|
||||
fmt.Fprintf(stderr, "%s Created fork %s\n", cs.SuccessIconOfColor(cs.Green), cs.Bold(ghrepo.FullName(forkedRepo)))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,14 +80,12 @@ func removeRun(opts *RemoveOptions) error {
|
|||
}
|
||||
|
||||
if opts.IO.IsStdoutTTY() {
|
||||
cs := opts.IO.ColorScheme()
|
||||
target := orgName
|
||||
if orgName == "" {
|
||||
fmt.Fprintf(opts.IO.Out,
|
||||
"%s Removed secret %s from %s\n", cs.SuccessIcon(), opts.SecretName, ghrepo.FullName(baseRepo))
|
||||
} else {
|
||||
fmt.Fprintf(opts.IO.Out,
|
||||
"%s Removed secret %s from %s\n", cs.SuccessIcon(), opts.SecretName, orgName)
|
||||
target = ghrepo.FullName(baseRepo)
|
||||
}
|
||||
cs := opts.IO.ColorScheme()
|
||||
fmt.Fprintf(opts.IO.Out, "%s Removed secret %s from %s\n", cs.SuccessIconOfColor(cs.Red), opts.SecretName, target)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -161,13 +161,12 @@ func setRun(opts *SetOptions) error {
|
|||
}
|
||||
|
||||
if opts.IO.IsStdoutTTY() {
|
||||
cs := opts.IO.ColorScheme()
|
||||
|
||||
target := orgName
|
||||
if orgName == "" {
|
||||
fmt.Fprintf(opts.IO.Out, "%s Set secret %s for %s\n", cs.SuccessIcon(), opts.SecretName, ghrepo.FullName(baseRepo))
|
||||
} else {
|
||||
fmt.Fprintf(opts.IO.Out, "%s Set secret %s for %s\n", cs.SuccessIcon(), opts.SecretName, orgName)
|
||||
target = ghrepo.FullName(baseRepo)
|
||||
}
|
||||
cs := opts.IO.ColorScheme()
|
||||
fmt.Fprintf(opts.IO.Out, "%s Set secret %s for %s\n", cs.SuccessIconOfColor(cs.Green), opts.SecretName, target)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -123,7 +123,11 @@ func (c *ColorScheme) Blue(t string) string {
|
|||
}
|
||||
|
||||
func (c *ColorScheme) SuccessIcon() string {
|
||||
return c.Green("✓")
|
||||
return c.SuccessIconOfColor(c.Green)
|
||||
}
|
||||
|
||||
func (c *ColorScheme) SuccessIconOfColor(colo func(string) string) string {
|
||||
return colo("✓")
|
||||
}
|
||||
|
||||
func (c *ColorScheme) WarningIcon() string {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue