Class: ExtraSpace::CLI

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

Overview

Used when interacting with the library from the command line interface (CLI).

Usage:

cli = ExtraSpace::CLI.new
cli.parse

Defined Under Namespace

Modules: Code

Instance Method Summary collapse

Instance Method Details

#parse(argv = ARGV) ⇒ Object

Parameters:

  • argv (Array<String>) (defaults to: ARGV)


19
20
21
22
23
24
25
26
27
28
29
# File 'lib/extraspace/cli.rb', line 19

def parse(argv = ARGV)
  parser.parse!(argv)
  command = argv.shift

  case command
  when 'crawl' then crawl(*argv)
  else
    warn("unsupported command=#{command.inspect}")
    exit(Code::ERROR)
  end
end