uint32_t i;
- for (uint32_t opt_set = 0; opt_set < num_option_sets; ++opt_set)
+ if (!only_print_args)
{
- uint32_t opt_set_mask;
-
- opt_set_mask = 1 << opt_set;
- if (opt_set > 0)
- strm.Printf ("\n");
- strm.Indent (name);
+ for (uint32_t opt_set = 0; opt_set < num_option_sets; ++opt_set)
+ {
+ uint32_t opt_set_mask;
+
+ opt_set_mask = 1 << opt_set;
+ if (opt_set > 0)
+ strm.Printf ("\n");
+ strm.Indent (name);
- // Different option sets may require different args.
- StreamString args_str;
- if (cmd)
- cmd->GetFormattedCommandArguments(args_str, opt_set_mask);
+ // Different option sets may require different args.
+ StreamString args_str;
+ if (cmd)
+ cmd->GetFormattedCommandArguments(args_str, opt_set_mask);
- if (!only_print_args)
- {
// First go through and print all options that take no arguments as
// a single string. If a command has "-a" "-b" and "-c", this will show
// up as [-abc]
PrintOption (opt_defs[i], eDisplayBestOption, " ", nullptr, true, strm);
}
}
- }
-
- if (args_str.GetSize() > 0)
- {
- if (cmd->WantsRawCommandString() && !only_print_args)
- strm.Printf(" --");
- strm.Printf (" %s", args_str.GetData());
- if (only_print_args)
- break;
+ if (args_str.GetSize() > 0)
+ {
+ if (cmd->WantsRawCommandString() && !only_print_args)
+ strm.Printf(" --");
+
+ strm.Printf (" %s", args_str.GetData());
+ if (only_print_args)
+ break;
+ }
}
}
if (cmd &&
- cmd->WantsRawCommandString() &&
+ (only_print_args || cmd->WantsRawCommandString()) &&
arguments_str.GetSize() > 0)
{
- strm.PutChar('\n');
+ if (!only_print_args) strm.PutChar('\n');
strm.Indent(name);
strm.Printf(" %s", arguments_str.GetData());
}