@@ -54,31 +54,28 @@ See more details in the [wiki for direct integrations](https://github.com/gsscod
5454C# Examples:
5555
5656``` csharp
57- internal class Options {
58- [Option ('r' ," read" ,
59- Required = true ,
60- HelpText = " Input files to be processed." )]
57+ class Options
58+ {
59+ [Option ('r' , " read" , Required = true , HelpText = " Input files to be processed." )]
6160 public IEnumerable <string > InputFiles { get ; set ; }
6261
6362 // Omitting long name, defaults to name of property, ie "--verbose"
64- [Option (
65- DefaultValue = false ,
66- HelpText = " Prints all messages to standard output." )]
63+ [Option (Default = false , HelpText = " Prints all messages to standard output." )]
6764 public bool Verbose { get ; set ; }
68-
69- [Option (" stdin" ,
70- DefaultValue = false
71- HelpText = " Read from stdin" )]
72- public bool stdin { get ; set ; }
73-
74- [Value (0 , MetaName = " offset" ,
75- HelpText = " File offset." )]
65+
66+ [Option (" stdin" , Default = false , HelpText = " Read from stdin" )]
67+ public bool stdin { get ; set ; }
68+
69+ [Value (0 , MetaName = " offset" , HelpText = " File offset." )]
7670 public long ? Offset { get ; set ; }
7771}
7872
79- static int Main (string [] args ) {
80- var options = new Options ();
81- var isValid = CommandLine .Parser .Default .ParseArgumentsStrict (args , options );
73+ static void Main (string [] args )
74+ {
75+ CommandLine .Parser .Default .ParseArguments <Options >(args )
76+ .WithParsed <Options >(opts => RunOptionsAndReturnExitCode (opts ))
77+ .WithNotParsed <Options >((errs ) => HandleParseError (errs ));
78+ }
8279```
8380
8481F# Examples:
0 commit comments