Replaced `name-version` arg format with `name:version` , akin to pkgids.
This is necessary because of crate names containing dashes, as pointed
out in
@@ -148,20 +148,20 @@ impl<'a> WorkInfo<'a> {
fn do_main(config: &Config, matches: &Matches) -> CargoResult<()> {
debug!("running cargo-semver");
fn parse_arg(opt: &str) -> CargoResult<NameAndVersion> {
- let mut split = opt.split('-');
+ let mut split = opt.split(':');
let name = if let Some(n) = split.next() {
n
} else {
- return Err("spec has to be of form `name-version`".into());
+ return Err("spec has to be of form `name:version`".into());
};
let version = if let Some(v) = split.next() {
v
} else {
- return Err("spec has to be of form `name-version`".into());
+ return Err("spec has to be of form `name:version`".into());
};
if split.next().is_some() {
- return Err("spec has to be of form `name-version`".into());
+ return Err("spec has to be of form `name:version`".into());
}
Ok(NameAndVersion { name: name, version: version })
@@ -270,10 +270,10 @@ fn main() {
opts.optflag("d", "debug", "print command to debug and exit");
opts.optopt("s", "stable-path", "use local path as stable/old crate", "PATH");
opts.optopt("c", "current-path", "use local path as current/new crate", "PATH");
- opts.optopt("S", "stable-pkg", "use a name-version string as stable/old crate",
- "SPEC");
- opts.optopt("C", "current-pkg", "use a name-version string as current/new crate",
- "SPEC");
+ opts.optopt("S", "stable-pkg", "use a `name:version` string as stable/old crate",
+ "NAME:VERSION");
+ opts.optopt("C", "current-pkg", "use a `name:version` string as current/new crate",
+ "NAME:VERSION");
let config = match Config::default() {
Ok(cfg) => cfg,
