Class: Zenflow::Help
- Inherits:
-
Object
- Object
- Zenflow::Help
- Defined in:
- lib/zenflow/helpers/help.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #banner ⇒ Object
-
#initialize(options = {}) ⇒ Help
constructor
A new instance of Help.
- #title(text) ⇒ Object
- #unknown_command ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Help
Returns a new instance of Help.
10 11 12 |
# File 'lib/zenflow/helpers/help.rb', line 10 def initialize(={}) = end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
8 9 10 |
# File 'lib/zenflow/helpers/help.rb', line 8 def end |
Instance Method Details
#banner ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/zenflow/helpers/help.rb', line 18 def help = [] help << "#{title("Summary")}\n#{options[:summary]}" if [:summary] help << "#{title("Usage")}\n#{options[:usage]}" if [:usage] help << "#{title("Available Commands")}\n#{options[:commands]}" if [:commands] help << "#{title("Options")}" help.join("\n\n") end |
#title(text) ⇒ Object
14 15 16 |
# File 'lib/zenflow/helpers/help.rb', line 14 def title(text) "- #{text} ".ljust(40, "-").cyan end |
#unknown_command ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/zenflow/helpers/help.rb', line 27 def unknown_command if [:command].nil? Zenflow::Log("Missing command", :color => :red) else Zenflow::Log("Unknown command #{options[:command].inspect}", :color => :red) end exit(1) end |