@@ -4,8 +4,9 @@ use chrono::{DateTime, Local, TimeDelta};
44use clap:: { Args , Command , Parser , Subcommand , ValueHint , builder:: TypedValueParser } ;
55use clap_complete:: { ArgValueCompleter , CompletionCandidate , Generator , Shell , generate} ;
66use color_eyre:: { Report , Result } ;
7+ use eyre:: Context ;
78use itertools:: Itertools ;
8- use self_update:: cargo_crate_version;
9+ use self_update:: { cargo_crate_version, errors :: Error as UpdateError } ;
910use strum:: VariantNames ;
1011use tokio:: sync:: mpsc;
1112
@@ -565,21 +566,27 @@ pub fn print_completions<G: Generator>(generator: G, cmd: &mut Command) {
565566}
566567
567568pub fn update ( ) -> Result < ( ) > {
568- let status = self_update:: backends:: github:: Update :: configure ( )
569+ let result = self_update:: backends:: github:: Update :: configure ( )
569570 . repo_owner ( "SwissDataScienceCenter" )
570571 . repo_name ( "coman" )
571572 . bin_name ( "coman" )
572573 . bin_path_in_archive ( "coman" )
573574 . show_download_progress ( true )
574575 . current_version ( cargo_crate_version ! ( ) )
575576 . build ( ) ?
576- . update ( ) ?;
577- if status. updated ( ) {
578- println ! ( "Successfully updated to version: `{}`" , status. version( ) ) ;
579- } else {
580- println ! ( "Already up to date at version: `{}`" , status. version( ) ) ;
577+ . update ( ) ;
578+ match result {
579+ Ok ( status) => {
580+ if status. updated ( ) {
581+ println ! ( "Successfully updated to version: `{}`" , status. version( ) ) ;
582+ } else {
583+ println ! ( "Already up to date at version: `{}`" , status. version( ) ) ;
584+ }
585+ Ok ( ( ) )
586+ }
587+ Err ( UpdateError :: Update ( msg) ) if msg == "Update aborted" => Ok ( ( ) ) ,
588+ Err ( e) => Err ( e) . wrap_err ( "couldn't perform update" ) ,
581589 }
582- Ok ( ( ) )
583590}
584591
585592pub async fn check_update ( ) -> Result < ( ) > {
0 commit comments