@@ -7,7 +7,7 @@ use rustup_dist::manifest::Component;
77use rustup_dist:: dist:: { PartialTargetTriple , PartialToolchainDesc , TargetTriple } ;
88use rustup_utils:: utils:: { self , ExitCode } ;
99use self_update;
10- use std:: path:: Path ;
10+ use std:: path:: { Path , PathBuf } ;
1111use std:: process:: { self , Command } ;
1212use std:: iter;
1313use std:: error:: Error ;
@@ -316,6 +316,12 @@ pub fn cli() -> App<'static, 'static> {
316316 Arg :: with_name ( "toolchain" )
317317 . help ( TOOLCHAIN_ARG_HELP )
318318 . required ( true ) ,
319+ )
320+ . arg (
321+ Arg :: with_name ( "path" )
322+ . long ( "path" )
323+ . takes_value ( true )
324+ . help ( "Path to the directory" ) ,
319325 ) ,
320326 )
321327 . subcommand (
@@ -899,7 +905,12 @@ fn override_add(cfg: &Cfg, m: &ArgMatches) -> Result<()> {
899905 None
900906 } ;
901907
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) ?;
903914
904915 if let Some ( status) = status {
905916 println ! ( "" ) ;
@@ -928,8 +939,8 @@ fn override_remove(cfg: &Cfg, m: &ArgMatches) -> Result<()> {
928939 }
929940 list
930941 } 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( ) ]
933944 } else {
934945 vec ! [ utils:: current_dir( ) ?. to_str( ) . unwrap( ) . to_string( ) ]
935946 }
0 commit comments