Show the issue state for viewing issues in CLI
This commit is contained in:
parent
faa4bed67a
commit
caf26e4093
1 changed files with 13 additions and 4 deletions
|
|
@ -251,16 +251,25 @@ func issueView(cmd *cobra.Command, args []string) error {
|
|||
func printIssuePreview(out io.Writer, issue *api.Issue) error {
|
||||
coloredLabels := labelList(*issue)
|
||||
if coloredLabels != "" {
|
||||
coloredLabels = utils.Gray(fmt.Sprintf("(%s)", coloredLabels))
|
||||
coloredLabels = fmt.Sprintf("%s", coloredLabels)
|
||||
}
|
||||
|
||||
now := time.Now()
|
||||
ago := now.Sub(issue.CreatedAt)
|
||||
issueStateColorFunc := utils.ColorFuncForState(issue.State)
|
||||
|
||||
fmt.Fprintln(out, utils.Bold(issue.Title))
|
||||
fmt.Fprintln(out, utils.Gray(fmt.Sprintf(
|
||||
"opened by %s. %s. %s",
|
||||
fmt.Fprintf(out, "%s", issueStateColorFunc(issue.State))
|
||||
fmt.Fprint(out, utils.Gray(fmt.Sprintf(
|
||||
" • %s opened %s • %s • ",
|
||||
issue.Author.Login,
|
||||
utils.FuzzyAgo(ago),
|
||||
utils.Pluralize(issue.Comments.TotalCount, "comment"),
|
||||
coloredLabels,
|
||||
)))
|
||||
if coloredLabels != "" {
|
||||
fmt.Fprintf(out, "%s", utils.Gray(coloredLabels))
|
||||
}
|
||||
fmt.Fprintf(out, "\n")
|
||||
|
||||
if issue.Body != "" {
|
||||
fmt.Fprintln(out)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue