Class: Anvil::Parser
- Inherits:
-
OptionParser
- Object
- OptionParser
- Anvil::Parser
- Defined in:
- lib/anvil/parser.rb
Overview
Parser for anvil command line arguments and options
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#task ⇒ Object
Returns the value of attribute task.
Instance Method Summary collapse
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
8 9 10 |
# File 'lib/anvil/parser.rb', line 8 def @options end |
#task ⇒ Object
Returns the value of attribute task.
9 10 11 |
# File 'lib/anvil/parser.rb', line 9 def task @task end |
Instance Method Details
#arguments(args = nil) ⇒ Object
15 16 17 18 |
# File 'lib/anvil/parser.rb', line 15 def arguments(args = nil) return @arguments if @arguments @arguments = [args.presence].compact.flatten end |
#banner ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/anvil/parser.rb', line 20 def unless @banner @banner = visit(:add_banner, @banner) end @banner end |
#banner_string ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/anvil/parser.rb', line 29 def args = arguments.map(&:upcase).join(' ') = "Usage: anvil #{task.task_name}" += " #{args}" unless args.empty? += ' [options]' end |