class MCLI::CommandGroup
Public Class Methods
call(args)
click to toggle source
# File lib/mcli/command_group.rb, line 23 def call(args) command = args.shift commands.fetch(command.to_s.to_sym) do |command| args.unshift(command) root_command || MCLI::NullCommand end.call(args) end
clear()
click to toggle source
# File lib/mcli/command_group.rb, line 15 def clear @commands = {} end
commands()
click to toggle source
# File lib/mcli/command_group.rb, line 11 def commands @commands ||= {} end
register(command_name, command_klass)
click to toggle source
# File lib/mcli/command_group.rb, line 3 def register(command_name, command_klass) commands[command_name] = command_klass end
register_root(command_klass)
click to toggle source
# File lib/mcli/command_group.rb, line 7 def register_root(command_klass) @root_command = command_klass end
root_command()
click to toggle source
# File lib/mcli/command_group.rb, line 19 def root_command @root_command end