Class: Teapot::Command::Top

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

Instance Method Summary collapse

Instance Method Details

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



161
162
163
# File 'lib/teapot/command.rb', line 161

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

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



165
166
167
168
169
170
171
172
173
# File 'lib/teapot/command.rb', line 165

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

#rootObject



157
158
159
# File 'lib/teapot/command.rb', line 157

def root
	@options[:root] || Dir.getwd
end