Class: Helmsnap::ArgsParser
- Inherits:
-
Object
- Object
- Helmsnap::ArgsParser
- Defined in:
- lib/helmsnap/args_parser.rb
Defined Under Namespace
Classes: Args
Constant Summary collapse
- InvalidConfigPath =
Class.new(RuntimeError)
- DEFAULT_CONFIG_PATH =
Pathname.new(".helmsnap.yaml")
- CONFIG_PATH_HELP =
%{Path to config (default: "#{DEFAULT_CONFIG_PATH}")}.freeze
- BANNER =
"Usage: helmsnap CMD [options]"
Instance Method Summary collapse
- #get_options! ⇒ Object
-
#initialize(options) ⇒ ArgsParser
constructor
A new instance of ArgsParser.
- #print_help!(msg) ⇒ Object
Constructor Details
#initialize(options) ⇒ ArgsParser
Returns a new instance of ArgsParser.
12 13 14 15 16 |
# File 'lib/helmsnap/args_parser.rb', line 12 def initialize() self. = self.args = Args.new(DEFAULT_CONFIG_PATH) self.parser = build_parser end |
Instance Method Details
#get_options! ⇒ Object
18 19 20 21 22 23 |
# File 'lib/helmsnap/args_parser.rb', line 18 def parser.parse!() args rescue OptionParser::ParseError, InvalidConfigPath => error print_help!(error.) end |