Class: CreateGithubRelease::CommandLine::Parser
- Inherits:
-
Object
- Object
- CreateGithubRelease::CommandLine::Parser
- Defined in:
- lib/create_github_release/command_line/parser.rb
Overview
Parses the options for this script
Instance Method Summary collapse
-
#initialize ⇒ Parser
constructor
Create a new command line parser.
-
#parse(*args) ⇒ CreateGithubRelease::CommandLine::Options
Parse the command line arguements returning the options.
Constructor Details
#initialize ⇒ Parser
Create a new command line parser
39 40 41 42 43 |
# File 'lib/create_github_release/command_line/parser.rb', line 39 def initialize @option_parser = OptionParser.new @options = CreateGithubRelease::CommandLine::Options.new end |
Instance Method Details
#parse(*args) ⇒ CreateGithubRelease::CommandLine::Options
Parse the command line arguements returning the options
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/create_github_release/command_line/parser.rb', line 55 def parse(*args) begin option_parser.parse!(remaining_args = args.dup) rescue OptionParser::InvalidOption, OptionParser::MissingArgument => e report_errors(e.) end parse_remaining_args(remaining_args) # puts options unless options.quiet report_errors(*.errors) unless .valid? end |