in lib/twurl/cli.rb [42:114]
def parse_options(args)
Twurl.options = Options.new
Twurl.options.args = args.dup
Twurl.options.trace = false
Twurl.options.data = {}
Twurl.options.headers = {}
Twurl.options.upload = {}
Twurl.options.upload['file'] = []
option_parser = OptionParser.new do |o|
o.extend AvailableOptions
o.banner = <<-BANNER
Usage: twurl authorize --consumer-key key --consumer-secret secret
twurl [options] /1.1/statuses/home_timeline.json
Supported Commands:
BANNER
o.section "Getting started:" do
tutorial
end
o.section "Authorization options:" do
username
consumer_key
consumer_secret
access_token
token_secret
end
o.section "Common options:" do
trace
data
raw_data
headers
host
quiet
request_method
help
version
proxy
file
filefield
base64
json_format
timeout
connection_timeout
app_only
end
end
begin
arguments = option_parser.parse!(args)
rescue OptionParser::InvalidOption
raise Exception "ERROR: undefined option"
rescue Twurl::Exception
raise
rescue
raise Exception "ERROR: invalid argument"
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?
CLI.puts option_parser
raise Exception, "No path found"
end
Twurl.options
end