Module: Amp::Help::HelpUI
Overview
The really public-facing part of the Help system - the Help’s UI. This lets the outside world get at entries based on their names.
Instance Method Summary collapse
-
#print_entry(name, options = {}) ⇒ Object
Asks the UI system to print the entry with the given name, with the process’s current options.
Instance Method Details
#print_entry(name, options = {}) ⇒ Object
Asks the UI system to print the entry with the given name, with the process’s current options.
This method is “smart” - it has to check to see what entries are available. If there’s more than one with the provided name, it helps the user pick the appropriate entry.
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
# File 'lib/amp/help/help.rb', line 256 def print_entry(name, = {}) result = HelpRegistry[name.to_s] case result.size when 0 raise abort("Could not find help entry \"#{name}\"") when 1 puts result.first.text() when 2 UI.choose do || result.each do |entry| .choice("#{name} - #{entry.desc}") { puts entry.text() } end end end end |