File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,11 @@ func viewRun(opts *ViewOptions) error {
8989 return err
9090 }
9191
92+ cs := opts .IO .ColorScheme ()
93+ if gist .Description != "" && opts .Filename == "" {
94+ fmt .Fprintf (opts .IO .Out , "%s\n " , cs .Bold (gist .Description ))
95+ }
96+
9297 if opts .Filename != "" {
9398 gistFile , ok := gist .Files [opts .Filename ]
9499 if ! ok {
@@ -102,11 +107,6 @@ func viewRun(opts *ViewOptions) error {
102107
103108 showFilenames := len (gist .Files ) > 1
104109
105- cs := opts .IO .ColorScheme ()
106- if gist .Description != "" && showFilenames {
107- fmt .Fprintf (opts .IO .Out , "%s\n " , cs .Bold (gist .Description ))
108- }
109-
110110 outs := []string {} // to ensure consistent ordering
111111
112112 for filename , gistFile := range gist .Files {
@@ -122,7 +122,10 @@ func viewRun(opts *ViewOptions) error {
122122 content = rendered
123123 }
124124 }
125- out += fmt .Sprintf ("%s\n \n " , content )
125+ out += fmt .Sprintf ("%s" , content )
126+ if opts .Filename == "" {
127+ out += fmt .Sprintf ("\n \n " )
128+ }
126129
127130 outs = append (outs , out )
128131 }
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ func Test_viewRun(t *testing.T) {
129129 },
130130 },
131131 },
132- wantOut : "bwhiizzzbwhuiiizzzz\n \n " ,
132+ wantOut : "bwhiizzzbwhuiiizzzz" ,
133133 },
134134 {
135135 name : "filename selected, raw" ,
@@ -150,7 +150,7 @@ func Test_viewRun(t *testing.T) {
150150 },
151151 },
152152 },
153- wantOut : "bwhiizzzbwhuiiizzzz\n \n " ,
153+ wantOut : "bwhiizzzbwhuiiizzzz" ,
154154 },
155155 {
156156 name : "multiple files, no description" ,
You can’t perform that action at this time.
0 commit comments