diff options
author | Enrico Granata <egranata@apple.com> | 2016-03-22 22:12:59 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2016-03-22 22:12:59 +0000 |
commit | bfb75e9bbceae6e872107df5c4e8c367291fdd53 (patch) | |
tree | 3e98a117afabef58f5bbb1db598123cf55fa75f1 /lldb/source/Interpreter/CommandAlias.cpp | |
parent | e87e1c6cdd893cf7481029acb030d90cbd4b3e87 (diff) | |
download | bcm5719-llvm-bfb75e9bbceae6e872107df5c4e8c367291fdd53.tar.gz bcm5719-llvm-bfb75e9bbceae6e872107df5c4e8c367291fdd53.zip |
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
Diffstat (limited to 'lldb/source/Interpreter/CommandAlias.cpp')
-rw-r--r-- | lldb/source/Interpreter/CommandAlias.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
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(); |