From e79417951ba4107c662451bef89dd8fe5c65679b Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Thu, 28 Oct 2010 23:17:48 +0000 Subject: [PATCH] Add alias information, including aliased command options & arguments, to help text for alias commands. llvm-svn: 117617 --- lldb/source/Commands/CommandObjectCommands.cpp | 2 ++ lldb/source/Commands/CommandObjectHelp.cpp | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index 3718658cb0e8..8bbe914f01de 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -339,6 +339,7 @@ public: if (!result.Succeeded() && result.GetStatus() != lldb::eReturnStatusStarted) { result.AppendError ("Unable to create requested command alias.\n"); + return false; } } @@ -378,6 +379,7 @@ public: { result.AppendErrorWithFormat ("'%s' is not an existing command.\n", actual_command.c_str()); result.SetStatus (eReturnStatusFailed); + return false; } } diff --git a/lldb/source/Commands/CommandObjectHelp.cpp b/lldb/source/Commands/CommandObjectHelp.cpp index c7aa2b4f1a7f..07d80ebd5de9 100644 --- a/lldb/source/Commands/CommandObjectHelp.cpp +++ b/lldb/source/Commands/CommandObjectHelp.cpp @@ -69,6 +69,8 @@ CommandObjectHelp::Execute (Args& command, CommandReturnObject &result) // Get command object for the first command argument. Only search built-in command dictionary. StringList matches; cmd_obj = m_interpreter.GetCommandObject (command.GetArgumentAtIndex (0), &matches); + bool is_alias_command = m_interpreter.AliasExists (command.GetArgumentAtIndex (0)); + std::string alias_name = command.GetArgumentAtIndex(0); if (cmd_obj != NULL) { @@ -155,6 +157,13 @@ CommandObjectHelp::Execute (Args& command, CommandReturnObject &result) result.SetStatus (eReturnStatusSuccessFinishNoResult); } } + + if (is_alias_command) + { + StreamString sstr; + m_interpreter.GetAliasHelp (alias_name.c_str(), cmd_obj->GetCommandName(), sstr); + result.GetOutputStream().Printf ("\n'%s' is an abbreviation for %s\n", alias_name.c_str(), sstr.GetData()); + } } else if (matches.GetSize() > 0) {