Sets the default task when thor is executed without an explicit task to be called.
meth<Symbol>: | name of the defaut task |
Defines the usage and the description of the next task.
usage<String> description<String>
Prints help information. If a task name is given, it shows information only about the specific task.
meth<String>: | An optional task name to print usage information about. |
namespace: | When true, shows the namespace in the output before the usage. |
skip_inherited: | When true, does not show tasks from superclass. |
Maps an input to a task. If you define:
map "-T" => "list"
Running:
thor -T
Will invoke the list task.
Hash[String|Array => Symbol]: | Maps the string or the strings in the array to the given task. |
Adds an option to the set of class options. If :for is given as option, it allows you to change the options from a previous defined task.
def previous_task # magic end method_options :foo => :bar, :for => :previous_task def next_task # magic end
name<Symbol>: | The name of the argument. |
options<Hash>: | Described below. |
:desc - Description for the argument. :required - If the argument is required or not. :default - Default value for this argument. It cannot be required and have default values. :aliases - Aliases for this option. :type - The type of the argument, can be :string, :hash, :array, :numeric or :boolean. :group - The group for this options. Use by class options to output options in different levels. :banner - String to show on usage notes.
Declares the options for the next task to be declared.
Hash[Symbol => Object]: | The hash key is the name of the option and the value |
is the type of the option. Can be :string, :array, :hash, :boolean, :numeric or :required (string). If you give a value, the type of the value is used.
Parses the task and options from the given args, instantiate the class and invoke the task. This method is used when the arguments must be parsed from an array. If you are inside Ruby and want to use a Thor class, you can simply initialize it:
script = MyScript.new(args, options, config) script.invoke(:task, first_arg, second_arg, third_arg)
The banner for this class. You can customize it if you are invoking the thor class by another ways which is not the Thor::Runner. It receives the task that is going to be invoked and a boolean which indicates if the namespace should be displayed as arguments.