1
0
mirror of https://github.com/seejohnrun/haste-client.git synced 2025-12-15 16:25:57 +00:00

Avoid explosions (code a little different from PR)

Closes #11
This commit is contained in:
John Crepezzi
2013-03-16 20:39:20 -04:00
parent 98e72bce43
commit 6760a64957

View File

@@ -11,8 +11,9 @@ module Haste
# Pull all of the data from STDIN # Pull all of the data from STDIN
def initialize def initialize
if STDIN.tty? if STDIN.tty?
abort 'No input file given' unless ARGV.length == 1 file = ARGV.first
abort "#{file}: No such path" unless File.exists?(file = ARGV[0]) abort 'No input file given' unless file
abort "#{file}: No such path" unless File.exists?(file)
@input = open(file).read @input = open(file).read
else else
@input = STDIN.readlines.join @input = STDIN.readlines.join