[Lldb-commits] [lldb] r155973 - /lldb/trunk/source/Commands/CommandObjectHelp.cpp
Jim Ingham
jingham at apple.com
Tue May 1 18:12:54 PDT 2012
Author: jingham
Date: Tue May 1 20:12:54 2012
New Revision: 155973
URL: http://llvm.org/viewvc/llvm-project?rev=155973&view=rev
Log:
If a command takes options and arguments, the help text should warn the user to use "--" to terminate the options.
Modified:
lldb/trunk/source/Commands/CommandObjectHelp.cpp
Modified: lldb/trunk/source/Commands/CommandObjectHelp.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectHelp.cpp?rev=155973&r1=155972&r2=155973&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectHelp.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectHelp.cpp Tue May 1 20:12:54 2012
@@ -158,12 +158,24 @@
if ((long_help != NULL)
&& (strlen (long_help) > 0))
output_strm.Printf ("\n%s", long_help);
- // 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.
if (sub_cmd_obj->WantsRawCommandString() && !sub_cmd_obj->WantsCompletion())
{
- m_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);
+ // 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.
+ m_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 (sub_cmd_obj->GetNumArgumentEntries() > 0
+ && sub_cmd_obj->GetOptions()
+ && sub_cmd_obj->GetOptions()->NumCommandOptions() > 0)
+ {
+ // Also emit a warning about using "--" in case you are using a command that takes options and arguments.
+ m_interpreter.OutputFormattedHelpText (output_strm, "", "",
+ "\nThis command takes options and arguments, if your arguments look like option specifiers"
+ " you must use '--' to terminate the options before starting to give the arguments.", 1);
+ }
+
// Mark this help command with a success status.
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
More information about the lldb-commits
mailing list