@@ -4,7 +4,6 @@ use clap::{CommandFactory, Parser};
44use clap_complete:: CompleteEnv ;
55use color_eyre:: Result ;
66use keyring:: set_global_service_name;
7- use self_update:: cargo_crate_version;
87use tokio:: { runtime:: Handle , sync:: mpsc} ;
98use tuirealm:: {
109 Application , EventListenerCfg , PollStrategy , Sub , SubClause , SubEventClause , Update ,
@@ -22,7 +21,7 @@ use crate::{
2221 cli:: {
2322 app:: {
2423 Cli , CliCommands , ConfigCommands , CscsCommands , CscsFileCommands , CscsJobCommands , CscsSystemCommands ,
25- get_config, print_completions, set_config, version,
24+ check_update , get_config, print_completions, set_config, update , version,
2625 } ,
2726 exec:: cli_exec_command,
2827 proxy:: cli_proxy_command,
@@ -64,6 +63,12 @@ async fn main() -> Result<()> {
6463 set_global_service_name ( env ! ( "CARGO_PKG_NAME" ) ) ;
6564 crate :: logging:: init ( ) ?;
6665 CompleteEnv :: with_factory ( Cli :: command) . complete ( ) ;
66+
67+ // check self-update
68+ if let Err ( e) = check_update ( ) . await {
69+ println ! ( "Couldn't check for updates: {}" , e) ;
70+ }
71+
6772 let args = Cli :: parse ( ) ;
6873 match args. command {
6974 Some ( command) => match command {
@@ -379,21 +384,3 @@ fn popup_exclusion_clause() -> SubClause<Id> {
379384 SubClause :: IsMounted ( Id :: SystemSelectPopup ) ,
380385 ] ) ) )
381386}
382-
383- fn update ( ) -> Result < ( ) > {
384- let status = self_update:: backends:: github:: Update :: configure ( )
385- . repo_owner ( "SwissDataScienceCenter" )
386- . repo_name ( "coman" )
387- . bin_name ( "coman" )
388- . bin_path_in_archive ( "coman" )
389- . show_download_progress ( true )
390- . current_version ( cargo_crate_version ! ( ) )
391- . build ( ) ?
392- . update ( ) ?;
393- if status. updated ( ) {
394- println ! ( "Successfully updated to version: `{}`" , status. version( ) ) ;
395- } else {
396- println ! ( "Already up to date at version: `{}`" , status. version( ) ) ;
397- }
398- Ok ( ( ) )
399- }
0 commit comments