Module: Abt::Cli::GlobalCommands

Defined in:
lib/abt/cli/global_commands.rb,
lib/abt/cli/global_commands/help.rb,
lib/abt/cli/global_commands/share.rb,
lib/abt/cli/global_commands/readme.rb,
lib/abt/cli/global_commands/version.rb,
lib/abt/cli/global_commands/commands.rb,
lib/abt/cli/global_commands/examples.rb

Defined Under Namespace

Classes: Commands, Examples, Help, Readme, Share, Version

Class Method Summary collapse

Class Method Details

.command_class(name) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/abt/cli/global_commands.rb', line 12

def self.command_class(name)
  name = "help" if [nil, "-h", "--help"].include?(name)
  name = "version" if ["-v", "--version"].include?(name)

  const_name = Helpers.command_to_const(name)
  return unless const_defined?(const_name)

  const_get(const_name)
end

.command_namesObject



8
9
10
# File 'lib/abt/cli/global_commands.rb', line 8

def self.command_names
  constants.sort.map { |constant_name| Helpers.const_to_command(constant_name) }
end