From 826cfbc41b06f4225cdea0fb7188675d2446fa73 Mon Sep 17 00:00:00 2001 From: "git@71rd.net" Date: Mon, 26 May 2025 16:30:15 +0000 Subject: [PATCH] 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 --- lix/nix/main.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lix/nix/main.cc b/lix/nix/main.cc index dbe57e80e..a47fb8eec 100644 --- a/lix/nix/main.cc +++ b/lix/nix/main.cc @@ -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 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;