11use std:: { io:: Write , process:: exit} ;
22use colored:: Colorize ;
3+ use anyhow:: Result ;
34
45use crate :: core:: Config ;
56use crate :: download;
67use crate :: utils:: get_executable_extension;
78
8- pub fn handle_update ( ) -> Result < ( ) , Box < dyn std :: error :: Error > > {
9+ pub async fn handle_sync ( ) -> Result < ( ) > {
910 let config = Config :: load ( ) ?;
1011
1112 if !config. software . supports_minecraft_version ( ) {
1213 println ! (
13- "🔄 Updating {} to latest build..." ,
14+ "🔄 Syncing {} to latest build..." ,
1415 config. software. name( ) . bold( ) . yellow( )
1516 ) ;
1617 } else {
1718 println ! (
18- "🔄 Updating {}-{} to latest build..." ,
19+ "🔄 Syncing {}-{} to latest build..." ,
1920 config. software. name( ) . bold( ) . yellow( ) ,
2021 config. minecraft_version. bold( ) . blue( )
2122 ) ;
@@ -27,7 +28,7 @@ pub fn handle_update() -> Result<(), Box<dyn std::error::Error>> {
2728 ) ;
2829 std:: io:: stdout ( ) . flush ( ) ?;
2930
30- match download:: get ( config. software . name ( ) , config. minecraft_version . clone ( ) ) {
31+ match download:: get ( & config. software . name ( ) , config. minecraft_version . clone ( ) ) . await {
3132 Err ( e) => {
3233 println ! ( ) ;
3334 println ! ( "{}: {}" , "error" . bold( ) . red( ) , e) ;
@@ -43,14 +44,14 @@ pub fn handle_update() -> Result<(), Box<dyn std::error::Error>> {
4344 println ! (
4445 " {} server.jar {}" ,
4546 "↻" . green( ) . bold( ) ,
46- "(updated to latest build)" . dimmed( )
47+ "(synced to latest build)" . dimmed( )
4748 ) ;
4849 } else {
4950 println ! (
5051 " {} gate{} {}" ,
5152 "↻" . green( ) . bold( ) ,
5253 need_exe,
53- "(updated to latest build)" . dimmed( )
54+ "(synced to latest build)" . dimmed( )
5455 ) ;
5556 }
5657
0 commit comments