summaryrefslogtreecommitdiff
path: root/source/Commands/CommandObjectHelp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Commands/CommandObjectHelp.cpp')
-rw-r--r--source/Commands/CommandObjectHelp.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/source/Commands/CommandObjectHelp.cpp b/source/Commands/CommandObjectHelp.cpp
index 903c6011b03f..1f1d63d72903 100644
--- a/source/Commands/CommandObjectHelp.cpp
+++ b/source/Commands/CommandObjectHelp.cpp
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "CommandObjectHelp.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandObjectMultiword.h"
@@ -71,11 +67,11 @@ CommandObjectHelp::CommandObjectHelp(CommandInterpreter &interpreter)
CommandObjectHelp::~CommandObjectHelp() = default;
-static OptionDefinition g_help_options[] = {
+static constexpr OptionDefinition g_help_options[] = {
// clang-format off
- {LLDB_OPT_SET_ALL, false, "hide-aliases", 'a', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Hide aliases in the command list."},
- {LLDB_OPT_SET_ALL, false, "hide-user-commands", 'u', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Hide user-defined commands from the list."},
- {LLDB_OPT_SET_ALL, false, "show-hidden-commands", 'h', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Include commands prefixed with an underscore."},
+ {LLDB_OPT_SET_ALL, false, "hide-aliases", 'a', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Hide aliases in the command list."},
+ {LLDB_OPT_SET_ALL, false, "hide-user-commands", 'u', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Hide user-defined commands from the list."},
+ {LLDB_OPT_SET_ALL, false, "show-hidden-commands", 'h', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Include commands prefixed with an underscore."},
// clang-format on
};
@@ -171,10 +167,13 @@ bool CommandObjectHelp::DoExecute(Args &command, CommandReturnObject &result) {
}
sub_cmd_obj->GenerateHelpText(result);
-
- if (m_interpreter.AliasExists(command_name)) {
+ std::string alias_full_name;
+ // Don't use AliasExists here, that only checks exact name matches. If
+ // the user typed a shorter unique alias name, we should still tell them
+ // it was an alias.
+ if (m_interpreter.GetAliasFullName(command_name, alias_full_name)) {
StreamString sstr;
- m_interpreter.GetAlias(command_name)->GetAliasExpansion(sstr);
+ m_interpreter.GetAlias(alias_full_name)->GetAliasExpansion(sstr);
result.GetOutputStream().Printf("\n'%s' is an abbreviation for %s\n",
command[0].c_str(), sstr.GetData());
}