fix: Do not render repo update status when `--raw` is used

Fixes #215
spectre-console-remove-di-hacks
Robert Dailey 7 months ago
parent acd9b3ec75
commit 8b2b1302c6

@ -24,6 +24,11 @@ changes you may need to make.
was `3.0.4.1098`).
- **BREAKING**: Old boolean syntax for `reset_unmatched_scores` is no longer supported.
### Fixed
- Status text rendered during git repo updates is no longer shown when `--raw` is used with the
`list custom-formats` command (#215).
## [5.4.3] - 2023-09-16
### Changed

@ -45,7 +45,7 @@ public class ListCustomFormatsCommand : AsyncCommand<ListCustomFormatsCommand.Cl
public override async Task<int> ExecuteAsync(CommandContext context, CliSettings settings)
{
await _repoUpdater.UpdateAllRepositories(settings.CancellationToken);
await _repoUpdater.UpdateAllRepositories(settings.CancellationToken, settings.Raw);
_lister.List(settings);
return 0;
}

@ -56,7 +56,9 @@ public class CustomFormatDataLister
{
if (!raw)
{
_console.WriteLine("\nList of Custom Formats in the TRaSH Guides:");
_console.WriteLine();
_console.WriteLine("List of Custom Formats in the TRaSH Guides:");
_console.WriteLine();
}
var categories = _guide.GetCustomFormatData(serviceType)
@ -67,18 +69,21 @@ public class CustomFormatDataLister
foreach (var cat in categories)
{
var title = cat.Key is not null ? $"{cat.Key}" : "[No Category]";
_console.WriteLine($"\n # {title}");
_console.WriteLine($" # {title}");
foreach (var cf in cat)
{
_console.WriteLine($" - {cf.TrashId} # {cf.Name}");
}
_console.WriteLine();
}
if (!raw)
{
_console.WriteLine(
"\nThe above Custom Formats are in YAML format and ready to be copied & pasted " +
"The above Custom Formats are in YAML format and ready to be copied & pasted " +
"under the `trash_ids:` property.");
}
}

@ -13,7 +13,7 @@ public class ConsoleMultiRepoUpdater : IMultiRepoUpdater
_repos = repos;
}
public async Task UpdateAllRepositories(CancellationToken token)
public async Task UpdateAllRepositories(CancellationToken token, bool hideConsoleOutput = false)
{
var options = new ParallelOptions
{
@ -21,9 +21,15 @@ public class ConsoleMultiRepoUpdater : IMultiRepoUpdater
MaxDegreeOfParallelism = 3
};
await _console.Status().StartAsync("Updating Git Repositories...", async _ =>
var task = Parallel.ForEachAsync(_repos, options, async (repo, innerToken) => await repo.Update(innerToken));
if (!hideConsoleOutput)
{
await _console.Status().StartAsync("Updating Git Repositories...", _ => task);
}
else
{
await Parallel.ForEachAsync(_repos, options, async (repo, innerToken) => await repo.Update(innerToken));
});
await task;
}
}
}

@ -2,5 +2,5 @@ namespace Recyclarr.Repo;
public interface IMultiRepoUpdater
{
Task UpdateAllRepositories(CancellationToken token);
Task UpdateAllRepositories(CancellationToken token, bool hideConsoleOutput = false);
}

Loading…
Cancel
Save