From ca00569dd897c4c024f2d54873387cf06726ca6c Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Thu, 28 Aug 2025 20:21:01 -0300 Subject: [PATCH] Fail if explicit gist file path not found Only fallback to first .cs in case a path is NOT specified, since that would be a bug in the reference. --- src/gist/Program.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gist/Program.cs b/src/gist/Program.cs index 3c4c634..9f70d22 100644 --- a/src/gist/Program.cs +++ b/src/gist/Program.cs @@ -82,6 +82,13 @@ static async Task Main(RemoteRef location, string[] args) var program = Path.Combine(location.TempPath, location.Path ?? "program.cs"); if (!File.Exists(program)) { + if (location.Path is not null) + { + AnsiConsole.MarkupLine($":cross_mark: File reference not found in gist {location}."); + Dispatcher.MainThread.Shutdown(); + return 1; + } + var first = Directory.EnumerateFiles(location.TempPath, "*.cs", SearchOption.TopDirectoryOnly).FirstOrDefault(); if (first is null) {