More consistency

This commit is contained in:
Michael Hoffman 2025-02-02 20:31:12 -05:00
parent 0274999880
commit 7325944040
4 changed files with 11 additions and 11 deletions

View file

@ -112,7 +112,7 @@ func createRun(opts *createOptions) error {
"%s Created repository autolink %s on %s\n",
cs.SuccessIconWithColor(cs.Green),
cs.Cyanf("%d", autolink.ID),
ghrepo.FullName(repo))
cs.Bold(ghrepo.FullName(repo)))
return nil
}

View file

@ -133,7 +133,7 @@ func TestDeleteRun(t *testing.T) {
return nil
}
},
wantStdout: "Autolink 123 has key prefix TICKET-.✓Autolink 123 deleted from OWNER/REPO\n",
wantStdout: "Autolink 123 has key prefix TICKET-.✓ Autolink 123 deleted from OWNER/REPO\n",
},
{
name: "delete with confirm flag",

View file

@ -89,8 +89,14 @@ func listRun(opts *listOptions) error {
return err
}
cs := opts.IO.ColorScheme()
if len(autolinks) == 0 {
return cmdutil.NewNoResultsError(fmt.Sprintf("no autolinks found in %s", ghrepo.FullName(repo)))
return cmdutil.NewNoResultsError(
fmt.Sprintf(
"no autolinks found in %s",
cs.Bold(ghrepo.FullName(repo))),
)
}
if opts.Exporter != nil {
@ -98,14 +104,12 @@ func listRun(opts *listOptions) error {
}
if opts.IO.IsStdoutTTY() {
title := listHeader(ghrepo.FullName(repo), len(autolinks))
title := fmt.Sprintf("Showing %s in %s", text.Pluralize(len(autolinks), "autolink reference"), cs.Bold(ghrepo.FullName(repo)))
fmt.Fprintf(opts.IO.Out, "\n%s\n\n", title)
}
tp := tableprinter.New(opts.IO, tableprinter.WithHeader("ID", "KEY PREFIX", "URL TEMPLATE", "ALPHANUMERIC"))
cs := opts.IO.ColorScheme()
for _, autolink := range autolinks {
tp.AddField(cs.Cyanf("%d", autolink.ID))
tp.AddField(autolink.KeyPrefix)
@ -116,7 +120,3 @@ func listRun(opts *listOptions) error {
return tp.Render()
}
func listHeader(repoName string, count int) string {
return fmt.Sprintf("Showing %s in %s", text.Pluralize(count, "autolink reference"), repoName)
}

View file

@ -78,7 +78,7 @@ func viewRun(opts *viewOptions) error {
return opts.Exporter.Write(opts.IO, autolink)
}
fmt.Fprintf(out, "Autolink in %s\n\n", ghrepo.FullName(repo))
fmt.Fprintf(out, "Autolink in %s\n\n", cs.Bold(ghrepo.FullName(repo)))
fmt.Fprint(out, cs.Bold("ID: "))
fmt.Fprintln(out, cs.Cyanf("%d", autolink.ID))