File tree Expand file tree Collapse file tree 4 files changed +18
-8
lines changed Expand file tree Collapse file tree 4 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ Remove-Item -Path "${exerciseDir}/UnitTest1.cs"
5454(Get-Content - Path " .editorconfig" ) -Replace " \[\*\.cs\]" , " [${exerciseName} .cs]" | Set-Content - Path " ${exerciseDir} /.editorconfig"
5555
5656# Create new generator template and run generator (this will update the tests file)
57- bin/ update-tests.ps1 - e $Exercise - new
57+ bin/ update-tests.ps1 - Exercise $Exercise - New - SyncProbSpecs
5858
5959# Output the next steps
6060$files = Get-Content " exercises/practice/${Exercise} /.meta/config.json" | ConvertFrom-Json | Select-Object - ExpandProperty files
Original file line number Diff line number Diff line change 88 The slug of the exercise to generate the tests for (optional).
99. PARAMETER CreateNew
1010 Create a new test generator file before generating the tests (switch).
11+ . PARAMETER SyncProbSpecs
12+ Sync the prob-specs repo used (switch).
1113. EXAMPLE
1214 The example below will generate the tests for exercises with a template
1315 PS C:\> ./test.ps1
@@ -22,22 +24,29 @@ param (
2224 [string ]$Exercise ,
2325
2426 [Parameter ()]
25- [switch ]$New
27+ [switch ]$New ,
28+
29+ [Parameter ()]
30+ [switch ]$SyncProbSpecs
2631)
2732
2833$ErrorActionPreference = " Stop"
2934$PSNativeCommandUseErrorActionPreference = $true
3035
31- function Run-Command ($verb ) {
32- if ($Exercise ) {
33- & dotnet run -- project generators $verb -- exercise $Exercise
36+ function Run-Command ($verb , $exercise = $null ) {
37+ if ($exercise ) {
38+ & dotnet run -- project generators $verb -- exercise $exercise
3439 } else {
3540 & dotnet run -- project generators $verb
3641 }
3742}
3843
44+ if ($SyncProbSpecs.IsPresent ) {
45+ Run- Command sync
46+ }
47+
3948if ($New.IsPresent ) {
40- Run- Command new
49+ Run- Command new $Exercise
4150}
4251
43- Run- Command update
52+ Run- Command update $Exercise
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ internal static class ProbSpecs
66{
77 internal static void Sync ( )
88 {
9+ Console . WriteLine ( $ "Syncing problem-specifications repo...") ;
910 Clone ( ) ;
1011 Pull ( ) ;
1112 }
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ namespace Generators;
55public static class Program
66{
77 static void Main ( string [ ] args ) =>
8- Parser . Default . ParseArguments < NewOptions , UpdateOptions > ( args )
8+ Parser . Default . ParseArguments < NewOptions , UpdateOptions , SyncOptions > ( args )
99 . WithParsed < NewOptions > ( HandleNewCommand )
1010 . WithParsed < UpdateOptions > ( HandleUpdateCommand )
1111 . WithParsed < SyncOptions > ( HandleSyncCommand )
You can’t perform that action at this time.
0 commit comments