1
0
mirror of https://github.com/seejohnrun/haste-client.git synced 2026-01-04 09:29:13 +00:00

Merge pull request #1 from phaza/master

Ability to give a filename as first argument to haste client
This commit is contained in:
John Crepezzi
2012-01-14 18:28:46 -08:00

View File

@@ -12,8 +12,20 @@ module Haste
# Pull all of the data from STDIN
def initialize
@input = STDIN.readlines.join
@input.strip!
if STDIN.tty?
if ARGV.empty?
puts "No input file given"
exit
end
file = ARGV[0]
abort "#{file} doesn't exist" unless File.exists?(file)
@input = open(file).read.strip
else
@input = STDIN.readlines.join
@input.strip!
end
end
# Upload the and output the URL we get back