Class: Spinup::CLI

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

Defined Under Namespace

Classes: Options

Class Method Summary collapse

Class Method Details

.parse(options, supported) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/spinup/cli.rb', line 7

def self.parse(options, supported)
  args = Options.new('world')

  opt_parser = OptionParser.new do |opts|
    opts.banner = ['Usage: spinup <playground> [<directory>]',
                   "Supported playgrounds: #{supported.map(&:to_s).join(', ')}"].join("\n")

    opts.on('-h', '--help', 'Prints this help') do
      puts opts
      exit
    end
  end

  opt_parser.parse!(options)
  args
end