diff options
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r-- | lldb/source/Interpreter/CommandInterpreter.cpp | 40 |
1 files changed, 10 insertions, 30 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 6d1ad799..dcff53f 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -508,6 +508,11 @@ void CommandInterpreter::Initialize() { if (cmd_obj_sp) { AddAlias("history", cmd_obj_sp); } + + cmd_obj_sp = GetCommandSPExact("help"); + if (cmd_obj_sp) { + AddAlias("h", cmd_obj_sp); + } } void CommandInterpreter::Clear() { @@ -1227,36 +1232,11 @@ CommandObject * CommandInterpreter::GetCommandObject(llvm::StringRef cmd_str, StringList *matches, StringList *descriptions) const { - CommandObject *command_obj = - GetCommandSP(cmd_str, false, true, matches, descriptions).get(); - - // If we didn't find an exact match to the command string in the commands, - // look in the aliases. - - if (command_obj) - return command_obj; - - command_obj = GetCommandSP(cmd_str, true, true, matches, descriptions).get(); - - if (command_obj) - return command_obj; - - // If there wasn't an exact match then look for an inexact one in just the - // commands - command_obj = GetCommandSP(cmd_str, false, false, nullptr).get(); - - // Finally, if there wasn't an inexact match among the commands, look for an - // inexact match in both the commands and aliases. - - if (command_obj) { - if (matches) - matches->AppendString(command_obj->GetCommandName()); - if (descriptions) - descriptions->AppendString(command_obj->GetHelp()); - return command_obj; - } - - return GetCommandSP(cmd_str, true, false, matches, descriptions).get(); + // Try to find a match among commands and aliases. Allowing inexact matches, + // but perferring exact matches. + return GetCommandSP(cmd_str, /*include_aliases=*/true, /*exact=*/false, + matches, descriptions) + .get(); } CommandObject *CommandInterpreter::GetUserCommandObject( |