Class: SmallCage::OptionsParser

Inherits:
Object
  • Object
show all
Defined in:
lib/smallcage/options_parser.rb

Overview

Parse command-line arguments.

Constant Summary collapse

VERSION_NOTE =
"SmallCage #{SmallCage::VERSION} - a simple website generator"

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ OptionsParser

Returns a new instance of OptionsParser.



7
8
9
10
# File 'lib/smallcage/options_parser.rb', line 7

def initialize(argv)
  @argv = argv
  @options = {}
end

Instance Method Details

#parseObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/smallcage/options_parser.rb', line 12

def parse
  @parser = create_main_parser
  parse_main_options

  @command_parsers = create_command_parsers
  parse_command
  parse_command_options

  @options
end