arg_crate: Vec<String>,
flag_vers: Option<String>,
+ flag_version: Option<String>,
flag_git: Option<String>,
flag_branch: Option<String>,
cargo install [options] --list
Specifying what crate to install:
- --vers VERS Specify a version to install from crates.io
+ --vers VERSION Specify a version to install from crates.io
+ --version VERSION
--git URL Git URL to install the specified crate from
--branch BRANCH Branch to use when installing from git
--tag TAG Tag to use when installing from git
};
let krates = options.arg_crate.iter().map(|s| &s[..]).collect::<Vec<_>>();
- let vers = options.flag_vers.as_ref().map(|s| &s[..]);
+ let vers = options.flag_version.as_ref().or(options.flag_vers.as_ref()).map(|s| &s[..]);
let root = options.flag_root.as_ref().map(|s| &s[..]);
if options.flag_list {
"));
}
+#[test]
+fn version_too() {
+ pkg("foo", "0.1.1");
+ pkg("foo", "0.1.2");
+
+ assert_that(cargo_process("install").arg("foo").arg("--version").arg("0.1.1"),
+ execs().with_status(0).with_stderr_contains("\
+ [DOWNLOADING] foo v0.1.1 (registry [..])
+"));
+}
+
+#[test]
+fn version_preferred() {
+ pkg("foo", "0.1.1");
+ pkg("foo", "0.1.2");
+
+ assert_that(cargo_process("install").arg("foo").arg("--version").arg("0.1.1").arg("--vers").arg("0.1.2"),
+ execs().with_status(0).with_stderr_contains("\
+ [DOWNLOADING] foo v0.1.1 (registry [..])
+"));
+}
+
#[test]
fn legacy_version_requirement() {
pkg("foo", "0.1.1");