module Thor::Shell

Constants

SHELL_DELEGATED_METHODS

Public Class Methods

new(args=[], options={}, config={}) click to toggle source

Add shell to initialize config values.

Configuration

shell<Object>

An instance of the shell to be used.

Examples

class MyScript < Thor
  argument :first, :type => :numeric
end

MyScript.new [1.0], { :foo => :bar }, :shell => Thor::Shell::Basic.new
Calls superclass method
# File lib/vendor/thor/lib/thor/shell.rb, line 45
def initialize(args=[], options={}, config={})
  super
  self.shell = config[:shell]
  self.shell.base ||= self if self.shell.respond_to?(:base)
end

Public Instance Methods

shell() click to toggle source

Holds the shell for the given Thor instance. If no shell is given, it gets a default shell from Thor::Base.shell.

# File lib/vendor/thor/lib/thor/shell.rb, line 53
def shell
  @shell ||= Thor::Base.shell.new
end
shell=(shell) click to toggle source

Sets the shell for this thor class.

# File lib/vendor/thor/lib/thor/shell.rb, line 58
def shell=(shell)
  @shell = shell
end
with_padding() { || ... } click to toggle source

Yields the given block with padding.

# File lib/vendor/thor/lib/thor/shell.rb, line 72
def with_padding
  shell.padding += 1
  yield
ensure
  shell.padding -= 1
end