@@ -10,15 +10,36 @@ pub fn cli() -> App {
10
10
. arg ( opt ( "quiet" , "No output printed to stdout" ) . short ( "q" ) )
11
11
. arg ( Arg :: with_name ( "crate" ) . empty_values ( false ) . multiple ( true ) )
12
12
. arg (
13
- opt ( "version" , "Specify a version to install from crates.io " )
13
+ opt ( "version" , "Specify a version to install" )
14
14
. alias ( "vers" )
15
- . value_name ( "VERSION" ) ,
15
+ . value_name ( "VERSION" )
16
+ . requires ( "crate" ) ,
17
+ )
18
+ . arg (
19
+ opt ( "git" , "Git URL to install the specified crate from" )
20
+ . value_name ( "URL" )
21
+ . conflicts_with_all ( & [ "path" , "registry" ] ) ,
22
+ )
23
+ . arg (
24
+ opt ( "branch" , "Branch to use when installing from git" )
25
+ . value_name ( "BRANCH" )
26
+ . requires ( "git" ) ,
27
+ )
28
+ . arg (
29
+ opt ( "tag" , "Tag to use when installing from git" )
30
+ . value_name ( "TAG" )
31
+ . requires ( "git" ) ,
32
+ )
33
+ . arg (
34
+ opt ( "rev" , "Specific commit to use when installing from git" )
35
+ . value_name ( "SHA" )
36
+ . requires ( "git" ) ,
37
+ )
38
+ . arg (
39
+ opt ( "path" , "Filesystem path to local crate to install" )
40
+ . value_name ( "PATH" )
41
+ . conflicts_with_all ( & [ "git" , "registry" ] ) ,
16
42
)
17
- . arg ( opt ( "git" , "Git URL to install the specified crate from" ) . value_name ( "URL" ) )
18
- . arg ( opt ( "branch" , "Branch to use when installing from git" ) . value_name ( "BRANCH" ) )
19
- . arg ( opt ( "tag" , "Tag to use when installing from git" ) . value_name ( "TAG" ) )
20
- . arg ( opt ( "rev" , "Specific commit to use when installing from git" ) . value_name ( "SHA" ) )
21
- . arg ( opt ( "path" , "Filesystem path to local crate to install" ) . value_name ( "PATH" ) )
22
43
. arg ( opt (
23
44
"list" ,
24
45
"list all installed packages and their versions" ,
@@ -35,7 +56,12 @@ pub fn cli() -> App {
35
56
)
36
57
. arg_target_triple ( "Build for the target triple" )
37
58
. arg ( opt ( "root" , "Directory to install packages into" ) . value_name ( "DIR" ) )
38
- . arg ( opt ( "registry" , "Registry to use" ) . value_name ( "REGISTRY" ) )
59
+ . arg (
60
+ opt ( "registry" , "Registry to use" )
61
+ . value_name ( "REGISTRY" )
62
+ . requires ( "crate" )
63
+ . conflicts_with_all ( & [ "git" , "path" ] ) ,
64
+ )
39
65
. after_help (
40
66
"\
41
67
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
46
72
`$CARGO_HOME` if set or `$HOME/.cargo` by default).
47
73
48
74
There are multiple sources from which a crate can be installed. The default
49
- location is crates.io but the `--git` and `--path` flags can change this source.
50
- If the source contains more than one package (such as crates.io or a git
51
- repository with multiple crates) the `<crate>` argument is required to indicate
52
- which crate should be installed.
75
+ location is crates.io but the `--git`, `--path`, and `registry` flags can
76
+ change this source. If the source contains more than one package (such as
77
+ crates.io or a git repository with multiple crates) the `<crate>` argument is
78
+ required to indicate which crate should be installed.
53
79
54
80
Crates from crates.io can optionally specify the version they wish to install
55
81
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
62
88
enables overwriting existing binaries. Thus you can reinstall a crate with
63
89
`cargo install --force <crate>`.
64
90
65
- Omitting the <crate> specification entirely will
66
- install the crate in the current directory. That is, `install` is equivalent to
67
- the more explicit `install --path .`. This behaviour is deprecated, and no
68
- longer supported as of the Rust 2018 edition.
91
+ Omitting the <crate> specification entirely will install the crate in the
92
+ current directory. That is, `install` is equivalent to the more explicit
93
+ `install --path .`. This behaviour is deprecated, and no longer supported as
94
+ of the Rust 2018 edition.
69
95
70
96
If the source is crates.io or `--git` then by default the crate will be built
71
97
in a temporary target directory. To avoid this, the target directory can be
0 commit comments