Class Thor
In: lib/bundler/vendor/thor/base.rb
lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb
lib/bundler/vendor/thor/core_ext/ordered_hash.rb
lib/bundler/vendor/thor/error.rb
lib/bundler/vendor/thor/invocation.rb
lib/bundler/vendor/thor/parser/argument.rb
lib/bundler/vendor/thor/parser/arguments.rb
lib/bundler/vendor/thor/parser/option.rb
lib/bundler/vendor/thor/parser/options.rb
lib/bundler/vendor/thor/shell/basic.rb
lib/bundler/vendor/thor/shell/color.rb
lib/bundler/vendor/thor/shell.rb
lib/bundler/vendor/thor/task.rb
lib/bundler/vendor/thor/util.rb
lib/bundler/vendor/thor/version.rb
lib/bundler/vendor/thor.rb
Parent: Object

TODO: Update thor to allow for git-style CLI (git bisect run)

Methods

Included Modules

Thor::Base

Classes and Modules

Module Thor::Base
Module Thor::Invocation
Module Thor::Shell
Module Thor::Util
Class Thor::Error
Class Thor::InvocationError
Class Thor::MalformattedArgumentError
Class Thor::RequiredArgumentMissingError
Class Thor::Task
Class Thor::UndefinedTaskError
Class Thor::UnknownArgumentError

Constants

HELP_MAPPINGS = %w(-h -? --help -D)   Shortcuts for help.
THOR_RESERVED_WORDS = %w(invoke shell options behavior root destination_root relative_root action add_file create_file in_root inside run run_ruby_script)   Thor methods that should not be overwritten by the user.
VERSION = "0.13.4".freeze

Public Class methods

Sets the default task when thor is executed without an explicit task to be called.

Parameters

meth<Symbol>:name of the defaut task

Defines the usage and the description of the next task.

Parameters

usage<String> description<String>

Prints help information for this class.

Parameters

shell<Thor::Shell>

Maps an input to a task. If you define:

  map "-T" => "list"

Running:

  thor -T

Will invoke the list task.

Parameters

Hash[String|Array => Symbol]:Maps the string or the strings in the array to the given task.

Adds an option to the set of method 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_option :foo => :bar, :for => :previous_task

  def next_task
    # magic
  end

Parameters

name<Symbol>:The name of the argument.
options<Hash>:Described below.

Options

: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. :banner - String to show on usage notes.

Declares the options for the next task to be declared.

Parameters

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.

Returns tasks ready to be printed.

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)

Prints help information for the given task.

Parameters

shell<Thor::Shell> task_name<String>

Protected Class methods

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.

Public Instance methods

[Validate]