Method: VMC::Cli::Runner#parse_options!

Defined in:
lib/cli/runner.rb

#parse_options!Object

Collect all the available options for all commands Some duplicates exists to capture all scenarios



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/cli/runner.rb', line 25

def parse_options!
  opts_parser = OptionParser.new do |opts|
    opts.banner = "\nAvailable options:\n\n"

    opts.on('--email EMAIL')     { |email| @options[:email] = email }
    opts.on('--user EMAIL')      { |email| @options[:email] = email }
    opts.on('--passwd PASS')     { |pass|  @options[:password] = pass }
    opts.on('--pass PASS')       { |pass|  @options[:password] = pass }
    opts.on('--password PASS')   { |pass|  @options[:password] = pass }
    opts.on('--token-file TOKEN_FILE')     { |token_file|  @options[:token_file] = token_file }
    opts.on('--app NAME')        { |name|  @options[:name] = name }
    opts.on('--name NAME')       { |name|  @options[:name] = name }
    opts.on('--bind BIND')       { |bind|  @options[:bind] = bind }
    opts.on('--instance INST')   { |inst|  @options[:instance] = inst }
    opts.on('--instances INST')  { |inst|  @options[:instances] = inst }
    opts.on('--url URL')         { |url|   @options[:url] = url }
    opts.on('--mem MEM')         { |mem|   @options[:mem] = mem }
    opts.on('--path PATH')       { |path|  @options[:path] = path }
    opts.on('--no-start')        {         @options[:nostart] = true }
    opts.on('--nostart')         {         @options[:nostart] = true }
    opts.on('--force')           {         @options[:force] = true }
    opts.on('--all')             {         @options[:all] = true }

    # generic tracing and debugging
    opts.on('-t [TKEY]')         { |tkey|  @options[:trace] = tkey || true }
    opts.on('--trace [TKEY]')    { |tkey|  @options[:trace] = tkey || true }

    # start application in debug mode
    opts.on('-d [MODE]')         { |mode|  @options[:debug] = mode || "run" }
    opts.on('--debug [MODE]')    { |mode|  @options[:debug] = mode || "run" }

    # override manifest file
    opts.on('-m FILE')           { |file|  @options[:manifest] = file }
    opts.on('--manifest FILE')   { |file|  @options[:manifest] = file }

    opts.on('-q', '--quiet')     {         @options[:quiet] = true }

    # micro cloud options
    opts.on('--vmx FILE')        { |file|  @options[:vmx] = file }
    opts.on('--vmrun FILE')      { |file|  @options[:vmrun] = file }
    opts.on('--save')            {         @options[:save] = true }

    # Don't use builtin zip
    opts.on('--no-zip')          {         @options[:nozip] = true }
    opts.on('--nozip')           {         @options[:nozip] = true }

    opts.on('--no-resources')    {         @options[:noresources] = true }
    opts.on('--noresources')     {         @options[:noresources] = true }

    opts.on('--no-color')        {         @options[:colorize] = false }
    opts.on('--verbose')         {         @options[:verbose] = true }

    opts.on('-n','--no-prompt')  {         @options[:noprompts] = true }
    opts.on('--noprompt')        {         @options[:noprompts] = true }
    opts.on('--non-interactive') {         @options[:noprompts] = true }

    opts.on('--prefix')          {         @options[:prefixlogs] = true }
    opts.on('--prefix-logs')     {         @options[:prefixlogs] = true }
    opts.on('--prefixlogs')      {         @options[:prefixlogs] = true }

    opts.on('--json')            {         @options[:json] = true }

    opts.on('-v', '--version')   {         set_cmd(:misc, :version) }
    opts.on('-h', '--help')      {         puts "#{command_usage}\n"; exit }

    opts.on('--port PORT')       { |port|  @options[:port] = port }

    opts.on('--runtime RUNTIME') { |rt|    @options[:runtime] = rt }

    # deprecated
    opts.on('--exec EXEC')       { |exec|  @options[:exec] = exec }
    opts.on('--noframework')     {         @options[:noframework] = true }
    opts.on('--canary')          {         @options[:canary] = true }

    # Proxying for another user, requires admin privileges
    opts.on('-u PROXY')          { |proxy| @options[:proxy] = proxy }
    
    # Select infrastructure
    opts.on('--infra INFRA')     { |infra| @options[:infra] = infra }

    opts.on_tail('--options')    {          puts "#{opts}\n"; exit }
  end
  instances_delta_arg = check_instances_delta!
  @args = opts_parser.parse!(@args)
  @args.concat instances_delta_arg
  convert_options!
  self
end