Module: Kuzya::Commands

Defined in:
lib/kuzya/commands.rb

Defined Under Namespace

Classes: Add, Base, Help, List, Open, Remove, Version

Constant Summary collapse

COMMANDS_MAPPING =
{
  /^(version|-v|--version)$/ => 'version',
  /^(add)$/ => 'add',
  /^(remove|rm)$/ => 'remove',
  /^(list)$/ => 'list',
  /^(help)$/ => 'help'
}.freeze

Class Method Summary collapse

Class Method Details

.fetch_command(first_arg) ⇒ Object



12
13
14
# File 'lib/kuzya/commands.rb', line 12

def self.fetch_command(first_arg)
  COMMANDS_MAPPING.detect { |regex, _| first_arg =~ regex }&.[](1) || 'open'
end