main: fix complete outputting doc page
When calling completion on a nix command containing the word "--help" nix would first return the entire help page for the command and then the result of the completion resulting in unusable output. By moving the check whether to return when completions were requested before the check whether help was requested wrappedMain returns without wrongly printing documentation. Change-Id: Iedb37434a3ff101f15985319a9a3bcb3f8195796
This commit is contained in:
+2
-2
@@ -584,6 +584,8 @@ void mainWrapped(AsyncIoRoot & aio, int argc, char * * argv)
|
||||
if (!args.helpRequested && !args.completions) throw;
|
||||
}
|
||||
|
||||
if (args.completions) return;
|
||||
|
||||
if (args.helpRequested) {
|
||||
std::vector<std::string> subcommand;
|
||||
MultiCommand * command = &args;
|
||||
@@ -598,8 +600,6 @@ void mainWrapped(AsyncIoRoot & aio, int argc, char * * argv)
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.completions) return;
|
||||
|
||||
if (args.showVersion) {
|
||||
printVersion(programName);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user