Class: Teapot::Command::Top

Inherits:
Samovar::Command
  • Object
show all
Defined in:
lib/teapot/command.rb

Instance Method Summary collapse

Instance Method Details

#configurationObject



92
93
94
# File 'lib/teapot/command.rb', line 92

def configuration
	@options[:configuration]
end

#context(root = self.root) ⇒ Object



96
97
98
# File 'lib/teapot/command.rb', line 96

def context(root = self.root)
	Context.new(root, configuration: configuration)
end

#invokeObject



100
101
102
103
104
105
106
107
108
# File 'lib/teapot/command.rb', line 100

def invoke
	if @options[:version]
		puts "teapot v#{Teapot::VERSION}"
	elsif @options[:help]
		print_usage(output: $stdout)
	else
		@command.invoke
	end
end

#loggerObject



80
81
82
83
84
85
86
87
88
89
90
# File 'lib/teapot/command.rb', line 80

def logger
	@logger ||= Console::Logger.new(Console.logger, verbose: self.verbose?).tap do |logger|
		if verbose?
			logger.debug!
		elsif quiet?
			logger.warn!
		else
			logger.info!
		end
	end
end

#quiet?Boolean

Returns:

  • (Boolean)


76
77
78
# File 'lib/teapot/command.rb', line 76

def quiet?
	@options[:logging] == :quiet
end

#rootObject



68
69
70
# File 'lib/teapot/command.rb', line 68

def root
	::Build::Files::Path.expand(@options[:root] || Dir.getwd)
end

#verbose?Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/teapot/command.rb', line 72

def verbose?
	@options[:logging] == :verbose
end