@@ -14,7 +14,6 @@ import (
1414 "github.com/cli/cli/git"
1515 "github.com/cli/cli/internal/ghrepo"
1616 "github.com/cli/cli/pkg/githubtemplate"
17- "github.com/cli/cli/pkg/text"
1817 "github.com/cli/cli/utils"
1918 "github.com/spf13/cobra"
2019 "github.com/spf13/pflag"
@@ -133,22 +132,8 @@ func issueList(cmd *cobra.Command, args []string) error {
133132 fmt .Fprintf (colorableErr (cmd ), "\n %s\n \n " , title )
134133
135134 out := cmd .OutOrStdout ()
136- table := utils .NewTablePrinter (out )
137- for _ , issue := range listResult .Issues {
138- issueNum := strconv .Itoa (issue .Number )
139- if table .IsTTY () {
140- issueNum = "#" + issueNum
141- }
142- labels := labelList (issue )
143- if labels != "" && table .IsTTY () {
144- labels = fmt .Sprintf ("(%s)" , labels )
145- }
146- table .AddField (issueNum , nil , colorFuncForState (issue .State ))
147- table .AddField (replaceExcessiveWhitespace (issue .Title ), nil , nil )
148- table .AddField (labels , nil , utils .Gray )
149- table .EndRow ()
150- }
151- table .Render ()
135+
136+ printIssues (out , "" , len (listResult .Issues ), listResult .Issues )
152137
153138 return nil
154139}
@@ -372,7 +357,7 @@ func issueCreate(cmd *cobra.Command, args []string) error {
372357 interactive := title == "" || body == ""
373358
374359 if interactive {
375- tb , err := titleBodySurvey (cmd , title , body , templateFiles )
360+ tb , err := titleBodySurvey (cmd , title , body , defaults {}, templateFiles )
376361 if err != nil {
377362 return fmt .Errorf ("could not collect title and/or body: %w" , err )
378363 }
@@ -423,21 +408,26 @@ func issueCreate(cmd *cobra.Command, args []string) error {
423408}
424409
425410func printIssues (w io.Writer , prefix string , totalCount int , issues []api.Issue ) {
411+ table := utils .NewTablePrinter (w )
426412 for _ , issue := range issues {
427- number := utils .Green ("#" + strconv .Itoa (issue .Number ))
428- coloredLabels := labelList (issue )
429- if coloredLabels != "" {
430- coloredLabels = utils .Gray (fmt .Sprintf (" (%s)" , coloredLabels ))
413+ issueNum := strconv .Itoa (issue .Number )
414+ if table .IsTTY () {
415+ issueNum = "#" + issueNum
416+ }
417+ issueNum = prefix + issueNum
418+ labels := labelList (issue )
419+ if labels != "" && table .IsTTY () {
420+ labels = fmt .Sprintf ("(%s)" , labels )
431421 }
432-
433422 now := time .Now ()
434423 ago := now .Sub (issue .UpdatedAt )
435-
436- fmt . Fprintf ( w , "%s%s %s%s %s \n " , prefix , number ,
437- text . Truncate ( 70 , replaceExcessiveWhitespace ( issue . Title )),
438- coloredLabels ,
439- utils . Gray ( utils . FuzzyAgo ( ago )) )
424+ table . AddField ( issueNum , nil , colorFuncForState ( issue . State ))
425+ table . AddField ( replaceExcessiveWhitespace ( issue . Title ), nil , nil )
426+ table . AddField ( labels , nil , utils . Gray )
427+ table . AddField ( utils . FuzzyAgo ( ago ), nil , utils . Gray )
428+ table . EndRow ( )
440429 }
430+ table .Render ()
441431 remaining := totalCount - len (issues )
442432 if remaining > 0 {
443433 fmt .Fprintf (w , utils .Gray ("%sAnd %d more\n " ), prefix , remaining )
0 commit comments