lib/onering/cli/reporter.rb in onering-client-0.0.60 vs lib/onering/cli/reporter.rb in onering-client-0.0.61
- old
+ new
@@ -27,22 +27,25 @@
def self.run(args)
report = Onering::Reporter.report().stringify_keys()
# pull report overrides from the config file
- @api.opt('reporter.fields',{}).each do |field, value|
+ @api.opt('reporter.fields',{}).each do |key, value|
if value.is_a?(Hash)
- value.coalesce(field, nil, '.').each do |k,v|
+ value.coalesce(key, nil, '.').each do |k,v|
+ v = nil if ['null', '', '-'].include?(v.to_s.strip.chomp)
report = report.set(k, v)
end
else
- report = report.set(field, value)
+ value = nil if ['null', '', '-'].include?(value.to_s.strip.chomp)
+ report = report.set(key, value)
end
end
# pull overrides from CLI arguments
@opts[:fields].each do |field|
key, value = field.split('=', 2)
+ value = nil if ['null', '', '-'].include?(value.to_s.strip.chomp)
report = report.set(key, value)
end
# save if specified
\ No newline at end of file