Can I make a subcommand that accept everything? #2370
-
I have the following, but it gives me the error pub fn copy_subcommand() -> App<'static> {
// this is not meant to be used directly only for help message
App::new("copy")
.alias("--cp")
.arg(Arg::new("from").multiple(true).required(true))
.arg(Arg::new("to").multiple(true).last(true).required(true))
.about("Copy mode accepts two parts of arguments <from> and <to>, the two parts are separated by [--]. <from> is the exact as Consumer mode, and <to> is the exact as Producer mode.")
}
pub fn get_arg_matcher() -> App<'static> {
App::new("kafcat")
.subcommands(vec![copy_subcommand()])
.setting(AppSettings::SubcommandRequiredElseHelp)
.arg(
Arg::new("log")
.long("log")
.about("Configure the logging format: Off, Error, Warn, Info, Debug, Trace")
.takes_value(true),
)
}
vec!["kafcat", "copy", "-b", "localhost", "-t", "topic1", "-e", "--", "-b", "localhost", "-t", "topic2"] |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
You don't want |
Beta Was this translation helpful? Give feedback.
-
Have you tried: |
Beta Was this translation helpful? Give feedback.
Have you tried:
ArgSettings::AllowHyphenValues
?