Module: Cli
- Defined in:
- lib/cli.rb
Overview
Cli is a helper module for dealing with command line flags
Class Method Summary collapse
-
.check_opts(options) ⇒ Object
Check options for any errors.
-
.make_option_parser(options) ⇒ Object
Make an option parser bound to the hash passed in.
Class Method Details
.check_opts(options) ⇒ Object
Check options for any errors
10 11 12 13 14 15 16 17 |
# File 'lib/cli.rb', line 10 def self.check_opts() %i[jobs env2conf].each do |key| if [key].nil? || [key].empty? raise ArgMissingError, key.to_s end end [:bosh_deployment_manifest] ||= nil end |
.make_option_parser(options) ⇒ Object
Make an option parser bound to the hash passed in.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/cli.rb', line 23 def self.make_option_parser() OptionParser.new do |opts| opts. = 'Usage: configgin [options]' # Job definition file opts.on('-j', '--jobs file', 'Job definitions') do |j| [:jobs] = j end # Environment to configuration templates file opts.on('-e', '--env2conf file', 'Environment to configuration templates YAML') do |e| [:env2conf] = e end # Bosh deployment manifest opts.on('-b', '--bosh-deployment-manifest file', 'BOSH deployment manifest') do |b| [:bosh_deployment_manifest] = b end opts.on('--version', 'Print the configgin version') do puts Configgin::VERSION exit 0 end end end |