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> )
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> )
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits