lib/twurl/cli.rb in twurl-0.9.5 vs lib/twurl/cli.rb in twurl-0.9.6
- old
+ new
@@ -65,11 +65,10 @@
tutorial
end
o.section "Authorization options:" do
username
- password
consumer_key
consumer_secret
access_token
token_secret
end
@@ -94,11 +93,19 @@
connection_timeout
app_only
end
end
- arguments = option_parser.parse!(args)
+ begin
+ arguments = option_parser.parse!(args)
+ rescue OptionParser::InvalidOption
+ CLI.puts "ERROR: undefined option"
+ exit
+ rescue
+ CLI.puts "ERROR: invalid argument"
+ exit
+ end
Twurl.options.command = extract_command!(arguments)
Twurl.options.path = extract_path!(arguments)
Twurl.options.subcommands = arguments
if Twurl.options.command == DEFAULT_COMMAND and Twurl.options.path.nil? and Twurl.options.args.empty?
@@ -214,15 +221,9 @@
end
def username
on('-u', '--username [username]', 'Username of account to authorize (required)') do |username|
options.username = username
- end
- end
-
- def password
- on('-p', '--password [password]', 'Password of account to authorize (required)') do |password|
- options.password = password ? password : CLI.prompt_for('Password')
end
end
def trace
on('-t', '--[no-]trace', 'Trace request/response traffic (default: --no-trace)') do |trace|