@@ -7,7 +7,7 @@ use rustup_dist::manifest::Component;
7
7
use rustup_dist:: dist:: { PartialTargetTriple , PartialToolchainDesc , TargetTriple } ;
8
8
use rustup_utils:: utils:: { self , ExitCode } ;
9
9
use self_update;
10
- use std:: path:: Path ;
10
+ use std:: path:: { Path , PathBuf } ;
11
11
use std:: process:: { self , Command } ;
12
12
use std:: iter;
13
13
use std:: error:: Error ;
@@ -316,6 +316,12 @@ pub fn cli() -> App<'static, 'static> {
316
316
Arg :: with_name ( "toolchain" )
317
317
. help ( TOOLCHAIN_ARG_HELP )
318
318
. required ( true ) ,
319
+ )
320
+ . arg (
321
+ Arg :: with_name ( "path" )
322
+ . long ( "path" )
323
+ . takes_value ( true )
324
+ . help ( "Path to the directory" ) ,
319
325
) ,
320
326
)
321
327
. subcommand (
@@ -899,7 +905,12 @@ fn override_add(cfg: &Cfg, m: &ArgMatches) -> Result<()> {
899
905
None
900
906
} ;
901
907
902
- toolchain. make_override ( & utils:: current_dir ( ) ?) ?;
908
+ let path = if let Some ( path) = m. value_of ( "path" ) {
909
+ PathBuf :: from ( path)
910
+ } else {
911
+ utils:: current_dir ( ) ?
912
+ } ;
913
+ toolchain. make_override ( & path) ?;
903
914
904
915
if let Some ( status) = status {
905
916
println ! ( "" ) ;
@@ -928,8 +939,8 @@ fn override_remove(cfg: &Cfg, m: &ArgMatches) -> Result<()> {
928
939
}
929
940
list
930
941
} else {
931
- if m . is_present ( "path" ) {
932
- vec ! [ m . value_of ( " path" ) . unwrap ( ) . to_string( ) ]
942
+ if let Some ( path ) = m . value_of ( "path" ) {
943
+ vec ! [ path. to_string( ) ]
933
944
} else {
934
945
vec ! [ utils:: current_dir( ) ?. to_str( ) . unwrap( ) . to_string( ) ]
935
946
}
0 commit comments