global

def display_search(search)

Parameters:
  • String () -- The string to search for.
def display_search(search)
  if command = command_set.find_command_for_help(search)
    display_command(command)
  else
    groups = search_hash(search, command_groups)
    if groups.size > 0
      display_index(groups)
      return
    end
    filtered = search_hash(search, visible_commands)
    raise CommandError, "No help found for '#{args.first}'" if filtered.empty?
    if filtered.size == 1
      display_command(filtered.values.first)
    else
      display_index({"'#{search}' commands" => filtered.values})
    end
  end
end