Class: Homesteading::Help
- Inherits:
-
Object
- Object
- Homesteading::Help
- Defined in:
- lib/homesteading/commands/help.rb
Constant Summary collapse
- DEFAULT_HELP_DOC =
"README"
Class Method Summary collapse
Class Method Details
.default(options = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/homesteading/commands/help.rb', line 6 def default(=nil) if .nil? help_doc_path = DEFAULT_HELP_DOC elsif .first.match(/:/) first, last = .first.split(":") help_doc_path = first + "-" + last else help_doc_path = .first end print(help_doc_path) end |
.print(path) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/homesteading/commands/help.rb', line 19 def print(path) # TODO better way? help_dir = File.("../../../../help/", __FILE__) file = "#{help_dir}/#{path}.md" puts unless File.exist?(file) file = "#{help_dir}/#{DEFAULT_HELP_DOC}.md" puts "Unknown command. No help docs about that." puts end puts File.read(file) puts end |