aboutsummaryrefslogtreecommitdiff
path: root/lib/leap_cli/commands/list.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2012-10-11 00:42:46 -0700
committerelijah <elijah@riseup.net>2012-10-11 00:42:46 -0700
commit113d3a59eaa7547433434d155fc1e60aa7c2094c (patch)
treec468f38066f2f7669f84efb2d6b971fac0cf2346 /lib/leap_cli/commands/list.rb
parent64073733a1213a5e4fe2fef7722996f62ba89c5c (diff)
downloadleap_cli-113d3a59eaa7547433434d155fc1e60aa7c2094c.tar.gz
leap_cli-113d3a59eaa7547433434d155fc1e60aa7c2094c.tar.bz2
code cleanup. better support for nested configs and templates.
Diffstat (limited to 'lib/leap_cli/commands/list.rb')
-rw-r--r--lib/leap_cli/commands/list.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/leap_cli/commands/list.rb b/lib/leap_cli/commands/list.rb
index 166ed2a..0f1c96e 100644
--- a/lib/leap_cli/commands/list.rb
+++ b/lib/leap_cli/commands/list.rb
@@ -1,16 +1,16 @@
module LeapCli
module Commands
- def self.print_config_table(type, config_list)
+ def self.print_config_table(type, object_list)
style = {:border_x => '-', :border_y => ':', :border_i => '-', :width => 60}
if type == :services
t = table do
self.style = style
self.headings = ['SERVICE', 'NODES']
- list = config_list.keys.sort
+ list = object_list.keys.sort
list.each do |name|
- add_row [name, config_list[name].nodes.keys.join(', ')]
+ add_row [name, object_list[name].node_list.keys.join(', ')]
add_separator unless name == list.last
end
end
@@ -20,9 +20,9 @@ module LeapCli
t = table do
self.style = style
self.headings = ['TAG', 'NODES']
- list = config_list.keys.sort
+ list = object_list.keys.sort
list.each do |name|
- add_row [name, config_list[name].nodes.keys.join(', ')]
+ add_row [name, object_list[name].node_list.keys.join(', ')]
add_separator unless name == list.last
end
end
@@ -32,9 +32,11 @@ module LeapCli
t = table do
self.style = style
self.headings = ['NODE', 'SERVICES', 'TAGS']
- list = config_list.keys.sort
+ list = object_list.keys.sort
list.each do |name|
- add_row [name, config_list[name].services.to_a.join(', '), config_list[name].tags.to_a.join(', ')]
+ services = object_list[name]['services'] || []
+ tags = object_list[name]['tags'] || []
+ add_row [name, services.to_a.join(', '), tags.to_a.join(', ')]
add_separator unless name == list.last
end
end