Class: Dip::Commands::List

Inherits:
Dip::Command show all
Defined in:
lib/dip/commands/list.rb

Instance Method Summary collapse

Methods inherited from Dip::Command

exec_program, exec_subprocess

Instance Method Details

#executeObject


9
10
11
12
13
14
15
16
17
# File 'lib/dip/commands/list.rb', line 9

def execute
  tree = InteractionTree.new(Dip.config.interaction).list

  longest_name = tree.keys.map(&:size).max

  tree.each do |name, command|
    puts "#{name.ljust(longest_name)}  ##{command[:description] ? " #{command[:description]}" : ""}"
  end
end