You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm attempting to use a IValueParser that was introduced in #59 with my application. Bare bones, here is what I have today.
[Subcommand("sign",typeof(Sign2Command))]classEntryPoint{staticintMain(string[]args)=> CommandLineApplication.Execute<EntryPoint>(args);publicintOnExecute(CommandLineApplicationapp){// Something gracefulreturn1;}}[Command("sign", Description ="Signs a file.")]classSign2Command{[Option("--file-digest", CommandOptionType.SingleValue)][AllowedValues("sha1","sha256","sha384","sha512", IgnoreCase =true)]publicstringFileDigestAlgorithm{get;set;}publicintOnExecute(CommandLineApplicationapp){
Console.WriteLine(FileDigestAlgorithm);// Do some signing.return0;}}
I would like to implement an IValueParser for FileDigestAlgorithm to automatically convert it to a HashAlgorithmName (which alas is not an enum, but is a struct with public properties). That is also pretty straight forward.
Where I am struggling is how I can add my new parser to the application. I've tried something like this:
Which makes sense, because now it wants me to define the Command on the app instance. I'm not sure how to go down that route without ditching properties and attributes entirely.
How can I use IValueParser with a subcommand while continuing to use properties and attributes? #62 looks like what I want, is there something I can do today in the mean time?
The text was updated successfully, but these errors were encountered:
I'm attempting to use a
IValueParser
that was introduced in #59 with my application. Bare bones, here is what I have today.I would like to implement an
IValueParser
forFileDigestAlgorithm
to automatically convert it to aHashAlgorithmName
(which alas is not an enum, but is a struct with public properties). That is also pretty straight forward.Where I am struggling is how I can add my new parser to the application. I've tried something like this:
But then I get
Which makes sense, because now it wants me to define the Command on the
app
instance. I'm not sure how to go down that route without ditching properties and attributes entirely.How can I use
IValueParser
with a subcommand while continuing to use properties and attributes? #62 looks like what I want, is there something I can do today in the mean time?The text was updated successfully, but these errors were encountered: