File tree Expand file tree Collapse file tree 2 files changed +27
-6
lines changed
Expand file tree Collapse file tree 2 files changed +27
-6
lines changed Original file line number Diff line number Diff line change @@ -89,11 +89,6 @@ func viewRun(opts *ViewOptions) error {
8989 return err
9090 }
9191
92- cs := opts .IO .ColorScheme ()
93- if gist .Description != "" {
94- fmt .Fprintf (opts .IO .Out , "%s\n " , cs .Bold (gist .Description ))
95- }
96-
9792 if opts .Filename != "" {
9893 gistFile , ok := gist .Files [opts .Filename ]
9994 if ! ok {
@@ -107,6 +102,11 @@ func viewRun(opts *ViewOptions) error {
107102
108103 showFilenames := len (gist .Files ) > 1
109104
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 {
Original file line number Diff line number Diff line change @@ -131,6 +131,27 @@ func Test_viewRun(t *testing.T) {
131131 },
132132 wantOut : "bwhiizzzbwhuiiizzzz\n \n " ,
133133 },
134+ {
135+ name : "filename selected, raw" ,
136+ opts : & ViewOptions {
137+ Selector : "1234" ,
138+ Filename : "cicada.txt" ,
139+ Raw : true ,
140+ },
141+ gist : & shared.Gist {
142+ Files : map [string ]* shared.GistFile {
143+ "cicada.txt" : {
144+ Content : "bwhiizzzbwhuiiizzzz" ,
145+ Type : "text/plain" ,
146+ },
147+ "foo.md" : {
148+ Content : "# foo" ,
149+ Type : "application/markdown" ,
150+ },
151+ },
152+ },
153+ wantOut : "bwhiizzzbwhuiiizzzz\n \n " ,
154+ },
134155 {
135156 name : "multiple files, no description" ,
136157 opts : & ViewOptions {
@@ -171,7 +192,7 @@ func Test_viewRun(t *testing.T) {
171192 wantOut : "some files\n cicada.txt\n \n bwhiizzzbwhuiiizzzz\n \n foo.md\n \n \n \n • foo \n \n \n \n " ,
172193 },
173194 {
174- name : "raw" ,
195+ name : "multiple files, raw" ,
175196 opts : & ViewOptions {
176197 Selector : "1234" ,
177198 Raw : true ,
You can’t perform that action at this time.
0 commit comments