Module: Fission::CommandHelpers
- Included in:
- Command
- Defined in:
- lib/fission/command_helpers.rb
Instance Method Summary collapse
-
#incorrect_arguments ⇒ Object
Internal: Outputs the help text for a command and exits.
-
#parse_arguments ⇒ Object
Internal: Parses the command line arguments.
Instance Method Details
#incorrect_arguments ⇒ Object
Internal: Outputs the help text for a command and exits.
Examples
incorrect_arguments
Returns nothing. This will call the help class method for the help text. This will exit with the exit code 1.
13 14 15 16 |
# File 'lib/fission/command_helpers.rb', line 13 def incorrect_arguments output "#{self.class.help}\n" output_and_exit "Incorrect arguments for #{command_name} command", 1 end |
#parse_arguments ⇒ Object
Internal: Parses the command line arguments.
Examples:
parse_arguments
Returns nothing. If there is an invalid argument, an error will be output and this will exit with exit code 1.
27 28 29 30 31 32 |
# File 'lib/fission/command_helpers.rb', line 27 def parse_arguments option_parser.parse! @args rescue OptionParser::InvalidOption => e output e output_and_exit "\n#{self.class.help}", 1 end |