aboutsummaryrefslogtreecommitdiff
path: root/lib/leap_cli/commands/list.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2014-09-30 13:36:26 -0700
committerelijah <elijah@riseup.net>2014-09-30 13:36:26 -0700
commita5b77fa30ed5548978c0907b74ba986cdbf6c11a (patch)
treefad9db58d566fb3cc2b4a605bc941ea580dfb1a9 /lib/leap_cli/commands/list.rb
parent410b5d793e8b8ee0abd42b581f09d8c7d5721ed3 (diff)
downloadleap_cli-a5b77fa30ed5548978c0907b74ba986cdbf6c11a.tar.gz
leap_cli-a5b77fa30ed5548978c0907b74ba986cdbf6c11a.tar.bz2
environment pinning: new commands `leap env`, `leap env pin X` and `leap env unpin`. See `leap help env` for more information.
Diffstat (limited to 'lib/leap_cli/commands/list.rb')
-rw-r--r--lib/leap_cli/commands/list.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/leap_cli/commands/list.rb b/lib/leap_cli/commands/list.rb
index be9163b..b8d7739 100644
--- a/lib/leap_cli/commands/list.rb
+++ b/lib/leap_cli/commands/list.rb
@@ -30,9 +30,10 @@ module LeapCli; module Commands
if args.any?
NodeTable.new(manager.filter(args), colors).run
else
- TagTable.new('SERVICES', manager.services, colors).run
- TagTable.new('TAGS', manager.tags, colors).run
- NodeTable.new(manager.nodes, colors).run
+ environment = LeapCli.leapfile.environment || '_all_'
+ TagTable.new('SERVICES', manager.env(environment).services, colors).run
+ TagTable.new('TAGS', manager.env(environment).tags, colors).run
+ NodeTable.new(manager.filter(), colors).run
end
end
end
@@ -41,7 +42,6 @@ module LeapCli; module Commands
private
def self.print_node_properties(nodes, properties)
- node_list = manager.nodes
properties = properties.split(',')
max_width = nodes.keys.inject(0) {|max,i| [i.size,max].max}
nodes.each_node do |node|
@@ -75,6 +75,7 @@ module LeapCli; module Commands
column "NODES", :width => HighLine::SystemExtensions.terminal_size.first - max_width - 2, :padding => 2
end
tags.each do |tag|
+ next if @tag_list[tag].node_list.empty?
row :color => @colors[1] do
column tag
column @tag_list[tag].node_list.keys.sort.join(', ')