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:
@@ -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
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
module Haste
|
module Haste
|
||||||
|
|
||||||
VERSION = '0.0.4'
|
VERSION = '0.0.5'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user