Class: Scide::Opts
- Inherits:
-
Upoj::Opts
- Object
- Upoj::Opts
- Scide::Opts
- Defined in:
- lib/scide/opts.rb
Overview
Pre-configured scide option parser.
Instance Method Summary collapse
-
#initialize ⇒ Opts
constructor
Returns the scide option parser.
-
#parse!(args) ⇒ Object
Parses the given arguments.
Constructor Details
#initialize ⇒ Opts
Returns the scide option parser. Run scide with --usage
to see available options.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/scide/opts.rb', line 8 def initialize super({ :banner => { :usage => '[OPTION]... PROJECT', :description => 'generates GNU Screen configuration files.' } }) on '-c', '--config FILE', 'load configuration from FILE' on '--dry-run', 'show what would be run but do not execute' on('--version', 'show version and exit'){ puts "#{program_name} #{Scide::VERSION}"; exit 0 } help!.usage! end |
Instance Method Details
#parse!(args) ⇒ Object
Parses the given arguments.
Causes scide to fail with an invalid_argument
error (see Scide.fail) if an argument is invalid.
27 28 29 30 31 32 33 |
# File 'lib/scide/opts.rb', line 27 def parse! args begin super args rescue StandardError => err Scide.fail :invalid_argument, err end end |