It should be working, but a command like tipically pm new mysynt
panics if I also allow pm new --bin mysynt
(and also --lib
instead of --bin
).
use clap::{App, ArgMatches, Arg, ArgGroup};
pub fn cli<'a, 'b>() -> App<'a, 'b> {
App::new("new")
.about("Creates package in a new directory.")
.arg(Arg::with_name("bin").conflicts_with("bin").required(true))
.arg(Arg::with_name("lib").conflicts_with("lib").required(true))
.arg(Arg::from_usage("[NAME]").required(true))
}
pub fn exec<'a, 'b>(matches: &'a ArgMatches<'b>) {
println!("Brand new [?]");
}
It panics with Found argument '--bin' which wasn't expected, or isn't valid in this context
if I execute cargo run -- new --bin halo
. With some of the miscellanous tweaks it then complains about positionals requirement missing. I believe astro new halo --bin
and astro new --bin halo
are both valid or am I misunderstanding positionals?