From 05e76965fd41b558e6fbb7aa9d0321cfe280057a Mon Sep 17 00:00:00 2001 From: Marcello Lamonaca Date: Wed, 16 Mar 2022 09:54:01 +0100 Subject: [PATCH] Add error message if no files are found in grouped mode --- src/Program.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Program.cs b/src/Program.cs index 14ce1d4..b70e239 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -1,6 +1,5 @@ using System.ComponentModel; using System.Diagnostics; -using System.Text; using Cocona; using Spectre.Console; @@ -34,6 +33,14 @@ static async Task RootCommand( if (grouped) { 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() .Title("Select a directory:") .PageSize(ScriptListSize)