lib/twurl/cli.rb in twurl-0.6.4 vs lib/twurl/cli.rb in twurl-0.6.5
- old
+ new
@@ -80,10 +80,18 @@
Twurl.options.path = extract_path!(arguments)
Twurl.options.subcommands = arguments
Twurl.options
end
+ def output
+ if Twurl.options && Twurl.options.output
+ Twurl.options.output
+ else
+ @output
+ end
+ end
+
def print(*args, &block)
output.print(*args, &block)
end
def puts(*args, &block)
@@ -185,10 +193,10 @@
end
def data
on('-d', '--data [data]', 'Sends the specified data in a POST request to the HTTP server.') do |data|
data.split('&').each do |pair|
- key, value = pair.split('=')
+ key, value = pair.split('=', 2)
options.data[key] = value
end
end
end