From 17d55ac3a5d4a6a6318d3d14dd59a4b476a13bbe Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Mon, 24 Nov 2025 21:43:28 -0800 Subject: [PATCH] Fix clap --targets parsing issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I was seeing the following issue when trying to deploy a subset of targets defined in my flake: ``` ❯ deploy --targets ".#flake-one" ".#flake-two" error: the argument '--targets ' cannot be used with '[TARGET]' Usage: deploy --targets [TARGET] [EXTRA_BUILD_ARGS]... ``` The problem turned out to be a result of the way the clap macro was defining the `targets` command line argument - it was interpreting the last argument to --targets as being the position argument, and then treating them as two incompatible uses of commands from the same argument grup. Adding `num_args...` fixes this behavior. --- src/cli.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.rs b/src/cli.rs index 43990f5c..bcfd2d53 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -28,7 +28,7 @@ pub struct Opts { target: Option, /// A list of flakes to deploy alternatively - #[arg(long, group = "deploy")] + #[arg(long, group = "deploy", num_args = 1..)] targets: Option>, /// Treat targets as files instead of flakes #[clap(short, long)]