Specifically, I would like my application to support an option like '+<NUM>', where NUM is a line number. The key being that this option starts with '+', not '-' or '--'.
I am able to strip out my custom option before passing the arguments to clap like this
// Manually parse arguments for '+' prefix
let mut stand_args: Vec<String> = Vec::new();
let vargs: Vec<String> = std::env::args().collect();
for arg in vargs.iter() {
if arg.starts_with('+') {
// Remove '+' and process the argument
let custom_arg = &arg[1..];
println!("Custom argument: {}", custom_arg);
} else {
stand_args.push(arg.clone());
}
}
let args: MyArgs = MyArgs::parse_from(stand_args);
but that doesn't add my custom option to the clap generated help message.