using System.CommandLine.Builder; using System.CommandLine.Parsing; using DevDisciples.Json.Tools.CLI; var parser = new CommandLineBuilder(new RootCommand()) .UseDefaults() .UseExceptionHandler((ex, ctx) => { /* * Use a custom ExceptionHandler to prevent the System.CommandLine library from printing the StackTrace by default. */ Console.WriteLine(ex.Message); /* * Set the exit code to a non-zero value to indicate to the shell that the process has failed. */ Environment.ExitCode = -1; }) .Build(); await parser.InvokeAsync(args);