Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/cmd/gist/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func createRun(opts *CreateOptions) error {
processMessage = fmt.Sprintf("Creating gist %s", gistName)
}
}
fmt.Fprintf(errOut, "%s %s\n", cs.Gray("-"), processMessage)
fmt.Fprintf(errOut, "%s %s\n", cs.Muted("-"), processMessage)

httpClient, err := opts.HttpClient()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/gist/shared/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func PromptGists(prompter prompter.Prompter, client *http.Client, host string, c
for i, gist := range gists {
gistTime := text.FuzzyAgo(time.Now(), gist.UpdatedAt)
// TODO: support dynamic maxWidth
opts[i] = fmt.Sprintf("%s %s %s", cs.Bold(gist.Filename()), gist.TruncDescription(), cs.Gray(gistTime))
opts[i] = fmt.Sprintf("%s %s %s", cs.Bold(gist.Filename()), gist.TruncDescription(), cs.Muted(gistTime))
}

result, err := prompter.Select("Select a gist", "", opts)
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/gist/view/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func viewRun(opts *ViewOptions) error {
if len(gist.Files) == 1 || opts.Filename != "" {
return fmt.Errorf("error: file is binary")
}
_, err = fmt.Fprintln(opts.IO.Out, cs.Gray("(skipping rendering binary content)"))
_, err = fmt.Fprintln(opts.IO.Out, cs.Muted("(skipping rendering binary content)"))
return nil
}

Expand Down Expand Up @@ -197,7 +197,7 @@ func viewRun(opts *ViewOptions) error {

for i, fn := range filenames {
if showFilenames {
fmt.Fprintf(opts.IO.Out, "%s\n\n", cs.Gray(fn))
fmt.Fprintf(opts.IO.Out, "%s\n\n", cs.Muted(fn))
}
if err := render(gist.Files[fn]); err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/issue/shared/display.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ func PrintIssues(io *iostreams.IOStreams, now time.Time, prefix string, totalCou
}
table.AddField(text.RemoveExcessiveWhitespace(issue.Title))
table.AddField(issueLabelList(&issue, cs, isTTY))
table.AddTimeField(now, issue.UpdatedAt, cs.Gray)
table.AddTimeField(now, issue.UpdatedAt, cs.Muted)
table.EndRow()
}
_ = table.Render()
remaining := totalCount - len(issues)
if remaining > 0 {
fmt.Fprintf(io.Out, cs.Gray("%sAnd %d more\n"), prefix, remaining)
fmt.Fprintf(io.Out, cs.Muted("%sAnd %d more\n"), prefix, remaining)
}
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/issue/view/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func printHumanIssuePreview(opts *ViewOptions, baseRepo ghrepo.Interface, issue
var md string
var err error
if issue.Body == "" {
md = fmt.Sprintf("\n %s\n\n", cs.Gray("No description provided"))
md = fmt.Sprintf("\n %s\n\n", cs.Muted("No description provided"))
} else {
md, err = markdown.Render(issue.Body,
markdown.WithTheme(opts.IO.TerminalTheme()),
Expand All @@ -250,7 +250,7 @@ func printHumanIssuePreview(opts *ViewOptions, baseRepo ghrepo.Interface, issue
}

// Footer
fmt.Fprintf(out, cs.Gray("View this issue on GitHub: %s\n"), issue.URL)
fmt.Fprintf(out, cs.Muted("View this issue on GitHub: %s\n"), issue.URL)

return nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/pr/checks/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func addRow(tp *tableprinter.TablePrinter, io *iostreams.IOStreams, o check) {
markColor = cs.Yellow
case "skipping", "cancel":
mark = "-"
markColor = cs.Gray
markColor = cs.Muted
}

if io.IsStdoutTTY() {
Expand Down
26 changes: 13 additions & 13 deletions pkg/cmd/pr/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -879,37 +879,37 @@ func renderPullRequestPlain(w io.Writer, params map[string]interface{}, state *s
}

func renderPullRequestTTY(io *iostreams.IOStreams, params map[string]interface{}, state *shared.IssueMetadataState) error {
iofmt := io.ColorScheme()
cs := io.ColorScheme()
out := io.Out

fmt.Fprint(out, "Would have created a Pull Request with:\n")
fmt.Fprintf(out, "%s: %s\n", iofmt.Bold("Title"), params["title"].(string))
fmt.Fprintf(out, "%s: %t\n", iofmt.Bold("Draft"), params["draft"])
fmt.Fprintf(out, "%s: %s\n", iofmt.Bold("Base"), params["baseRefName"])
fmt.Fprintf(out, "%s: %s\n", iofmt.Bold("Head"), params["headRefName"])
fmt.Fprintf(out, "%s: %s\n", cs.Bold("Title"), params["title"].(string))
fmt.Fprintf(out, "%s: %t\n", cs.Bold("Draft"), params["draft"])
fmt.Fprintf(out, "%s: %s\n", cs.Bold("Base"), params["baseRefName"])
fmt.Fprintf(out, "%s: %s\n", cs.Bold("Head"), params["headRefName"])
if len(state.Labels) != 0 {
fmt.Fprintf(out, "%s: %s\n", iofmt.Bold("Labels"), strings.Join(state.Labels, ", "))
fmt.Fprintf(out, "%s: %s\n", cs.Bold("Labels"), strings.Join(state.Labels, ", "))
}
if len(state.Reviewers) != 0 {
fmt.Fprintf(out, "%s: %s\n", iofmt.Bold("Reviewers"), strings.Join(state.Reviewers, ", "))
fmt.Fprintf(out, "%s: %s\n", cs.Bold("Reviewers"), strings.Join(state.Reviewers, ", "))
}
if len(state.Assignees) != 0 {
fmt.Fprintf(out, "%s: %s\n", iofmt.Bold("Assignees"), strings.Join(state.Assignees, ", "))
fmt.Fprintf(out, "%s: %s\n", cs.Bold("Assignees"), strings.Join(state.Assignees, ", "))
}
if len(state.Milestones) != 0 {
fmt.Fprintf(out, "%s: %s\n", iofmt.Bold("Milestones"), strings.Join(state.Milestones, ", "))
fmt.Fprintf(out, "%s: %s\n", cs.Bold("Milestones"), strings.Join(state.Milestones, ", "))
}
if len(state.Projects) != 0 {
fmt.Fprintf(out, "%s: %s\n", iofmt.Bold("Projects"), strings.Join(state.Projects, ", "))
fmt.Fprintf(out, "%s: %s\n", cs.Bold("Projects"), strings.Join(state.Projects, ", "))
}
fmt.Fprintf(out, "%s: %t\n", iofmt.Bold("MaintainerCanModify"), params["maintainerCanModify"])
fmt.Fprintf(out, "%s: %t\n", cs.Bold("MaintainerCanModify"), params["maintainerCanModify"])

fmt.Fprintf(out, "%s\n", iofmt.Bold("Body:"))
fmt.Fprintf(out, "%s\n", cs.Bold("Body:"))
// Body
var md string
var err error
if len(params["body"].(string)) == 0 {
md = fmt.Sprintf("%s\n", iofmt.Gray("No description provided"))
md = fmt.Sprintf("%s\n", cs.Muted("No description provided"))
} else {
md, err = markdown.Render(params["body"].(string),
markdown.WithTheme(io.TerminalTheme()),
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/pr/review/review.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func reviewRun(opts *ReviewOptions) error {

switch reviewData.State {
case api.ReviewComment:
fmt.Fprintf(opts.IO.ErrOut, "%s Reviewed pull request %s#%d\n", cs.Gray("-"), ghrepo.FullName(baseRepo), pr.Number)
fmt.Fprintf(opts.IO.ErrOut, "%s Reviewed pull request %s#%d\n", cs.Muted("-"), ghrepo.FullName(baseRepo), pr.Number)
case api.ReviewApprove:
fmt.Fprintf(opts.IO.ErrOut, "%s Approved pull request %s#%d\n", cs.SuccessIcon(), ghrepo.FullName(baseRepo), pr.Number)
case api.ReviewRequestChanges:
Expand Down
8 changes: 4 additions & 4 deletions pkg/cmd/pr/shared/comments.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func CommentList(io *iostreams.IOStreams, comments api.Comments, reviews api.Pul
hiddenCount := totalCount - retrievedCount

if preview && hiddenCount > 0 {
fmt.Fprint(&b, cs.Gray(fmt.Sprintf("———————— Not showing %s ————————", text.Pluralize(hiddenCount, "comment"))))
fmt.Fprint(&b, cs.Muted(fmt.Sprintf("———————— Not showing %s ————————", text.Pluralize(hiddenCount, "comment"))))
fmt.Fprintf(&b, "\n\n\n")
}

Expand All @@ -79,7 +79,7 @@ func CommentList(io *iostreams.IOStreams, comments api.Comments, reviews api.Pul
}

if preview && hiddenCount > 0 {
fmt.Fprint(&b, cs.Gray("Use --comments to view the full conversation"))
fmt.Fprint(&b, cs.Muted("Use --comments to view the full conversation"))
fmt.Fprintln(&b)
}

Expand Down Expand Up @@ -122,7 +122,7 @@ func formatComment(io *iostreams.IOStreams, comment Comment, newest bool) (strin
var md string
var err error
if comment.Content() == "" {
md = fmt.Sprintf("\n %s\n\n", cs.Gray("No body provided"))
md = fmt.Sprintf("\n %s\n\n", cs.Muted("No body provided"))
} else {
md, err = markdown.Render(comment.Content(),
markdown.WithTheme(io.TerminalTheme()),
Expand All @@ -135,7 +135,7 @@ func formatComment(io *iostreams.IOStreams, comment Comment, newest bool) (strin

// Footer
if comment.Link() != "" {
fmt.Fprintf(&b, cs.Gray("View the full review: %s\n\n"), comment.Link())
fmt.Fprintf(&b, cs.Muted("View the full review: %s\n\n"), comment.Link())
}

return b.String(), nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/pr/shared/display.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func PrintHeader(io *iostreams.IOStreams, s string) {
}

func PrintMessage(io *iostreams.IOStreams, s string) {
fmt.Fprintln(io.Out, io.ColorScheme().Gray(s))
fmt.Fprintln(io.Out, io.ColorScheme().Muted(s))
}

func ListNoResults(repoName string, itemName string, hasFilters bool) error {
Expand All @@ -83,7 +83,7 @@ func ListHeader(repoName string, itemName string, matchCount int, totalMatchCoun
}

func PrCheckStatusSummaryWithColor(cs *iostreams.ColorScheme, checks api.PullRequestChecksStatus) string {
var summary = cs.Gray("No checks")
var summary = cs.Muted("No checks")
if checks.Total > 0 {
if checks.Failing > 0 {
if checks.Failing == checks.Total {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/pr/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,6 @@ func printPrs(io *iostreams.IOStreams, totalCount int, prs ...api.PullRequest) {
}
remaining := totalCount - len(prs)
if remaining > 0 {
fmt.Fprintf(w, cs.Gray(" And %d more\n"), remaining)
fmt.Fprintln(w, cs.Mutedf(" And %d more", remaining))
}
}
4 changes: 2 additions & 2 deletions pkg/cmd/pr/view/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func printHumanPrPreview(opts *ViewOptions, baseRepo ghrepo.Interface, pr *api.P
var md string
var err error
if pr.Body == "" {
md = fmt.Sprintf("\n %s\n\n", cs.Gray("No description provided"))
md = fmt.Sprintf("\n %s\n\n", cs.Muted("No description provided"))
} else {
md, err = markdown.Render(pr.Body,
markdown.WithTheme(opts.IO.TerminalTheme()),
Expand All @@ -282,7 +282,7 @@ func printHumanPrPreview(opts *ViewOptions, baseRepo ghrepo.Interface, pr *api.P
}

// Footer
fmt.Fprintf(out, cs.Gray("View this pull request on GitHub: %s\n"), pr.URL)
fmt.Fprintf(out, cs.Muted("View this pull request on GitHub: %s\n"), pr.URL)

return nil
}
Expand Down
16 changes: 8 additions & 8 deletions pkg/cmd/release/view/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,19 @@ func viewRun(opts *ViewOptions) error {
}

func renderReleaseTTY(io *iostreams.IOStreams, release *shared.Release) error {
iofmt := io.ColorScheme()
cs := io.ColorScheme()
w := io.Out

fmt.Fprintf(w, "%s\n", iofmt.Bold(release.TagName))
fmt.Fprintf(w, "%s\n", cs.Bold(release.TagName))
if release.IsDraft {
fmt.Fprintf(w, "%s • ", iofmt.Red("Draft"))
fmt.Fprintf(w, "%s • ", cs.Red("Draft"))
} else if release.IsPrerelease {
fmt.Fprintf(w, "%s • ", iofmt.Yellow("Pre-release"))
fmt.Fprintf(w, "%s • ", cs.Yellow("Pre-release"))
}
if release.IsDraft {
fmt.Fprintf(w, "%s\n", iofmt.Gray(fmt.Sprintf("%s created this %s", release.Author.Login, text.FuzzyAgo(time.Now(), release.CreatedAt))))
fmt.Fprintln(w, cs.Mutedf("%s created this %s", release.Author.Login, text.FuzzyAgo(time.Now(), release.CreatedAt)))
} else {
fmt.Fprintf(w, "%s\n", iofmt.Gray(fmt.Sprintf("%s released this %s", release.Author.Login, text.FuzzyAgo(time.Now(), *release.PublishedAt))))
fmt.Fprintln(w, cs.Mutedf("%s released this %s", release.Author.Login, text.FuzzyAgo(time.Now(), *release.PublishedAt)))
}

renderedDescription, err := markdown.Render(release.Body,
Expand All @@ -153,7 +153,7 @@ func renderReleaseTTY(io *iostreams.IOStreams, release *shared.Release) error {
fmt.Fprintln(w, renderedDescription)

if len(release.Assets) > 0 {
fmt.Fprintf(w, "%s\n", iofmt.Bold("Assets"))
fmt.Fprintln(w, cs.Bold("Assets"))
//nolint:staticcheck // SA1019: Showing NAME|SIZE headers adds nothing to table.
table := tableprinter.New(io, tableprinter.NoHeader)
for _, a := range release.Assets {
Expand All @@ -168,7 +168,7 @@ func renderReleaseTTY(io *iostreams.IOStreams, release *shared.Release) error {
fmt.Fprint(w, "\n")
}

fmt.Fprintf(w, "%s\n", iofmt.Gray(fmt.Sprintf("View on GitHub: %s", release.URL)))
fmt.Fprintln(w, cs.Mutedf("View on GitHub: %s", release.URL))
return nil
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/cmd/repo/license/view/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ func renderLicense(license *api.License, opts *ViewOptions) error {
cs := opts.IO.ColorScheme()
var out strings.Builder
if opts.IO.IsStdoutTTY() {
out.WriteString(fmt.Sprintf("\n%s\n", cs.Gray(license.Description)))
out.WriteString(fmt.Sprintf("\n%s\n", cs.Grayf("To implement: %s", license.Implementation)))
out.WriteString(fmt.Sprintf("\n%s\n\n", cs.Grayf("For more information, see: %s", license.HTMLURL)))
out.WriteString(fmt.Sprintf("\n%s\n", cs.Muted(license.Description)))
out.WriteString(fmt.Sprintf("\n%s\n", cs.Mutedf("To implement: %s", license.Implementation)))
out.WriteString(fmt.Sprintf("\n%s\n\n", cs.Mutedf("For more information, see: %s", license.HTMLURL)))
}
out.WriteString(license.Body)
_, err := opts.IO.Out.Write([]byte(out.String()))
Expand Down
6 changes: 3 additions & 3 deletions pkg/cmd/repo/view/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func viewRun(opts *ViewOptions) error {

var readmeContent string
if readme == nil {
readmeContent = cs.Gray("This repository does not have a README")
readmeContent = cs.Muted("This repository does not have a README")
} else if isMarkdownFile(readme.Filename) {
var err error
readmeContent, err = markdown.Render(readme.Content,
Expand All @@ -197,7 +197,7 @@ func viewRun(opts *ViewOptions) error {

description := repo.Description
if description == "" {
description = cs.Gray("No description provided")
description = cs.Muted("No description provided")
}

repoData := struct {
Expand All @@ -209,7 +209,7 @@ func viewRun(opts *ViewOptions) error {
FullName: cs.Bold(fullName),
Description: description,
Readme: readmeContent,
View: cs.Gray(fmt.Sprintf("View this repository on GitHub: %s", openURL)),
View: cs.Mutedf("View this repository on GitHub: %s", openURL),
}

return tmpl.Execute(stdout, repoData)
Expand Down
3 changes: 2 additions & 1 deletion pkg/cmd/run/shared/presentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ func RenderAnnotations(cs *iostreams.ColorScheme, annotations []Annotation) stri

for _, a := range annotations {
lines = append(lines, fmt.Sprintf("%s %s", AnnotationSymbol(cs, a), a.Message))
lines = append(lines, cs.Grayf("%s: %s#%d\n", a.JobName, a.Path, a.StartLine))
// Following newline is essential for spacing between annotations
lines = append(lines, cs.Mutedf("%s: %s#%d\n", a.JobName, a.Path, a.StartLine))
Comment thread
andyfeller marked this conversation as resolved.
}

return strings.Join(lines, "\n")
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/run/shared/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ func Symbol(cs *iostreams.ColorScheme, status Status, conclusion Conclusion) (st
case Success:
return cs.SuccessIconWithColor(noColor), cs.Green
case Skipped, Neutral:
return "-", cs.Gray
return "-", cs.Muted
default:
return cs.FailureIconWithColor(noColor), cs.Red
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/cmd/run/view/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ func runView(opts *ViewOptions) error {
for _, a := range artifacts {
expiredBadge := ""
if a.Expired {
expiredBadge = cs.Gray(" (expired)")
expiredBadge = cs.Muted(" (expired)")
}
fmt.Fprintf(out, "%s%s\n", a.Name, expiredBadge)
}
Expand All @@ -411,7 +411,7 @@ func runView(opts *ViewOptions) error {
} else {
fmt.Fprintf(out, "For more information about a job, try: gh run view --job=<job-id>\n")
}
fmt.Fprintf(out, cs.Gray("View this run on GitHub: %s\n"), run.URL)
fmt.Fprintln(out, cs.Mutedf("View this run on GitHub: %s", run.URL))
Comment thread
andyfeller marked this conversation as resolved.

if opts.ExitStatus && shared.IsFailureState(run.Conclusion) {
return cmdutil.SilentError
Expand All @@ -423,7 +423,7 @@ func runView(opts *ViewOptions) error {
} else {
fmt.Fprintf(out, "To see the full job log, try: gh run view --log --job=%d\n", selectedJob.ID)
}
fmt.Fprintf(out, cs.Gray("View this run on GitHub: %s\n"), run.URL)
fmt.Fprintln(out, cs.Mutedf("View this run on GitHub: %s", run.URL))

if opts.ExitStatus && shared.IsFailureState(selectedJob.Conclusion) {
return cmdutil.SilentError
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/search/commits/commits.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func displayResults(io *iostreams.IOStreams, now time.Time, results search.Commi
tp.AddField(commit.Sha)
tp.AddField(text.RemoveExcessiveWhitespace(commit.Info.Message))
tp.AddField(commit.Author.Login)
tp.AddTimeField(now, commit.Info.Author.Date, cs.Gray)
tp.AddTimeField(now, commit.Info.Author.Date, cs.Muted)
tp.EndRow()
}
if io.IsStdoutTTY() {
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/search/repos/repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,14 @@ func displayResults(io *iostreams.IOStreams, now time.Time, results search.Repos
tags = append(tags, "archived")
}
info := strings.Join(tags, ", ")
infoColor := cs.Gray
infoColor := cs.Muted
if repo.IsPrivate {
infoColor = cs.Yellow
}
tp.AddField(repo.FullName, tableprinter.WithColor(cs.Bold))
tp.AddField(text.RemoveExcessiveWhitespace(repo.Description))
tp.AddField(info, tableprinter.WithColor(infoColor))
tp.AddTimeField(now, repo.UpdatedAt, cs.Gray)
tp.AddTimeField(now, repo.UpdatedAt, cs.Muted)
tp.EndRow()
}
if io.IsStdoutTTY() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/search/shared/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func displayIssueResults(io *iostreams.IOStreams, now time.Time, et EntityType,
}
tp.AddField(text.RemoveExcessiveWhitespace(issue.Title))
tp.AddField(listIssueLabels(&issue, cs, tp.IsTTY()))
tp.AddTimeField(now, issue.UpdatedAt, cs.Gray)
tp.AddTimeField(now, issue.UpdatedAt, cs.Muted)
tp.EndRow()
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ func statusRun(opts *StatusOptions) error {
errs := sg.authErrors.ToSlice()
sort.Strings(errs)
for _, msg := range errs {
fmt.Fprintln(out, cs.Gray(fmt.Sprintf("warning: %s", msg)))
fmt.Fprintln(out, cs.Mutedf("warning: %s", msg))
}
}

Expand Down
Loading
Loading