Module: YamlNormalizer::Helpers::ParamParser
- Included in:
- Services::Check, Services::Normalize
- Defined in:
- lib/yaml_normalizer/helpers/param_parser.rb
Overview
Methods handling passing of additional params from CLI
Instance Method Summary collapse
-
#parse_params(*args) ⇒ Object
Parse the params provided to the service.
-
#print_help(opts) ⇒ Object
Print current version of the tool.
-
#print_version ⇒ Object
Print current version of the tool.
Instance Method Details
#parse_params(*args) ⇒ Object
Parse the params provided to the service
12 13 14 15 16 17 18 |
# File 'lib/yaml_normalizer/helpers/param_parser.rb', line 12 def parse_params(*args) OptionParser.new do |opts| opts. = "Usage: #{program_name} [options] file1, file2..." opts.on('-v', '--version', 'Prints the yaml_normalizer version') { print_version } opts.on('-h', '--help', 'Prints this help') { print_help(opts) } end.parse(args) end |
#print_help(opts) ⇒ Object
Print current version of the tool
29 30 31 32 |
# File 'lib/yaml_normalizer/helpers/param_parser.rb', line 29 def print_help(opts) print(opts) exit_success end |
#print_version ⇒ Object
Print current version of the tool
21 22 23 24 |
# File 'lib/yaml_normalizer/helpers/param_parser.rb', line 21 def print_version print("#{YamlNormalizer::VERSION}\n") exit_success end |