Add error message if no files are found in grouped mode

This commit is contained in:
Marcello 2022-03-16 09:54:01 +01:00
parent c5b31e06bc
commit 05e76965fd

View file

@ -1,6 +1,5 @@
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using System.Text;
using Cocona; using Cocona;
using Spectre.Console; using Spectre.Console;
@ -34,6 +33,14 @@ static async Task RootCommand(
if (grouped) if (grouped)
{ {
var dict = finder.GetScriptsByDirectory(); var dict = finder.GetScriptsByDirectory();
if (dict.Count == 0)
{
AnsiConsole.Markup($"[red]No scripts script files found in '{finder.RootDirectory}' with extensions '{string.Join(", ", finder.Extensions)}'[/]");
Environment.ExitCode = ErrorExitCode;
return;
}
var prompt = new SelectionPrompt<DirectoryInfo>() var prompt = new SelectionPrompt<DirectoryInfo>()
.Title("Select a directory:") .Title("Select a directory:")
.PageSize(ScriptListSize) .PageSize(ScriptListSize)