I want to create an utility that accepts positional arguments like some Linux utilities that accept a variable number of SRC arguments followed by a single DEST argument, with a syntax that is analog to 'cp'.
I couldn't find a way to do that. The closest I got are these:
I was looking at these options already, but I can't see a way to handle it with these either. I get the impression it really is impossible with clap. And there don't seem to be any other crates which do much better. Really frustrating. I'm coming from Python and there with argparse it isn't a problem at all.
It seems trailing_var_arg can only be used on the last argument, and last makes the -- separator mandatory before the last argument and also prevents it to be used to separate the flag arguments from the second-to-last positionals.
clap::Command::help_template?
You can use the {options} tag in the template to use the auto-generated help text for your options while still changing the usage text.
It needs to be combined with override_usage(), though, as otherwise the usage output on error will still be wrong. Unfortunately one loses the context-aware usage, but that is not that important for me in this case.