@@ -18,7 +18,7 @@ pub fn cli() -> App {
18
18
. arg (
19
19
opt ( "git" , "Git URL to install the specified crate from" )
20
20
. value_name ( "URL" )
21
- . conflicts_with_all ( & [ "path" , "registry" ] ) ,
21
+ . conflicts_with_all ( & [ "path" , "index" , " registry"] ) ,
22
22
)
23
23
. arg (
24
24
opt ( "branch" , "Branch to use when installing from git" )
@@ -38,7 +38,7 @@ pub fn cli() -> App {
38
38
. arg (
39
39
opt ( "path" , "Filesystem path to local crate to install" )
40
40
. value_name ( "PATH" )
41
- . conflicts_with_all ( & [ "git" , "registry" ] ) ,
41
+ . conflicts_with_all ( & [ "git" , "index" , " registry"] ) ,
42
42
)
43
43
. arg ( opt (
44
44
"list" ,
@@ -58,11 +58,17 @@ pub fn cli() -> App {
58
58
)
59
59
. arg_target_triple ( "Build for the target triple" )
60
60
. arg ( opt ( "root" , "Directory to install packages into" ) . value_name ( "DIR" ) )
61
+ . arg (
62
+ opt ( "index" , "Registry index to install from" )
63
+ . value_name ( "INDEX" )
64
+ . requires ( "crate" )
65
+ . conflicts_with_all ( & [ "git" , "path" , "registry" ] ) ,
66
+ )
61
67
. arg (
62
68
opt ( "registry" , "Registry to use" )
63
69
. value_name ( "REGISTRY" )
64
70
. requires ( "crate" )
65
- . conflicts_with_all ( & [ "git" , "path" ] ) ,
71
+ . conflicts_with_all ( & [ "git" , "path" , "index" ] ) ,
66
72
)
67
73
. after_help (
68
74
"\
@@ -100,8 +106,6 @@ continuous integration systems.",
100
106
}
101
107
102
108
pub fn exec ( config : & mut Config , args : & ArgMatches < ' _ > ) -> CliResult {
103
- let registry = args. registry ( config) ?;
104
-
105
109
if let Some ( path) = args. value_of_path ( "path" , config) {
106
110
config. reload_rooted_at ( path) ?;
107
111
} else {
@@ -143,8 +147,10 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
143
147
} else if krates. is_empty ( ) {
144
148
from_cwd = true ;
145
149
SourceId :: for_path ( config. cwd ( ) ) ?
146
- } else if let Some ( registry) = registry {
150
+ } else if let Some ( registry) = args . registry ( config ) ? {
147
151
SourceId :: alt_registry ( config, & registry) ?
152
+ } else if let Some ( index) = args. value_of ( "index" ) {
153
+ SourceId :: for_registry ( & index. into_url ( ) ?) ?
148
154
} else {
149
155
SourceId :: crates_io ( config) ?
150
156
} ;
0 commit comments