Add shell to initialize config values.
An instance of the shell to be used.
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 45 def initialize(args=[], options={}, config={}) super self.shell = config[:shell] self.shell.base ||= self if self.shell.respond_to?(:base) end
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 53 def shell @shell ||= Thor::Base.shell.new end
Sets the shell for this thor class.
# File lib/thor/shell.rb, line 58 def shell=(shell) @shell = shell end
Yields the given block with padding.
# File lib/thor/shell.rb, line 72 def with_padding shell.padding += 1 yield ensure shell.padding -= 1 end