Clap: how to disable options after a certain positional argument

I'm thinking of something like trailing_var_arg:

#[derive(Parser)]
struct Bash {
    #[clap(short)]
    pub e: bool
    pub file: String,
    #[calp(allow_hyphen_values = true, trailing_var_args = true]
    pub more_args: Vec<String>
}

I want everything after file to be supplied to more_args, even if it looks liks an option .

The above code works in some cases. If user type "bash a.sh x -e", more_args becomes ["x", "-e"].

However, if "-e" is the first value, like "bash a.sh -e x", it will be provided to the option instead of positional args. Which makes sense because the positional argument doesn't even begin. User have to type "bash a.sh -- -e x" instead.

But I can't see anywhere in the document how to achieve what I want.

Is there a way to let clap know, after a certain positioal argument, every option should be disabled?

No, clap has no option to force users to put all named arguments before positional ones. Besides disambiguating trailing arguments with --, that is.

Thanks for linking to the issue. Turns out what their goal is slightly different from mine, but the author of clap clearly said what I want is impossible, anyway.

Do you think it's reasonable to open a feature request, or even a PR for this? I'm not familiar with the philosophy of clap so not sure if it's feasible.

EDIT To add: I'll just ask the author in the issue :sweat_smile: