Story
As a developer, I want a simpler way to initialize an option's validations using property initializers.
readonly Option<string> Script = new("--script", "-c")
{
Description = "The PowerShell script to execute.",
Validator = {
FileOrDirectoryExists<FileInfo>
}
};
Today I have to define it separately and then run Script.AcceptLegalFileNamesOnly() in a constructor, which is not ideal.
Solution
Change the validators such as FileOrDirectoryExists<T> https://github.com/dotnet/command-line-api/blob/702b2bbdd795ec978c3f2bb395a1a37442c13c8c/src/System.CommandLine/ArgumentValidation.cs to public so I can use them as shown above.