Class: Captify::Cli
- Inherits:
-
Object
- Object
- Captify::Cli
- Defined in:
- lib/captify/cli.rb
Overview
Capture inputs from command line interface.
Defined Under Namespace
Classes: AbortException, ExitException
Instance Method Summary collapse
-
#initialize(kernel = Kernel) ⇒ Cli
constructor
A new instance of Cli.
- #parse_argv(argv) ⇒ Object
Constructor Details
#initialize(kernel = Kernel) ⇒ Cli
Returns a new instance of Cli.
9 10 11 |
# File 'lib/captify/cli.rb', line 9 def initialize(kernel=Kernel) @kernel = kernel end |
Instance Method Details
#parse_argv(argv) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/captify/cli.rb', line 13 def parse_argv(argv) = {} argv = argv.clone argv, parse_target_dir! argv, return rescue AbortException => ex @kernel.abort "#{ex.}" rescue ExitException => ex @kernel.puts "#{ex.}" @kernel.exit end |