Class: IPCrypt::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/ipcrypt/cli.rb

Class Method Summary collapse

Class Method Details

.help(shell, subcommand = false) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/ipcrypt/cli.rb', line 22

def self.help(shell, subcommand = false)
  list = printable_commands(true, subcommand)
  Thor::Util.thor_classes_in(self).each do |klass|
    list += klass.printable_commands(false)
  end
  list.sort! { |a, b| a[0] <=> b[0] }
  list.reject! { |e| /.*help.*/.match? e.first }
  list.map! {|c| c.map {|s| s.gsub('decrypt', ?d).gsub('encrypt', ?e)} }

  if defined?(@package_name) && @package_name
    shell.say "#{@package_name} commands:"
  else
    shell.say "Commands:"
  end

  shell.print_table(list, :indent => 2, :truncate => true)
  shell.say
  class_options_help(shell)
end