@@ -9,6 +9,7 @@ use clap::{App, AppSettings, Arg, ArgGroup, ArgMatches, Shell, SubCommand};
99use rustup:: dist:: dist:: { PartialTargetTriple , PartialToolchainDesc , Profile , TargetTriple } ;
1010use rustup:: dist:: manifest:: Component ;
1111use rustup:: utils:: utils:: { self , ExitCode } ;
12+ use rustup:: Notification ;
1213use rustup:: { command, Cfg , Toolchain } ;
1314use std:: error:: Error ;
1415use std:: fmt;
@@ -27,12 +28,23 @@ fn handle_epipe(res: Result<()>) -> Result<()> {
2728 }
2829}
2930
30- fn deprecated < F , A , B > ( instead : & str , cfg : A , matches : B , callee : F ) -> Result < ( ) >
31+ fn deprecated < F , B > ( instead : & str , cfg : & mut Cfg , matches : B , callee : F ) -> Result < ( ) >
3132where
32- F : FnOnce ( A , B ) -> Result < ( ) > ,
33+ F : FnOnce ( & mut Cfg , B ) -> Result < ( ) > ,
3334{
34- warn ! ( "Use of deprecated command line interface." ) ;
35- warn ! ( " Please use `rustup {}` instead" , instead) ;
35+ ( cfg. notify_handler ) ( Notification :: PlainVerboseMessage (
36+ "Use of (currently) unmaintained command line interface." ,
37+ ) ) ;
38+ ( cfg. notify_handler ) ( Notification :: PlainVerboseMessage (
39+ "The exact API of this command may change without warning" ,
40+ ) ) ;
41+ ( cfg. notify_handler ) ( Notification :: PlainVerboseMessage (
42+ "Eventually this command will be a true alias. Until then:" ,
43+ ) ) ;
44+ ( cfg. notify_handler ) ( Notification :: PlainVerboseMessage ( & format ! (
45+ " Please use `rustup {}` instead" ,
46+ instead
47+ ) ) ) ;
3648 callee ( cfg, matches)
3749}
3850
@@ -66,7 +78,7 @@ pub fn main() -> Result<()> {
6678 ( "install" , Some ( m) ) => deprecated ( "toolchain install" , cfg, m, update) ?,
6779 ( "update" , Some ( m) ) => update ( cfg, m) ?,
6880 ( "check" , Some ( _) ) => check_updates ( cfg) ?,
69- ( "uninstall" , Some ( m) ) => deprecated ( "toolchain uninstall" , & * cfg, m, toolchain_remove) ?,
81+ ( "uninstall" , Some ( m) ) => deprecated ( "toolchain uninstall" , cfg, m, toolchain_remove) ?,
7082 ( "default" , Some ( m) ) => default_ ( cfg, m) ?,
7183 ( "toolchain" , Some ( c) ) => match c. subcommand ( ) {
7284 ( "install" , Some ( m) ) => update ( cfg, m) ?,
@@ -1200,7 +1212,7 @@ fn toolchain_link(cfg: &Cfg, m: &ArgMatches<'_>) -> Result<()> {
12001212 . map_err ( Into :: into)
12011213}
12021214
1203- fn toolchain_remove ( cfg : & Cfg , m : & ArgMatches < ' _ > ) -> Result < ( ) > {
1215+ fn toolchain_remove ( cfg : & mut Cfg , m : & ArgMatches < ' _ > ) -> Result < ( ) > {
12041216 for toolchain in m. values_of ( "toolchain" ) . unwrap ( ) {
12051217 let toolchain = cfg. get_toolchain ( toolchain, false ) ?;
12061218 toolchain. remove ( ) ?;
0 commit comments