module Thor::Shell
def _shared_configuration #:nodoc:
Allow shell to be shared between invocations.
def _shared_configuration #:nodoc: super.merge!(:shell => 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] shell.base ||= self if 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 with_padding
def with_padding shell.padding += 1 yield ensure shell.padding -= 1 end