Method: Front::CLI::Configuration#get_parser

Defined in:
lib/front/cli/configuration.rb

#get_parser(args, options) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/front/cli/configuration.rb', line 18

def get_parser(args, options)
  OptionParser.new do |opts|
    options.opts = opts
    opts.banner = 'Usage: front [options] [action]'
    opts.separator ''
    opts.separator 'Actions'
    opts.separator '  create     : create a new pool'
    opts.separator '  destroy    : destroy pool'
    opts.separator '  next       : switch to next instance in pool'
    opts.separator '  ssh        : ssh to current instance => vagrant ssh'
    opts.separator '  ssh_config : print ssh config for current instance'
    opts.separator '  inventory  : print inventory file (for ansible)'
    opts.separator ''
    opts.separator 'Options'
    opts.separator ''

    opts.on('-s', '--size <size>', Integer, 'Size of instance pool') do |pool_size|
      options.pool_size = pool_size
    end

    opts.on_tail('-V', '--version', 'Print Front version') do
      options.action = :show_version
    end

    opts.on_tail('-h', '--help', 'Print Front help') do
      options.action = :show_help
    end
  end
end