Class: Thor

Inherits:
Object
  • Object
show all
Defined in:
lib/hpcloud/thor_ext/thor.rb

Direct Known Subclasses

HP::Cloud::CLI

Class Method Summary collapse

Class Method Details

.task_help(shell, task_name) ⇒ Object

Prints help information for the given task.

Parameters

shell<Thor::Shell> task_name<String>



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/hpcloud/thor_ext/thor.rb', line 33

def task_help(shell, task_name)
  meth = normalize_task_name(task_name)
  task = all_tasks[meth]
  handle_no_task_error(meth) unless task

  shell.say "Usage:"
  shell.say "  #{banner(task)}"
  shell.say
  class_options_help(shell, nil => task.options.map { |_, o| o })
  if task.long_description
    shell.say "Description:"
    shell.say task.long_description
  # elsif nil and task.long_description
  #   shell.say "Description:"
  #   shell.print_wrapped(task.long_description, :ident => 2)
  else
    shell.say task.description
  end
end