aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Interpreter/CommandObject.cpp
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2016-03-22 22:12:59 +0000
committerEnrico Granata <egranata@apple.com>2016-03-22 22:12:59 +0000
commitbfb75e9bbceae6e872107df5c4e8c367291fdd53 (patch)
tree3e98a117afabef58f5bbb1db598123cf55fa75f1 /lldb/source/Interpreter/CommandObject.cpp
parente87e1c6cdd893cf7481029acb030d90cbd4b3e87 (diff)
downloadllvm-bfb75e9bbceae6e872107df5c4e8c367291fdd53.zip
llvm-bfb75e9bbceae6e872107df5c4e8c367291fdd53.tar.gz
llvm-bfb75e9bbceae6e872107df5c4e8c367291fdd53.tar.bz2
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/CommandObject.cpp')
-rw-r--r--lldb/source/Interpreter/CommandObject.cpp57
1 files changed, 27 insertions, 30 deletions
diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp
index ead292a..d8c1084 100644
--- a/lldb/source/Interpreter/CommandObject.cpp
+++ b/lldb/source/Interpreter/CommandObject.cpp
@@ -118,25 +118,19 @@ CommandObject::SetCommandName (const char *name)
void
CommandObject::SetHelp (const char *cstr)
{
- m_cmd_help_short = cstr;
-}
-
-void
-CommandObject::SetHelp (std::string str)
-{
- m_cmd_help_short = str;
+ if (cstr)
+ m_cmd_help_short = cstr;
+ else
+ m_cmd_help_short.assign("");
}
void
CommandObject::SetHelpLong (const char *cstr)
{
- m_cmd_help_long = cstr;
-}
-
-void
-CommandObject::SetHelpLong (std::string str)
-{
- m_cmd_help_long = str;
+ if (cstr)
+ m_cmd_help_long = cstr;
+ else
+ m_cmd_help_long.assign("");
}
void
@@ -932,23 +926,26 @@ CommandObject::GenerateHelpText (Stream &output_strm)
if ((long_help != nullptr)
&& (strlen (long_help) > 0))
FormatLongHelpText (output_strm, long_help);
- if (WantsRawCommandString() && !WantsCompletion())
- {
- // Emit the message about using ' -- ' between the end of the command options and the raw input
- // conditionally, i.e., only if the command object does not want completion.
- interpreter.OutputFormattedHelpText (output_strm, "", "",
- "\nIMPORTANT NOTE: Because this command takes 'raw' input, if you use any command options"
- " you must use ' -- ' between the end of the command options and the beginning of the raw input.", 1);
- }
- else if (GetNumArgumentEntries() > 0
- && GetOptions()
- && GetOptions()->NumCommandOptions() > 0)
+ if (!IsDashDashCommand())
{
- // Also emit a warning about using "--" in case you are using a command that takes options and arguments.
- interpreter.OutputFormattedHelpText (output_strm, "", "",
- "\nThis command takes options and free-form arguments. If your arguments resemble"
- " option specifiers (i.e., they start with a - or --), you must use ' -- ' between"
- " the end of the command options and the beginning of the arguments.", 1);
+ if (WantsRawCommandString() && !WantsCompletion())
+ {
+ // Emit the message about using ' -- ' between the end of the command options and the raw input
+ // conditionally, i.e., only if the command object does not want completion.
+ interpreter.OutputFormattedHelpText (output_strm, "", "",
+ "\nIMPORTANT NOTE: Because this command takes 'raw' input, if you use any command options"
+ " you must use ' -- ' between the end of the command options and the beginning of the raw input.", 1);
+ }
+ else if (GetNumArgumentEntries() > 0
+ && GetOptions()
+ && GetOptions()->NumCommandOptions() > 0)
+ {
+ // Also emit a warning about using "--" in case you are using a command that takes options and arguments.
+ interpreter.OutputFormattedHelpText (output_strm, "", "",
+ "\nThis command takes options and free-form arguments. If your arguments resemble"
+ " option specifiers (i.e., they start with a - or --), you must use ' -- ' between"
+ " the end of the command options and the beginning of the arguments.", 1);
+ }
}
}
else if (IsMultiwordObject())