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.
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
# File 'lib/amp-front/help/help.rb', line 280 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 |