Class: Haste::CLI
- Inherits:
-
Object
- Object
- Haste::CLI
- Defined in:
- lib/haste/cli.rb
Instance Method Summary collapse
-
#initialize ⇒ CLI
constructor
Create a new uploader.
-
#start ⇒ Object
And then handle the basic usage.
Constructor Details
Instance Method Details
#start ⇒ Object
And then handle the basic usage
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/haste/cli.rb', line 11 def start # Take data in if STDIN.tty? key = @uploader.upload_path ARGV.first else key = @uploader.upload_raw STDIN.readlines.join end # Put together a URL if ARGV.include?('--raw') url = "#{@uploader.server_url}/raw/#{key}" else url = "#{@uploader.server_url}/#{key}" end # And write data out if STDOUT.tty? STDOUT.puts url else STDOUT.print url end rescue Exception => e abort e. end |