diff --git a/src/D2L.Bmx/Program.cs b/src/D2L.Bmx/Program.cs index addffacf..e3541a45 100644 --- a/src/D2L.Bmx/Program.cs +++ b/src/D2L.Bmx/Program.cs @@ -198,6 +198,12 @@ ); } ); +var updateCommand = new Command( "update", "Updates BMX to the latest version" ); +updateCommand.SetHandler( ( InvocationContext context ) => { + var handler = new UpdateHandler(); + return handler.HandleAsync(); +} ); + // root command var rootCommand = new RootCommand( "BMX grants you API access to your AWS accounts!" ) { // put more frequently used commands first, as the order here affects help text @@ -205,6 +211,7 @@ writeCommand, loginCommand, configureCommand, + updateCommand, }; // start bmx @@ -227,6 +234,7 @@ } } + UpdateHandler.Cleanup(); await UpdateChecker.CheckForUpdatesAsync( configProvider.GetConfiguration() ); await next( context ); diff --git a/src/D2L.Bmx/UpdateHandler.cs b/src/D2L.Bmx/UpdateHandler.cs index a71e1c62..d6f717ba 100644 --- a/src/D2L.Bmx/UpdateHandler.cs +++ b/src/D2L.Bmx/UpdateHandler.cs @@ -42,6 +42,7 @@ public async Task HandleAsync() { await fs.FlushAsync(); fs.Dispose(); } + Console.WriteLine( "Downloaded!" ); string extension = Path.GetExtension( downloadUrl ).ToLowerInvariant(); string? extractPath = Path.GetDirectoryName( currentProcessPath ); @@ -111,5 +112,4 @@ private static void DecompressZipFile( string compressedFilePath, string decompr } } } - }