From bfb75e9bbceae6e872107df5c4e8c367291fdd53 Mon Sep 17 00:00:00 2001 From: Enrico Granata Date: Tue, 22 Mar 2016 22:12:59 +0000 Subject: Make it so that a command alias can actually remove the help/long help from its parent command by setting itself to an empty help string llvm-svn: 264108 --- lldb/source/Interpreter/CommandAlias.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'lldb/source/Interpreter/CommandAlias.cpp') diff --git a/lldb/source/Interpreter/CommandAlias.cpp b/lldb/source/Interpreter/CommandAlias.cpp index f9929b45ca3..f7d8e8e9f1b 100644 --- a/lldb/source/Interpreter/CommandAlias.cpp +++ b/lldb/source/Interpreter/CommandAlias.cpp @@ -87,7 +87,9 @@ CommandAlias::CommandAlias (CommandInterpreter &interpreter, m_underlying_command_sp(), m_option_string(options_args ? options_args : ""), m_option_args_sp(new OptionArgVector), -m_is_dashdash_alias(eLazyBoolCalculate) +m_is_dashdash_alias(eLazyBoolCalculate), +m_did_set_help(false), +m_did_set_help_long(false) { if (ProcessAliasOptionsArgs(cmd_sp, options_args, m_option_args_sp)) { @@ -259,10 +261,24 @@ CommandAlias::Desugar () // allow CommandAlias objects to provide their own help, but fallback to the info // for the underlying command if no customization has been provided +void +CommandAlias::SetHelp (const char * str) +{ + this->CommandObject::SetHelp(str); + m_did_set_help = true; +} + +void +CommandAlias::SetHelpLong (const char * str) +{ + this->CommandObject::SetHelpLong(str); + m_did_set_help_long = true; +} + const char* CommandAlias::GetHelp () { - if (!m_cmd_help_short.empty()) + if (!m_cmd_help_short.empty() || m_did_set_help) return m_cmd_help_short.c_str(); if (IsValid()) return m_underlying_command_sp->GetHelp(); @@ -272,7 +288,7 @@ CommandAlias::GetHelp () const char* CommandAlias::GetHelpLong () { - if (!m_cmd_help_long.empty()) + if (!m_cmd_help_long.empty() || m_did_set_help_long) return m_cmd_help_long.c_str(); if (IsValid()) return m_underlying_command_sp->GetHelpLong(); -- cgit v1.2.3