@@ -5,31 +5,38 @@ namespace Generators;
55public static class Program
66{
77 static void Main ( string [ ] args ) =>
8- Parser . Default . ParseArguments < NewOptions , GenerateOptions > ( args )
9- . WithParsed < GenerateOptions > ( HandleGenerateCommand )
8+ Parser . Default . ParseArguments < NewOptions , UpdateOptions > ( args )
109 . WithParsed < NewOptions > ( HandleNewCommand )
10+ . WithParsed < UpdateOptions > ( HandleUpdateCommand )
11+ . WithParsed < SyncOptions > ( HandleSyncCommand )
1112 . WithNotParsed ( HandleErrors ) ;
1213
13- private static void HandleGenerateCommand ( GenerateOptions options ) =>
14- Exercises . Templated ( options . Exercise ) . ForEach ( TestsGenerator . Generate ) ;
15-
1614 private static void HandleNewCommand ( NewOptions options ) =>
1715 Exercises . Untemplated ( options . Exercise ) . ForEach ( TemplateGenerator . Generate ) ;
1816
17+ private static void HandleUpdateCommand ( UpdateOptions options ) =>
18+ Exercises . Templated ( options . Exercise ) . ForEach ( TestsGenerator . Generate ) ;
19+
20+ private static void HandleSyncCommand ( SyncOptions options ) =>
21+ ProbSpecs . Sync ( ) ;
22+
1923 private static void HandleErrors ( IEnumerable < Error > errors ) =>
2024 errors . ToList ( ) . ForEach ( Console . Error . WriteLine ) ;
21-
22- [ Verb ( "generate" , isDefault : true , HelpText = "Generate the test file's contents using the exercise's generator template file." ) ]
23- private class GenerateOptions
24- {
25- [ Option ( 'e' , "exercise" , Required = false , HelpText = "The exercise (slug) which tests file to generate." ) ]
26- public string ? Exercise { get ; set ; }
27- }
2825
2926 [ Verb ( "new" , HelpText = "Create a new exercise generator template file." ) ]
3027 private class NewOptions
3128 {
3229 [ Option ( 'e' , "exercise" , Required = false , HelpText = "The exercise (slug) for which to generate a generator file." ) ]
3330 public string ? Exercise { get ; set ; }
3431 }
32+
33+ [ Verb ( "update" , isDefault : true , HelpText = "Update the test file's contents using the exercise's generator template file." ) ]
34+ private class UpdateOptions
35+ {
36+ [ Option ( 'e' , "exercise" , Required = false , HelpText = "The exercise (slug) which tests file to generate." ) ]
37+ public string ? Exercise { get ; set ; }
38+ }
39+
40+ [ Verb ( "sync" , HelpText = "Sync the problem specifications repo." ) ]
41+ private class SyncOptions ;
3542}
0 commit comments