Closed as not planned
Description
Found in watchexec/watchexec#717.
When there's a trailing_var_arg
(or in general, really), I would expect that argfile would not parse beyond the --
separator. That is, these should load an argfile:
command @argfile --option
command --option @argfile
command @argfile -- sub args
But this should not:
command --option -- @bazel-target-or-something
Here's a minimal repro:
#!/usr/bin/env cargo
//! ```cargo
//! [dependencies]
//! argfile = "0.1.6"
//! clap = { version = "4.4.11", features = ["derive"] }
//! ```
use clap::{Parser, ValueHint};
#[derive(Debug, Clone, Parser)]
pub struct Args {
#[arg(
trailing_var_arg = true,
num_args = 1..,
value_hint = ValueHint::CommandString,
value_name = "COMMAND",
)]
pub command: Vec<String>,
}
fn main() {
let args = argfile::expand_args(argfile::parse_fromfile, argfile::PREFIX)
.expect("while reading @argfile");
let args = Args::parse_from(args);
dbg!(args);
}
Calling with ./repro.rs -- @not-an-argfile
panics, while I would expect it to silently ignore and leave the @not-an-argfile
in the args.
Metadata
Metadata
Assignees
Labels
No labels