Class: Sanctum::CLI

Inherits:
Object
  • Object
show all
Extended by:
GLI::App
Defined in:
lib/sanctum/cli.rb

Class Method Summary collapse

Class Method Details

.common_options(c, *opts) ⇒ Object



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

def self.common_options(c, *opts)
  opts.map(&:to_sym).each do |opt|
    case opt
    when :config
      c.desc 'specify config file'
      c.flag :c, :config
    when :targets
      c.desc 'Comma seperated list of targets'
      c.flag :t, :targets
    when :force
      c.desc 'Force, will not ask you to confirm differences'
      c.switch :force
    else
      raise "unrecognized option #{opt.inspect}"
    end
  end
end