I know how to tell if an option that I've created was used and how to retrieve its value:
// Add the option:
var outputOption = new Option<string>(new[] { "-o", "--output" }, "Path to desired output folder.");
var rootCommand = new RootCommand("File Builder App");
rootCommand.AddOption(outputOption);
// See if the app was launched with the option and access its value:
rootCommand.SetHandler(o => Console.WriteLine(o is not null), outputOption);
However, there's the --help/-h/-?
option that System.CommandLine
adds automatically. Is there a way to tell it has been provided?