diff --git a/src/bin/cargo/commands/install.rs b/src/bin/cargo/commands/install.rs
index de93a1cbc..8cfd1f8ad 100644
--- a/src/bin/cargo/commands/install.rs
+++ b/src/bin/cargo/commands/install.rs
@@ -10,15 +10,36 @@ pub fn cli() -> App {
.arg(opt("quiet", "No output printed to stdout").short("q"))
.arg(Arg::with_name("crate").empty_values(false).multiple(true))
.arg(
- opt("version", "Specify a version to install from crates.io")
+ opt("version", "Specify a version to install")
.alias("vers")
- .value_name("VERSION"),
+ .value_name("VERSION")
+ .requires("crate"),
+ )
+ .arg(
+ opt("git", "Git URL to install the specified crate from")
+ .value_name("URL")
+ .conflicts_with_all(&["path", "registry"]),
+ )
+ .arg(
+ opt("branch", "Branch to use when installing from git")
+ .value_name("BRANCH")
+ .requires("git"),
+ )
+ .arg(
+ opt("tag", "Tag to use when installing from git")
+ .value_name("TAG")
+ .requires("git"),
+ )
+ .arg(
+ opt("rev", "Specific commit to use when installing from git")
+ .value_name("SHA")
+ .requires("git"),
+ )
+ .arg(
+ opt("path", "Filesystem path to local crate to install")
+ .value_name("PATH")
+ .conflicts_with_all(&["git", "registry"]),
)
- .arg(opt("git", "Git URL to install the specified crate from").value_name("URL"))
- .arg(opt("branch", "Branch to use when installing from git").value_name("BRANCH"))
- .arg(opt("tag", "Tag to use when installing from git").value_name("TAG"))
- .arg(opt("rev", "Specific commit to use when installing from git").value_name("SHA"))
- .arg(opt("path", "Filesystem path to local crate to install").value_name("PATH"))
.arg(opt(
"list",
"list all installed packages and their versions",
@@ -35,7 +56,12 @@ pub fn cli() -> App {
)
.arg_target_triple("Build for the target triple")
.arg(opt("root", "Directory to install packages into").value_name("DIR"))
- .arg(opt("registry", "Registry to use").value_name("REGISTRY"))
+ .arg(
+ opt("registry", "Registry to use")
+ .value_name("REGISTRY")
+ .requires("crate")
+ .conflicts_with_all(&["git", "path"]),
+ )
.after_help(
"\
This command manages Cargo's local set of installed binary crates. Only packages
@@ -46,10 +72,10 @@ configuration key, and finally the home directory (which is either
`$CARGO_HOME` if set or `$HOME/.cargo` by default).
There are multiple sources from which a crate can be installed. The default
-location is crates.io but the `--git` and `--path` flags can change this source.
-If the source contains more than one package (such as crates.io or a git
-repository with multiple crates) the `` argument is required to indicate
-which crate should be installed.
+location is crates.io but the `--git`, `--path`, and `registry` flags can
+change this source. If the source contains more than one package (such as
+crates.io or a git repository with multiple crates) the `` argument is
+required to indicate which crate should be installed.
Crates from crates.io can optionally specify the version they wish to install
via the `--version` flags, and similarly packages from git repositories can
@@ -62,10 +88,10 @@ By default cargo will refuse to overwrite existing binaries. The `--force` flag
enables overwriting existing binaries. Thus you can reinstall a crate with
`cargo install --force `.
-Omitting the specification entirely will
-install the crate in the current directory. That is, `install` is equivalent to
-the more explicit `install --path .`. This behaviour is deprecated, and no
-longer supported as of the Rust 2018 edition.
+Omitting the specification entirely will install the crate in the
+current directory. That is, `install` is equivalent to the more explicit
+`install --path .`. This behaviour is deprecated, and no longer supported as
+of the Rust 2018 edition.
If the source is crates.io or `--git` then by default the crate will be built
in a temporary target directory. To avoid this, the target directory can be
diff --git a/src/doc/man/cargo-install.adoc b/src/doc/man/cargo-install.adoc
index 94be115de..0f78217c8 100644
--- a/src/doc/man/cargo-install.adoc
+++ b/src/doc/man/cargo-install.adoc
@@ -24,10 +24,10 @@ the installation root's `bin` folder.
include::description-install-root.adoc[]
There are multiple sources from which a crate can be installed. The default
-location is crates.io but the `--git` and `--path` flags can change this
-source. If the source contains more than one package (such as crates.io or a
-git repository with multiple crates) the _CRATE_ argument is required to
-indicate which crate should be installed.
+location is crates.io but the `--git`, `--path`, and `registry` flags can
+change this source. If the source contains more than one package (such as
+crates.io or a git repository with multiple crates) the _CRATE_ argument is
+required to indicate which crate should be installed.
Crates from crates.io can optionally specify the version they wish to install
via the `--version` flags, and similarly packages from git repositories can
@@ -48,7 +48,7 @@ continuous integration systems.
*--vers* _VERSION_::
*--version* _VERSION_::
- Specify a version to install from crates.io.
+ Specify a version to install.
*--git* _URL_::
Git URL to install the specified crate from.
diff --git a/src/doc/man/generated/cargo-install.html b/src/doc/man/generated/cargo-install.html
index bd5d6fb24..03c239672 100644
--- a/src/doc/man/generated/cargo-install.html
+++ b/src/doc/man/generated/cargo-install.html
@@ -45,10 +45,10 @@ the installation root’s bin
folder.
There are multiple sources from which a crate can be installed. The default
-location is crates.io but the --git
and --path
flags can change this
-source. If the source contains more than one package (such as crates.io or a
-git repository with multiple crates) the CRATE argument is required to
-indicate which crate should be installed.
+location is crates.io but the
--git
,
--path
, and
registry
flags can
+change this source. If the source contains more than one package (such as
+crates.io or a git repository with multiple crates) the
CRATE argument is
+required to indicate which crate should be installed.
Crates from crates.io can optionally specify the version they wish to install
@@ -77,7 +77,7 @@ continuous integration systems.
--vers VERSION
--version VERSION
-Specify a version to install from crates.io.
+Specify a version to install.
--git URL
diff --git a/src/etc/man/cargo-install.1 b/src/etc/man/cargo-install.1
index e23c41eaa..694d28877 100644
--- a/src/etc/man/cargo-install.1
+++ b/src/etc/man/cargo-install.1
@@ -2,12 +2,12 @@
.\" Title: cargo-install
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
-.\" Date: 2019-01-23
+.\" Date: 2019-03-31
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "CARGO\-INSTALL" "1" "2019-01-23" "\ \&" "\ \&"
+.TH "CARGO\-INSTALL" "1" "2019-03-31" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
@@ -103,10 +103,10 @@ The installation root is determined, in order of precedence:
.RE
.sp
There are multiple sources from which a crate can be installed. The default
-location is crates.io but the \fB\-\-git\fP and \fB\-\-path\fP flags can change this
-source. If the source contains more than one package (such as crates.io or a
-git repository with multiple crates) the \fICRATE\fP argument is required to
-indicate which crate should be installed.
+location is crates.io but the \fB\-\-git\fP, \fB\-\-path\fP, and \fBregistry\fP flags can
+change this source. If the source contains more than one package (such as
+crates.io or a git repository with multiple crates) the \fICRATE\fP argument is
+required to indicate which crate should be installed.
.sp
Crates from crates.io can optionally specify the version they wish to install
via the \fB\-\-version\fP flags, and similarly packages from git repositories can
@@ -125,7 +125,7 @@ continuous integration systems.
.sp
\fB\-\-vers\fP \fIVERSION\fP, \fB\-\-version\fP \fIVERSION\fP
.RS 4
-Specify a version to install from crates.io.
+Specify a version to install.
.RE
.sp
\fB\-\-git\fP \fIURL\fP
diff --git a/tests/testsuite/alt_registry.rs b/tests/testsuite/alt_registry.rs
index 3e58a92e6..80c47135c 100644
--- a/tests/testsuite/alt_registry.rs
+++ b/tests/testsuite/alt_registry.rs
@@ -620,7 +620,7 @@ Caused by:
.run();
for cmd in &[
- "init", "install", "login", "owner", "publish", "search", "yank",
+ "init", "install foo", "login", "owner", "publish", "search", "yank",
] {
p.cargo(cmd)
.arg("--registry")