Class: Homesteading::Help
- Defined in:
- lib/homesteading/commands/help.rb
Constant Summary collapse
- DEFAULT_HELP_DOC =
"README"
Constants inherited from Command
Instance Method Summary collapse
Methods inherited from Command
Instance Method Details
#default ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/homesteading/commands/help.rb', line 9 def default help_doc_path = if ARGV.empty? DEFAULT_HELP_DOC elsif ARGV.first.match(/:/) ARGV.first.sub(":", "-") else ARGV.first end print(help_doc_path) end |
#print(path) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/homesteading/commands/help.rb', line 21 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 |