using System.Reflection; using System.Runtime.InteropServices; using Geekeey.Extensions.Process.Tests.Dummy.Commands; using Spectre.Console.Cli; namespace Geekeey.Extensions.Process.Tests.Dummy; public static class Program { private static readonly string? FileExtension = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "exe" : null; #pragma warning disable IL3000 // only for testing where we don't run in single files! private static readonly string AssemblyPath = Assembly.GetExecutingAssembly().Location; #pragma warning restore IL3000 public static string FilePath { get; } = Path.ChangeExtension(AssemblyPath, FileExtension); private static Task Main(string[] args) { Environment.SetEnvironmentVariable("DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION", "false"); var app = new CommandApp(); app.Configure(Configuration); return app.RunAsync(args); void Configuration(IConfigurator configuration) { configuration.AddCommand("echo"); configuration.AddCommand("echo-stdin"); configuration.AddCommand("env"); configuration.AddCommand("cwd"); configuration.AddCommand("cwd"); configuration.AddCommand("exit"); configuration.AddCommand("length"); configuration.AddCommand("sleep"); configuration.AddBranch("generate", static generate => { generate.AddCommand("blob"); generate.AddCommand("clob"); }); } } }