aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-02-10 18:01:36 -0800
committerelijah <elijah@riseup.net>2013-02-10 18:01:36 -0800
commitabff8a84454ee971f093fc6e3cd0a64bba4fbac7 (patch)
tree1f2a1f609cf2b1e469934d96dcf6871af10f335b
parentf9d013c6923663a08344e2fe98f63d7189a6b3fd (diff)
downloadleap_cli-abff8a84454ee971f093fc6e3cd0a64bba4fbac7.tar.gz
leap_cli-abff8a84454ee971f093fc6e3cd0a64bba4fbac7.tar.bz2
display `leap list --print` null values as [null] instead of missing
-rw-r--r--lib/leap_cli/commands/list.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/leap_cli/commands/list.rb b/lib/leap_cli/commands/list.rb
index 501a548..02389e7 100644
--- a/lib/leap_cli/commands/list.rb
+++ b/lib/leap_cli/commands/list.rb
@@ -37,7 +37,15 @@ module LeapCli; module Commands
max_width = nodes.keys.inject(0) {|max,i| [i.size,max].max}
nodes.each_node do |node|
node.evaluate
- value = properties.collect{|prop| node[prop]}.join(', ')
+ value = properties.collect{|prop|
+ if node[prop].nil?
+ "[null]"
+ elsif node[prop] == ""
+ "[empty]"
+ else
+ node[prop]
+ end
+ }.join(', ')
printf("%#{max_width}s %s\n", node.name, value)
end
puts