Class: Captify::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/captify/cli.rb

Overview

Capture inputs from command line interface.

Defined Under Namespace

Classes: AbortException, ExitException

Instance Method Summary collapse

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)
  options = {}
  argv = argv.clone
  parse_options! argv, options
  parse_target_dir! argv, options
  return options
rescue AbortException => ex
  @kernel.abort "#{ex.message}"
rescue ExitException => ex
  @kernel.puts "#{ex.message}"
  @kernel.exit
end