44
55use pecos_build:: Result ;
66use pecos_build:: errors:: Error ;
7+ use pecos_build:: prompt:: { PromptMode , confirm} ;
78
89/// Known upgradeable targets
910const KNOWN_TARGETS : & [ & str ] = & [ "cuda" , "llvm" , "cuquantum" ] ;
1011
1112/// Run the upgrade command
12- pub fn run ( targets : & [ String ] , all : bool , no_configure : bool ) -> Result < ( ) > {
13+ pub fn run ( targets : & [ String ] , all : bool , no_configure : bool , yes : bool ) -> Result < ( ) > {
1314 let targets: Vec < & str > = if all {
1415 KNOWN_TARGETS . to_vec ( )
1516 } else {
@@ -34,6 +35,23 @@ pub fn run(targets: &[String], all: bool, no_configure: bool) -> Result<()> {
3435 ordered
3536 } ;
3637
38+ println ! ( "This will force-reinstall:" ) ;
39+ for target in & targets {
40+ println ! ( " {target}" ) ;
41+ }
42+ println ! ( ) ;
43+
44+ let mode = if yes {
45+ PromptMode :: AcceptAll
46+ } else {
47+ PromptMode :: Interactive
48+ } ;
49+
50+ if !confirm ( "Continue?" , false , mode) {
51+ println ! ( "Cancelled." ) ;
52+ return Ok ( ( ) ) ;
53+ }
54+
3755 let total = targets. len ( ) ;
3856 for ( i, target) in targets. iter ( ) . enumerate ( ) {
3957 println ! ( "[{}/{}] Upgrading {target}..." , i + 1 , total) ;
@@ -42,7 +60,7 @@ pub fn run(targets: &[String], all: bool, no_configure: bool) -> Result<()> {
4260 println ! ( ) ;
4361 }
4462
45- println ! ( "All done." ) ;
63+ println ! ( "All done. Run `just build` to rebuild PECOS. " ) ;
4664 Ok ( ( ) )
4765}
4866
0 commit comments