Class: Harp::CLI
- Inherits:
-
Object
- Object
- Harp::CLI
- Defined in:
- lib/harp/cli.rb
Instance Method Summary collapse
-
#initialize(command_manager) ⇒ CLI
constructor
A new instance of CLI.
- #parse(array) ⇒ Object
- #run(context) ⇒ Object
Constructor Details
#initialize(command_manager) ⇒ CLI
Returns a new instance of CLI.
6 7 8 9 |
# File 'lib/harp/cli.rb', line 6 def initialize(command_manager) @command_manager = command_manager @commands = command_manager.commands.keys end |
Instance Method Details
#parse(array) ⇒ Object
16 17 18 |
# File 'lib/harp/cli.rb', line 16 def parse(array) array end |
#run(context) ⇒ Object
11 12 13 14 |
# File 'lib/harp/cli.rb', line 11 def run(context) name, *args = parse(ARGV) @command_manager.handle(name, args, context) end |