[Lldb-commits] [PATCH] D117004: [lldb] Don't print "Command Options Usage:" for an alias with no options
David Spickett via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Jan 12 02:07:44 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG091e760cd398: [lldb] Don't print "Command Options Usage:" for an alias with no options (authored by DavidSpickett).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117004/new/
https://reviews.llvm.org/D117004
Files:
lldb/source/Interpreter/Options.cpp
lldb/test/API/commands/platform/basic/TestPlatformCommand.py
Index: lldb/test/API/commands/platform/basic/TestPlatformCommand.py
===================================================================
--- lldb/test/API/commands/platform/basic/TestPlatformCommand.py
+++ lldb/test/API/commands/platform/basic/TestPlatformCommand.py
@@ -20,10 +20,12 @@
self.runCmd("help platform")
@no_debug_info_test
- def test_help_platform(self):
+ def test_help_shell_alias(self):
self.expect("help shell", substrs=["Run a shell command on the host.",
- "shell <shell-command>"])
-
+ "shell <shell-command>",
+ "'shell' is an abbreviation"])
+ # "platform shell" has options. The "shell" alias for it does not.
+ self.expect("help shell", substrs=["Command Options:"], matching=False)
@no_debug_info_test
def test_list(self):
Index: lldb/source/Interpreter/Options.cpp
===================================================================
--- lldb/source/Interpreter/Options.cpp
+++ lldb/source/Interpreter/Options.cpp
@@ -403,7 +403,12 @@
} else
name = "";
- strm.PutCString("\nCommand Options Usage:\n");
+ const uint32_t num_options = NumCommandOptions();
+ if (num_options == 0)
+ return;
+
+ if (!only_print_args)
+ strm.PutCString("\nCommand Options Usage:\n");
strm.IndentMore(2);
@@ -413,10 +418,6 @@
// [options-for-level-1]
// etc.
- const uint32_t num_options = NumCommandOptions();
- if (num_options == 0)
- return;
-
uint32_t num_option_sets = GetRequiredOptions().size();
uint32_t i;
@@ -531,9 +532,9 @@
strm << " " << arguments_str.GetString();
}
- strm.Printf("\n\n");
-
if (!only_print_args) {
+ strm.Printf("\n\n");
+
// Now print out all the detailed information about the various options:
// long form, short form and help text:
// -short <argument> ( --long_name <argument> )
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117004.399263.patch
Type: text/x-patch
Size: 2081 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220112/2cea8a3a/attachment.bin>
More information about the lldb-commits
mailing list