Skip to content

Commit

Permalink
Improve output with progress messages (nanoframework#223)
Browse files Browse the repository at this point in the history
***NO_CI***
  • Loading branch information
josesimoes authored Jun 14, 2023
1 parent 43af666 commit 4a148bc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion nanoFirmwareFlasher.Library/EspTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public EspTool(
}
catch (Exception ex)
{
if (Verbosity >= VerbosityLevel.Detailed)
if (Verbosity >= VerbosityLevel.Normal)
{
Console.ForegroundColor = ConsoleColor.DarkRed;

Expand Down
24 changes: 12 additions & 12 deletions nanoFirmwareFlasher.Library/FirmwarePackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public static List<CloudSmithPackageDetail> GetTargetList(
// check for empty array
if (responseBody == "[]")
{
if (verbosity >= VerbosityLevel.Normal)
if (verbosity > VerbosityLevel.Quiet)
{
Console.WriteLine("");
}
Expand Down Expand Up @@ -378,7 +378,7 @@ internal async Task<ExitCodes> DownloadAndExtractAsync()
// set property
Version = match[0].Value;

if (Verbosity >= VerbosityLevel.Normal)
if (Verbosity > VerbosityLevel.Detailed)
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("Using cached firmware package");
Expand All @@ -389,7 +389,7 @@ internal async Task<ExitCodes> DownloadAndExtractAsync()
{
// no fw file available

if (Verbosity >= VerbosityLevel.Normal)
if (Verbosity > VerbosityLevel.Quiet)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Failure to download package and couldn't find one in the cache.");
Expand All @@ -403,7 +403,7 @@ internal async Task<ExitCodes> DownloadAndExtractAsync()
// got here, must have a file!

// unzip the firmware
if (Verbosity >= VerbosityLevel.Detailed)
if (Verbosity >= VerbosityLevel.Normal)
{
Console.ForegroundColor = ConsoleColor.White;
Console.Write($"Extracting {Path.GetFileName(fwFileName)}...");
Expand All @@ -413,7 +413,7 @@ internal async Task<ExitCodes> DownloadAndExtractAsync()
Path.Combine(LocationPath, fwFileName),
LocationPath);

if (Verbosity >= VerbosityLevel.Detailed)
if (Verbosity >= VerbosityLevel.Normal)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("OK");
Expand Down Expand Up @@ -460,7 +460,7 @@ private static async Task<DownloadUrlResult> GetDownloadUrlAsync(

try
{
if (verbosity >= VerbosityLevel.Normal)
if (verbosity >= VerbosityLevel.Detailed)
{
Console.ForegroundColor = ConsoleColor.White;
Console.Write($"Trying to find {targetName} in {(isPreview ? "development" : "stable")} repository...");
Expand All @@ -478,7 +478,7 @@ private static async Task<DownloadUrlResult> GetDownloadUrlAsync(
// check for empty array
if (responseBody == "[]")
{
if (verbosity >= VerbosityLevel.Normal)
if (verbosity >= VerbosityLevel.Detailed)
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("Not found");
Expand All @@ -488,7 +488,7 @@ private static async Task<DownloadUrlResult> GetDownloadUrlAsync(
// try now with community targets
repoName = _communityTargetsRepo;

if (verbosity >= VerbosityLevel.Normal)
if (verbosity >= VerbosityLevel.Detailed)
{
Console.ForegroundColor = ConsoleColor.White;
Console.Write($"Trying to find {targetName} in community targets repository...");
Expand All @@ -513,7 +513,7 @@ private static async Task<DownloadUrlResult> GetDownloadUrlAsync(
{
Console.WriteLine("");

if (verbosity >= VerbosityLevel.Normal)
if (verbosity > VerbosityLevel.Quiet)
{
Console.ForegroundColor = ConsoleColor.Red;

Expand Down Expand Up @@ -553,7 +553,7 @@ private static async Task<DownloadUrlResult> GetDownloadUrlAsync(

Console.WriteLine("");

if (verbosity >= VerbosityLevel.Normal)
if (verbosity > VerbosityLevel.Quiet)
{
Console.ForegroundColor = ConsoleColor.Red;

Expand Down Expand Up @@ -581,7 +581,7 @@ private static async Task<DownloadUrlResult> GetDownloadUrlAsync(

Console.WriteLine("");

if (verbosity >= VerbosityLevel.Normal)
if (verbosity > VerbosityLevel.Quiet)
{
// output helpful message
Console.ForegroundColor = ConsoleColor.Red;
Expand All @@ -599,7 +599,7 @@ private static async Task<DownloadUrlResult> GetDownloadUrlAsync(
return new DownloadUrlResult(string.Empty, string.Empty, ExitCodes.E9005);
}

if (verbosity >= VerbosityLevel.Normal)
if (verbosity > VerbosityLevel.Quiet)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine($"OK");
Expand Down

0 comments on commit 4a148bc

Please sign in to comment.