@@ -21,16 +21,20 @@ protected override StepResult HandleResult(string result, Queue<ConfigInitWizard
2121 steps . Enqueue ( new PickBranchingStrategyStep ( ) ) ;
2222 return StepResult . Ok ( ) ;
2323
24- case "3 " :
25- steps . Enqueue ( new ConfigureBranches ( ) ) ;
24+ case "4 " :
25+ steps . Enqueue ( new SetNextVersion ( ) ) ;
2626 return StepResult . Ok ( ) ;
27+
2728 case "4" :
28- steps . Enqueue ( new GlobalModeSetting ( new EditConfigStep ( ) , false ) ) ;
29+ steps . Enqueue ( new ConfigureBranches ( ) ) ;
2930 return StepResult . Ok ( ) ;
3031 case "5" :
31- steps . Enqueue ( new AssemblyVersioningSchemeSetting ( ) ) ;
32+ steps . Enqueue ( new GlobalModeSetting ( new EditConfigStep ( ) , false ) ) ;
3233 return StepResult . Ok ( ) ;
3334 case "6" :
35+ steps . Enqueue ( new AssemblyVersioningSchemeSetting ( ) ) ;
36+ return StepResult . Ok ( ) ;
37+ case "7" :
3438 steps . Enqueue ( new SetupBuildScripts ( ) ) ;
3539 return StepResult . Ok ( ) ;
3640 }
@@ -46,15 +50,46 @@ protected override string GetPrompt(Config config, string workingDirectory, IFil
4650
47512) Run getting started wizard
4852
49- 3) Branch specific configuration
50- 4) Branch Increment mode (per commit/after tag) (Current: {0})
51- 5) Assembly versioning scheme (Current: {1})
52- 6) Setup build scripts" , config . VersioningMode , config . AssemblyVersioningScheme ) ;
53+ 3) Set next version number
54+ 4) Branch specific configuration
55+ 5) Branch Increment mode (per commit/after tag) (Current: {0})
56+ 6) Assembly versioning scheme (Current: {1})
57+ 7) Setup build scripts" , config . VersioningMode , config . AssemblyVersioningScheme ) ;
5358 }
5459
5560 protected override string DefaultResult
5661 {
5762 get { return null ; }
5863 }
5964 }
65+
66+ public class SetNextVersion : ConfigInitWizardStep
67+ {
68+ protected override StepResult HandleResult ( string result , Queue < ConfigInitWizardStep > steps , Config config , string workingDirectory , IFileSystem fileSystem )
69+ {
70+ if ( string . IsNullOrEmpty ( result ) )
71+ {
72+ steps . Enqueue ( new EditConfigStep ( ) ) ;
73+ return StepResult . Ok ( ) ;
74+ }
75+
76+ SemanticVersion semVer ;
77+ if ( ! SemanticVersion . TryParse ( result , string . Empty , out semVer ) )
78+ return StepResult . InvalidResponseSelected ( ) ;
79+
80+ config . NextVersion = semVer . ToString ( "t" ) ;
81+ steps . Enqueue ( new EditConfigStep ( ) ) ;
82+ return StepResult . Ok ( ) ;
83+ }
84+
85+ protected override string GetPrompt ( Config config , string workingDirectory , IFileSystem fileSystem )
86+ {
87+ return @"What would you like to set the next version to (enter nothing to cancel)?" ;
88+ }
89+
90+ protected override string DefaultResult
91+ {
92+ get { throw new System . NotImplementedException ( ) ; }
93+ }
94+ }
6095}
0 commit comments