6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/resty/cli.rb', line 6
def run
options = Trollop::options do
version "Version: #{Resty::VERSION}\n"
opt :alias, "The per-host entry to use in ~/.ruby_resty.yml", type: :string, short: "-a"
opt :headers, "The headers sent with each request. Ex: X-NYAN-CAT-SECRET-KEY:nyan_nyan",
type: :strings, short: "-H"
opt :host, "The hostname of the REST service. Ex: http://nyan.cat", type: :string, short: "-h"
opt :username, "HTTP basic authentication username", type: :string, short: "-u"
opt :password, "HTTP basic authentication password", type: :string, short: "-p"
opt :verbose, "Verbose mode", short: "-v"
end
if missing_host_or_alias?(options)
puts "Please specify an alias OR a host. Use --help for more info."
elsif basic_auth_invalid?(options)
puts "Please specify a username and password. Use --help for more info."
else
Resty::Repl.start(options)
end
rescue ConfigFileError => e
puts e.message
end
|