module Thor::Shell
Constants
- SHELL_DELEGATED_METHODS
Attributes
Public Class Methods
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/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
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
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