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
it gets a default shell from Thor::Base.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)
Sets the shell for this thor class.
def shell=(shell) @shell = shell end