Module: Envo::Cli::Runner::Opts

Extended by:
Opts
Included in:
Opts
Defined in:
lib/envo/cli/runner.rb

Constant Summary collapse

Defaults =
{
  interact: :interact,
  log_level: Logger::INFO
}

Instance Method Summary collapse

Instance Method Details

#parse_cli(opt) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/envo/cli/runner.rb', line 17

def parse_cli(opt)
  case opt
  when '--force', '-f' then return {interact: :force}
  when '--no-force', '-nf' then return {interact: :noforce}
  when '--interactive' then return {interact: :interact}
  when '--raw', '-r' then return {raw: true}
  else raise Envo::Error.new "unknown command line option: #{opt}"
  end
end


26
27
28
# File 'lib/envo/cli/runner.rb', line 26

def print_arg(log, arg, text)
  log.puts "    #{arg.ljust(15)} - #{text}"
end


29
30
31
32
33
34
# File 'lib/envo/cli/runner.rb', line 29

def print_help(log)
  print_arg log, '--force, -f', 'force the execution of the command disregarding checks'
  print_arg log, '--interactive', '(default) ask a question when a check fails'
  print_arg log, '--no-force, -nf', 'produce an error instead of asking questions for checks'
  print_arg log, '--raw, -r', 'don\'t infer types and treat each value as a raw string'
end