@@ -3,6 +3,7 @@ package list
33import (
44 "fmt"
55 "net/http"
6+ "time"
67
78 "github.com/cli/cli/internal/ghinstance"
89 "github.com/cli/cli/pkg/cmdutil"
@@ -75,14 +76,24 @@ func listRun(opts *ListOptions) error {
7576 tp := utils .NewTablePrinter (opts .IO )
7677
7778 for _ , gist := range gists {
78- // TODO i was getting confusing results with table printer's truncation
79- description := gist .Description
80- if len (description ) > 30 {
81- description = description [0 :27 ] + "..."
79+ fileCount := 0
80+ for _ , _ = range gist .Files {
81+ fileCount ++
8282 }
8383
84- tp .AddField (description , nil , cs .Bold )
85- tp .AddField (gist .HTMLURL , nil , nil )
84+ visibility := "public"
85+ visColor := cs .Green
86+ if ! gist .Public {
87+ visibility = "secret"
88+ visColor = cs .Red
89+ }
90+
91+ updatedAt := utils .FuzzyAgo (time .Since (gist .UpdatedAt ))
92+ tp .AddField (gist .ID , nil , nil )
93+ tp .AddField (gist .Description , nil , cs .Bold )
94+ tp .AddField (utils .Pluralize (fileCount , "file" ), nil , nil )
95+ tp .AddField (visibility , nil , visColor )
96+ tp .AddField (updatedAt , nil , utils .Gray )
8697 tp .EndRow ()
8798 }
8899
0 commit comments