Permalink
Browse files

do not simply drop file extension on the damn floor.

  • Loading branch information...
1 parent bca9b29 commit 62b3161abbe1363fde5d9f52784e273e188ffb8f @ahoward committed Jun 6, 2012
Showing with 8 additions and 1 deletion.
  1. +7 −1 gist
  2. +1 −0 lib/gist.rb
View
8 gist
@@ -1204,8 +1204,14 @@ module Gist
end
url = write(files, private_gist, description)
+ copy(url)
browse(url) if browse_enabled
- puts copy(url)
+
+ if $stdout.tty?
+ $stdout.puts(url)
+ else
+ files.each{|file| $stdout.write(file[:input])}
+ end
rescue => e
warn e
puts opts
View
@@ -202,6 +202,7 @@ def data(files, private_gist, description)
i = i + 1
filename = file[:filename] ? file[:filename] : "gistfile#{i}"
file_data[filename] = {:content => file[:input]}
+ file_data[filename][:extension] = file[:extension].to_s.sub(/\A\.*/, '.')
end
data = {"files" => file_data}

0 comments on commit 62b3161

Please sign in to comment.