Skip to content

Commit 9c934a9

Browse files
author
Philip Hallstrom
committed
exit silently if --skip-empty and all files are empty
1 parent bd98d7b commit 9c934a9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

bin/gist

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ begin
203203
end
204204
end
205205

206-
puts Gist.multi_gist(files, options)
206+
output = Gist.multi_gist(files, options)
207+
puts output if output
207208
end
208209

209210
rescue Gist::Error => e

lib/gist.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def multi_gist(files, options={})
118118
end
119119
end
120120

121-
raise "All files were empty. No gist created." if json[:files].empty? && options[:skip_empty]
121+
return if json[:files].empty? && options[:skip_empty]
122122

123123
existing_gist = options[:update].to_s.split("/").last
124124
if options[:anonymous]

0 commit comments

Comments
 (0)