summaryrefslogtreecommitdiff
path: root/lib/leap_cli/commands/list.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2015-06-26 16:12:17 -0700
committerelijah <elijah@riseup.net>2015-06-26 16:12:17 -0700
commit98cf1714c70ac6833551bfdc26a50986c1e34944 (patch)
tree5636c44f38fc45b97ec4b0ec0b4ff7f1a7a648d9 /lib/leap_cli/commands/list.rb
parentac28764f2b227d25a2b9d2415199ff19af8e201a (diff)
`leap ls --print` should return values, not formulas
Diffstat (limited to 'lib/leap_cli/commands/list.rb')
-rw-r--r--lib/leap_cli/commands/list.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/leap_cli/commands/list.rb b/lib/leap_cli/commands/list.rb
index 0b78a2d..c562b59 100644
--- a/lib/leap_cli/commands/list.rb
+++ b/lib/leap_cli/commands/list.rb
@@ -46,12 +46,15 @@ module LeapCli; module Commands
max_width = nodes.keys.inject(0) {|max,i| [i.size,max].max}
nodes.each_node do |node|
value = properties.collect{|prop|
- if node[prop].nil?
+ prop_value = node[prop]
+ if prop_value.nil?
"null"
- elsif node[prop] == ""
+ elsif prop_value == ""
"empty"
+ elsif prop_value.is_a? LeapCli::Config::Object
+ node[prop].dump_json(:compact) # TODO: add option of getting pre-evaluation values.
else
- node[prop]
+ prop_value.to_s
end
}.join(', ')
printf("%#{max_width}s %s\n", node.name, value)