From 4c86d6527bfa83faa124d4887b54be4702ca63b8 Mon Sep 17 00:00:00 2001 From: elijah Date: Wed, 12 Dec 2012 23:04:52 -0800 Subject: `leap list --print` -- now it evaluates all node keys before printing --- lib/leap_cli/commands/list.rb | 7 ++++--- lib/leap_cli/config/object.rb | 11 ++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/leap_cli/commands/list.rb b/lib/leap_cli/commands/list.rb index 42f2996..501a548 100644 --- a/lib/leap_cli/commands/list.rb +++ b/lib/leap_cli/commands/list.rb @@ -35,9 +35,10 @@ module LeapCli; module Commands node_list = manager.nodes properties = properties.split(',') max_width = nodes.keys.inject(0) {|max,i| [i.size,max].max} - nodes.keys.sort.each do |node_name| - value = properties.collect{|prop| node_list[node_name][prop]}.join(', ') - printf("%#{max_width}s %s\n", node_name, value) + nodes.each_node do |node| + node.evaluate + value = properties.collect{|prop| node[prop]}.join(', ') + printf("%#{max_width}s %s\n", node.name, value) end puts end diff --git a/lib/leap_cli/config/object.rb b/lib/leap_cli/config/object.rb index e866a1c..395ebe3 100644 --- a/lib/leap_cli/config/object.rb +++ b/lib/leap_cli/config/object.rb @@ -38,15 +38,20 @@ module LeapCli # greater control over how the yaml is exported (sorted keys, in particular). # def dump - self.evaluate_everything - self.late_evaluate_everything - self.ya2yaml(:syck_compatible => true) + evaluate + ya2yaml(:syck_compatible => true) end def dump_json + evaluate generate_json(self) end + def evaluate + evaluate_everything + late_evaluate_everything + end + ## ## FETCHING VALUES ## -- cgit v1.2.3