module Thor::Shell
def _shared_configuration #:nodoc:
Allow shell to be shared between invocations.
def _shared_configuration #:nodoc: super.merge!(:shell => self.shell) end
def initialize(args=[], options={}, config={})
MyScript.new [1.0], { :foo => :bar }, :shell => Thor::Shell::Basic.new
end
argument :first, :type => :numeric
class MyScript < Thor
==== Examples
shell
def initialize(args=[], options={}, config={}) super self.shell = config[:shell] self.shell.base ||= self if self.shell.respond_to?(:base) end
def shell
Holds the shell for the given Thor instance. If no shell is given,
def shell @shell ||= Thor::Base.shell.new end
def shell=(shell)
def shell=(shell) @shell = shell end
def with_padding
def with_padding shell.padding += 1 yield ensure shell.padding -= 1 end