summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectHelp.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2012-05-02 01:12:54 +0000
committerJim Ingham <jingham@apple.com>2012-05-02 01:12:54 +0000
commitc007e84621766e48bafc6e6c229fcfc8547ff370 (patch)
treedb0e3d06af6aedae689f1229717cc492c4d0dab2 /lldb/source/Commands/CommandObjectHelp.cpp
parent170641b0e0b7f64002e086ecfa51983dc4a5144d (diff)
downloadbcm5719-llvm-c007e84621766e48bafc6e6c229fcfc8547ff370.tar.gz
bcm5719-llvm-c007e84621766e48bafc6e6c229fcfc8547ff370.zip
If a command takes options and arguments, the help text should warn the user to use "--" to terminate the options.
llvm-svn: 155973
Diffstat (limited to 'lldb/source/Commands/CommandObjectHelp.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectHelp.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/lldb/source/Commands/CommandObjectHelp.cpp b/lldb/source/Commands/CommandObjectHelp.cpp
index 8428e4fd183..7f379d6b2c4 100644
--- a/lldb/source/Commands/CommandObjectHelp.cpp
+++ b/lldb/source/Commands/CommandObjectHelp.cpp
@@ -158,12 +158,24 @@ CommandObjectHelp::Execute (Args& command, CommandReturnObject &result)
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);
}
OpenPOWER on IntegriCloud