Class: Teapot::Command::Top

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

Instance Method Summary collapse

Instance Method Details

#controller(root = nil, **options) ⇒ Object



179
180
181
# File 'lib/teapot/command.rb', line 179

def controller(root = nil, **options)
	Teapot::Controller.new(root || self.root || Dir.getwd, @options)
end

#invoke(program_name: File.basename($0)) ⇒ Object



183
184
185
186
187
188
189
190
191
192
193
# File 'lib/teapot/command.rb', line 183

def invoke(program_name: File.basename($0))
	if @options[:version]
		puts "teapot v#{Teapot::VERSION}"
	elsif @options[:help] or @command.nil?
		print_usage(program_name)
	else
		track_time do
			@command.invoke(self)
		end
	end
end

#rootObject



175
176
177
# File 'lib/teapot/command.rb', line 175

def root
	@options[:root]
end