Hide the logic for command resolution for commands, aliases & user commands behind a single
interface so everybody does it the same way. Add an "exact" lookup for internal uses.
Fix up a few little cases where we weren't reporting command lookup errors correctly.
Added "b" as an alias for "breakpoint" so it doesn't collide with "bt".
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@107718 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectHelp.cpp b/source/Commands/CommandObjectHelp.cpp
index 363bbc4..37802a8 100644
--- a/source/Commands/CommandObjectHelp.cpp
+++ b/source/Commands/CommandObjectHelp.cpp
@@ -54,12 +54,8 @@
else
{
// Get command object for the first command argument. Only search built-in command dictionary.
- cmd_obj = interpreter.GetCommandObject (command.GetArgumentAtIndex (0), false, false);
- if (cmd_obj == NULL)
- {
- // That failed, so now search in the aliases dictionary, too.
- cmd_obj = interpreter.GetCommandObject (command.GetArgumentAtIndex (0), true, false);
- }
+ StringList matches;
+ cmd_obj = interpreter.GetCommandObject (command.GetArgumentAtIndex (0), &matches);
if (cmd_obj != NULL)
{
@@ -123,6 +119,15 @@
}
}
}
+ else if (matches.GetSize() > 0)
+ {
+ Stream &output_strm = result.GetOutputStream();
+ output_strm.Printf("Help requested with ambiguous command name, possible completions:\n");
+ for (int i = 0; i < matches.GetSize(); i++)
+ {
+ output_strm.Printf("\t%s\n", matches.GetStringAtIndex(i));
+ }
+ }
else
{
result.AppendErrorWithFormat
@@ -156,7 +161,7 @@
}
else
{
- CommandObject *cmd_obj = interpreter.GetCommandObject (input.GetArgumentAtIndex(0), true, false);
+ CommandObject *cmd_obj = interpreter.GetCommandObject (input.GetArgumentAtIndex(0));
input.Shift();
cursor_index--;
return cmd_obj->HandleCompletion (interpreter, input, cursor_index, cursor_char_position, match_start_point,