diff --git a/lldb/source/Interpreter/Options.cpp b/lldb/source/Interpreter/Options.cpp --- a/lldb/source/Interpreter/Options.cpp +++ b/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 ( --long_name ) diff --git a/lldb/test/API/commands/platform/basic/TestPlatformCommand.py b/lldb/test/API/commands/platform/basic/TestPlatformCommand.py --- a/lldb/test/API/commands/platform/basic/TestPlatformCommand.py +++ b/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 ", + "'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):