forked from OSchip/llvm-project
[cl] Don't print subcommand help when no subcommands present.
Previously we would print USAGE: <exe> [subcommand] [options] Even if no subcommands were present. This changes the output format to only print "[subcommand]" if there is at least one subcommand. Fixes llvm.org/pr30598 Patch by Serge Guelton llvm-svn: 283892
This commit is contained in:
parent
a91da4ba47
commit
79f3333d3f
|
@ -1756,10 +1756,12 @@ public:
|
|||
if (!GlobalParser->ProgramOverview.empty())
|
||||
outs() << "OVERVIEW: " << GlobalParser->ProgramOverview << "\n";
|
||||
|
||||
if (Sub == &*TopLevelSubCommand)
|
||||
outs() << "USAGE: " << GlobalParser->ProgramName
|
||||
<< " [subcommand] [options]";
|
||||
else {
|
||||
if (Sub == &*TopLevelSubCommand) {
|
||||
outs() << "USAGE: " << GlobalParser->ProgramName;
|
||||
if (Subs.size() > 2)
|
||||
outs() << " [subcommand]";
|
||||
outs() << " [options]";
|
||||
} else {
|
||||
if (!Sub->getDescription().empty()) {
|
||||
outs() << "SUBCOMMAND '" << Sub->getName()
|
||||
<< "': " << Sub->getDescription() << "\n\n";
|
||||
|
|
Loading…
Reference in New Issue