20 Stream *s, llvm::StringRef command, llvm::StringRef prefix,
21 llvm::StringRef subcommand,
bool include_upropos,
22 bool include_type_lookup) {
23 if (!s || command.empty())
26 std::string command_str = command.str();
27 std::string prefix_str = prefix.str();
28 std::string subcommand_str = subcommand.str();
29 const std::string &lookup_str =
30 !subcommand_str.empty() ? subcommand_str : command_str;
31 s->
Printf(
"'%s' is not a known command.\n", command_str.c_str());
32 s->
Printf(
"Try '%shelp' to see a current list of commands.\n",
33 prefix.str().c_str());
34 if (include_upropos) {
35 s->
Printf(
"Try '%sapropos %s' for a list of related commands.\n",
36 prefix_str.c_str(), lookup_str.c_str());
38 if (include_type_lookup) {
39 s->
Printf(
"Try '%stype lookup %s' for information on types, methods, "
40 "functions, modules, etc.",
41 prefix_str.c_str(), lookup_str.c_str());
47 "Show a list of all debugger "
48 "commands, or give details "
49 "about a specific command.",
50 "help [<cmd-name>]") {
58#define LLDB_OPTIONS_help
59#include "CommandOptions.inc"
61llvm::ArrayRef<OptionDefinition>
63 return llvm::ArrayRef(g_help_options);
67 CommandObject::CommandMap::iterator pos;
91 auto command_name = command[0].ref();
94 if (cmd_obj !=
nullptr) {
100 std::string sub_command;
101 for (
auto &entry : command.
entries().drop_front()) {
102 sub_command = std::string(entry.ref());
106 ((
CommandAlias *)sub_cmd_obj)->GetUnderlyingCommand().get();
114 if (found_cmd ==
nullptr || matches.
GetSize() > 1) {
118 sub_cmd_obj = found_cmd;
122 if (!all_okay || (sub_cmd_obj ==
nullptr)) {
123 std::string cmd_string;
127 s.
Printf(
"ambiguous command %s", cmd_string.c_str());
128 size_t num_matches = matches.
GetSize();
129 for (
size_t match_idx = 0; match_idx < num_matches; match_idx++) {
135 }
else if (!sub_cmd_obj) {
138 &error_msg_stream, cmd_string.c_str(),
147 "\nThe closest match is '%s'. Help on it follows.\n\n",
153 std::string alias_full_name;
161 command[0].c_str(), sstr.
GetData());
163 }
else if (matches.
GetSize() > 0) {
165 output_strm.
Printf(
"Help requested with ambiguous command name, possible "
167 const size_t match_count = matches.
GetSize();
168 for (
size_t i = 0; i < match_count; i++) {
A command line argument class.
size_t GetArgumentCount() const
Gets the number of arguments left in this command object.
llvm::ArrayRef< ArgEntry > entries() const
bool GetCommandString(std::string &command) const
void GetAliasExpansion(StreamString &help_string) const
CommandObject * GetCommandObject(llvm::StringRef cmd, StringList *matches=nullptr, StringList *descriptions=nullptr) const
bool GetAliasFullName(llvm::StringRef cmd, std::string &full_name) const
void HandleCompletionMatches(CompletionRequest &request)
void GetHelp(CommandReturnObject &result, uint32_t types=eCommandTypesAllThem)
const char * GetCommandPrefix()
const CommandAlias * GetAlias(llvm::StringRef alias_name) const
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
static void GenerateAdditionalHelpAvenuesMessage(Stream *s, llvm::StringRef command, llvm::StringRef prefix, llvm::StringRef subcommand, bool include_upropos=true, bool include_type_lookup=true)
void HandleCompletion(CompletionRequest &request) override
This default version handles calling option argument completions and then calls HandleArgumentComplet...
CommandObjectHelp(CommandInterpreter &interpreter)
~CommandObjectHelp() override
void DoExecute(Args &command, CommandReturnObject &result) override
void GenerateHelpText(CommandReturnObject &result)
void AddSimpleArgumentList(lldb::CommandArgumentType arg_type, ArgumentRepetitionType repetition_type=eArgRepeatPlain)
llvm::StringRef GetCommandName() const
static lldb::CommandArgumentType LookupArgumentName(llvm::StringRef arg_name)
virtual bool IsMultiwordObject()
CommandInterpreter & m_interpreter
virtual CommandObject * GetSubcommandObject(llvm::StringRef sub_cmd, StringList *matches=nullptr)
static void GetArgumentHelp(Stream &str, lldb::CommandArgumentType arg_type, CommandInterpreter &interpreter)
virtual void HandleCompletion(CompletionRequest &request)
This default version handles calling option argument completions and then calls HandleArgumentComplet...
void void AppendError(llvm::StringRef in_string)
void SetStatus(lldb::ReturnStatus status)
Stream & GetOutputStream()
"lldb/Utility/ArgCompletionRequest.h"
const Args & GetParsedLine() const
void ShiftArguments()
Drops the first argument from the argument list.
size_t GetCursorIndex() const
const char * GetData() const
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
const char * GetStringAtIndex(size_t idx) const
A class that represents a running process on the host machine.
@ eReturnStatusSuccessFinishNoResult