Class: DocumentGenerator::CLI

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

Class Method Summary collapse

Class Method Details

.parse(args) ⇒ Object

Raises:

  • (OptionParser::MissingArgument)


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/document_generator/cli.rb', line 9

def self.parse(args)
  options = OpenStruct.new

  parser = OptionParser.new do |opts|
    opts.on('-u', '--url URL',
            'URL for the repository') do |url|
      options.url = url
    end
  end

  parser.parse!(args)

  # TODO: Do something better than this.
  raise OptionParser::MissingArgument unless options.url

  options
end

.start(args) ⇒ Object



3
4
5
6
7
# File 'lib/document_generator/cli.rb', line 3

def self.start(args)
  options = parse(args)

  Repository.new(options.url).generate
end