diff options
author | Jim Ingham <jingham@apple.com> | 2010-07-06 22:46:59 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2010-07-06 22:46:59 +0000 |
commit | 279a6c26698c4a09784cce11e69ea9da86681406 (patch) | |
tree | ed3f56f9135d46bb4c3e9a26fed42789b02baf38 /lldb/source/Commands/CommandObjectHelp.cpp | |
parent | 13f0260e76dd8f55ba6d507afa589d0b863e9900 (diff) | |
download | llvm-279a6c26698c4a09784cce11e69ea9da86681406.zip llvm-279a6c26698c4a09784cce11e69ea9da86681406.tar.gz llvm-279a6c26698c4a09784cce11e69ea9da86681406.tar.bz2 |
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".
llvm-svn: 107718
Diffstat (limited to 'lldb/source/Commands/CommandObjectHelp.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectHelp.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lldb/source/Commands/CommandObjectHelp.cpp b/lldb/source/Commands/CommandObjectHelp.cpp index 363bbc4..37802a8 100644 --- a/lldb/source/Commands/CommandObjectHelp.cpp +++ b/lldb/source/Commands/CommandObjectHelp.cpp @@ -54,12 +54,8 @@ CommandObjectHelp::Execute (CommandInterpreter &interpreter, Args& command, Comm 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 @@ CommandObjectHelp::Execute (CommandInterpreter &interpreter, Args& command, Comm } } } + 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 @@ CommandObjectHelp::HandleCompletion } 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, |