Class: Giturl::Options
- Inherits:
-
Object
- Object
- Giturl::Options
- Defined in:
- lib/giturl/options.rb
Overview
The options giturl accepts on the command line, and the values a given command line puts in them.
Instance Method Summary collapse
-
#initialize ⇒ Options
constructor
A new instance of Options.
-
#parse!(argv) ⇒ Hash
Consumes the options from argv, leaving the target directories behind.
Constructor Details
#initialize ⇒ Options
Returns a new instance of Options.
10 11 12 |
# File 'lib/giturl/options.rb', line 10 def initialize @values = {} end |
Instance Method Details
#parse!(argv) ⇒ Hash
Consumes the options from argv, leaving the target directories behind.
--app names a browser, which only makes sense together with --open,
so it turns --open on by itself.
20 21 22 23 24 25 26 |
# File 'lib/giturl/options.rb', line 20 def parse!(argv) OptionParser.new do |opts| definitions(opts).parse!(argv, into: @values) @values[:open] = true if @values.key?(:app) end @values end |