Class: MenuCommander::Command

Inherits:
MisterBin::Command
  • Object
show all
Includes:
Colsole
Defined in:
lib/menu_commander/command.rb

Instance Method Summary collapse

Instance Method Details

#commandObject



30
31
32
# File 'lib/menu_commander/command.rb', line 30

def command
  @command ||= menu.call
end


26
27
28
# File 'lib/menu_commander/command.rb', line 26

def menu
  @menu ||= Menu.new menu_file
end

#runObject

Raises:



15
16
17
18
19
20
21
22
23
24
# File 'lib/menu_commander/command.rb', line 15

def run
  raise Exit, VERSION if args['--version'] 
  raise MenuNotFound.new(paths: menu_paths, config: config) unless menu_file

  if args['--dry']
    say "$ !txtpur!#{command}"
  else
    exec command
  end
end