Skip to content

Commit

Permalink
Fix -f flag when downloading OS and always write version.txt when not…
Browse files Browse the repository at this point in the history
… specifying a version
  • Loading branch information
adrianstevens committed Feb 12, 2024
1 parent d7170ff commit 8285502
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
using CliFx.Attributes;
using Meadow.Cloud.Client;
using Meadow.Cloud.Client.Identity;
using Meadow.Software;
using Microsoft.Extensions.Logging;
using System.Diagnostics;
using System.Net.Http.Headers;

namespace Meadow.CLI.Commands.DeviceManagement;

Expand All @@ -15,7 +12,7 @@ public class FirmwareDownloadCommand : BaseFileCommand<FirmwareDownloadCommand>

public FirmwareDownloadCommand(
FileManager fileManager,
IMeadowCloudClient meadowCloudClient,
IMeadowCloudClient meadowCloudClient,
ISettingsManager settingsManager,
ILoggerFactory loggerFactory)
: base(fileManager, settingsManager, loggerFactory)
Expand Down Expand Up @@ -61,6 +58,7 @@ protected override async ValueTask ExecuteCommand()
}

Logger?.LogInformation($"Latest available version is '{latest}'...");
await collection.SetDefaultPackage(latest);
Version = latest;
}
else
Expand All @@ -77,7 +75,7 @@ protected override async ValueTask ExecuteCommand()
return;
}

if (collection[Version] != null)
if (collection[Version] != null && Force == false)
{
Logger?.LogInformation($"Firmware package '{Version}' already exists locally");
return;
Expand All @@ -98,11 +96,6 @@ protected override async ValueTask ExecuteCommand()
else
{
Logger?.LogInformation($"Firmware package '{Version}' downloaded");

if (explicitVersion == false)
{
await collection.SetDefaultPackage(Version);
}
}
}
catch (Exception ex)
Expand Down
1 change: 0 additions & 1 deletion Source/v2/Meadow.Cli/Commands/Legacy/DownloadOsCommand.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using CliFx.Attributes;
using Meadow.Cloud.Client;
using Meadow.Cloud.Client.Identity;
using Meadow.Software;
using Microsoft.Extensions.Logging;

Expand Down

0 comments on commit 8285502

Please sign in to comment.