1
0
mirror of https://github.com/seejohnrun/haste-client.git synced 2025-12-22 19:41:28 +00:00

Use puts on tty?, print on non-tty?

This is so that there isn't a newline when doing something like:
`cat something | haste | pbcopy`
This commit is contained in:
John Crepezzi
2012-01-06 20:44:47 -05:00
parent c4fd7bd336
commit 2a8e0297ad
2 changed files with 3 additions and 2 deletions

View File

@@ -23,7 +23,8 @@ module Haste
response = http.post '/documents', input response = http.post '/documents', input
if response.is_a?(Net::HTTPOK) if response.is_a?(Net::HTTPOK)
data = JSON.parse(response.body) data = JSON.parse(response.body)
STDOUT.puts "#{server}/#{data['key']}" method = STDOUT.tty? ? :puts : :print
STDOUT.send method, "#{server}/#{data['key']}"
else else
STDERR.puts "failure uploading: #{response.code}" STDERR.puts "failure uploading: #{response.code}"
end end

View File

@@ -1,5 +1,5 @@
module Haste module Haste
VERSION = '0.0.4' VERSION = '0.0.5'
end end