lib/ec2/host/cli.rb in ec2-host-0.2.3 vs lib/ec2/host/cli.rb in ec2-host-0.2.4
- old
+ new
@@ -59,12 +59,12 @@
opts[:public_ip] = v
}
op.on('-i', '--info', "show host info") {|v|
opts[:info] = v
}
- op.on('-j', '--line-delimited-json', "show host info in line delimited json") {|v|
- opts[:line_delimited_json] = v
+ op.on('-j', '--jsonl', "show host info in line delimited json") {|v|
+ opts[:jsonl] = v
}
op.on('--json', "show host info in json") {|v|
opts[:json] = v
}
op.on('--pretty-json', "show host info in pretty json") {|v|
@@ -94,11 +94,11 @@
hosts = EC2::Host.new(condition)
if options[:info]
hosts.each do |host|
$stdout.puts host.info
end
- elsif options[:line_delimited_json]
+ elsif options[:jsonl]
hosts.each do |host|
$stdout.puts host.to_hash.to_json
end
elsif options[:json]
$stdout.puts hosts.map(&:to_hash).to_json
@@ -121,10 +121,10 @@
private
def condition
return @condition if @condition
- _condition = HashUtil.except(options, :info, :line_delimited_json, :json, :pretty_json, :debug, :private_ip, :public_ip)
+ _condition = HashUtil.except(options, :info, :jsonl, :json, :pretty_json, :debug, :private_ip, :public_ip)
@condition = {}
_condition.each do |key, val|
if tag = Config.optional_options[key.to_s]
field = StringUtil.underscore(tag)
@condition[field.to_sym] = val