Module: Thor::Shell

### Home Classes Methods

### In Files

- lib/thor/shell.rb
- lib/thor/shell/basic.rb
- lib/thor/shell/color.rb
- lib/thor/shell/html.rb

### Namespace

- CLASS Thor::Shell::Basic
- CLASS Thor::Shell::Color
- CLASS Thor::Shell::HTML

### Methods

- ::new
- #shell
- #with_padding

### Class/Module Index

Quicksearch

- Thor
- Thor::Actions
- Thor::Actions::ClassMethods
- Thor::AmbiguousCommandError
- Thor::Base
- Thor::Base::ClassMethods
- Thor::Command
- Thor::DynamicCommand
- Thor::Error
- Thor::Group
- Thor::HiddenCommand
- Thor::Invocation
- Thor::Invocation::ClassMethods
- Thor::InvocationError
- Thor::LineEditor
- Thor::LineEditor::Basic
- Thor::LineEditor::Readline
- Thor::LineEditor::Readline::PathCompletion
- Thor::MalformattedArgumentError
- Thor::RakeCompat
- Thor::RequiredArgumentMissingError
- Thor::Shell
- Thor::Shell::Basic
- Thor::Shell::Color
- Thor::Shell::HTML
- Thor::UndefinedCommandError
- Thor::UnknownArgumentError
- Thor::Util
- Object

No matching classes.

# Thor::Shell

### Constants

SHELL_DELEGATED_METHODS

### Attributes

shell[W]

### 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

    # File lib/thor/shell.rb, line 44
    def initialize(args = [], options = {}, config = {})
      super
      self.shell = config[:shell]
      shell.base ||= self if 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/thor/shell.rb, line 52
    def shell
      @shell ||= Thor::Base.shell.new
    end

with_padding() click to toggle source

Yields the given block with padding.

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

[Validate]

Generated with the Darkfish Rdoc Generator 2.