Class: GitCompound::Command::Options
- Inherits:
-
Object
- Object
- GitCompound::Command::Options
- Defined in:
- lib/git_compound/command/options.rb
Overview
Class that parses command arguments
Constant Summary collapse
- GLOBAL_OPTIONS =
[:verbose, :disable_colors]
Class Method Summary collapse
Instance Method Summary collapse
- #command ⇒ Object
- #command_options ⇒ Object
- #global_options ⇒ Object
-
#initialize(args) ⇒ Options
constructor
A new instance of Options.
- #parse ⇒ Object
Constructor Details
#initialize(args) ⇒ Options
Returns a new instance of Options.
8 9 10 11 12 13 |
# File 'lib/git_compound/command/options.rb', line 8 def initialize(args) @command, @args = (args) self.class.disable_colors = false end |
Class Method Details
.disable_colors=(mode) ⇒ Object
35 36 37 |
# File 'lib/git_compound/command/options.rb', line 35 def self.disable_colors=(mode) GitCompound::Logger.colors = !mode end |
.verbose=(mode) ⇒ Object
31 32 33 |
# File 'lib/git_compound/command/options.rb', line 31 def self.verbose=(mode) GitCompound::Logger.verbose = mode end |
Instance Method Details
#command ⇒ Object
23 24 25 |
# File 'lib/git_compound/command/options.rb', line 23 def command @command || 'help' end |
#command_options ⇒ Object
19 20 21 |
# File 'lib/git_compound/command/options.rb', line 19 def @args - GLOBAL_OPTIONS end |
#global_options ⇒ Object
15 16 17 |
# File 'lib/git_compound/command/options.rb', line 15 def @args & GLOBAL_OPTIONS end |
#parse ⇒ Object
27 28 29 |
# File 'lib/git_compound/command/options.rb', line 27 def parse [command, ] end |