File tree Expand file tree Collapse file tree 3 files changed +30
-7
lines changed Expand file tree Collapse file tree 3 files changed +30
-7
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,6 @@ namespace GitVersion
8
8
{
9
9
public class Arguments
10
10
{
11
- public Arguments ( )
12
- {
13
- Output . Add ( OutputType . Json ) ;
14
- }
15
11
public AuthenticationInfo Authentication ;
16
12
17
13
public Config OverrideConfig ;
Original file line number Diff line number Diff line change @@ -143,13 +143,31 @@ public void OutputJsonCanBeParsed()
143
143
{
144
144
var arguments = argumentParser . ParseArguments ( "targetDirectoryPath -output json" ) ;
145
145
arguments . Output . ShouldContain ( OutputType . Json ) ;
146
+ arguments . Output . ShouldNotContain ( OutputType . BuildServer ) ;
147
+ }
148
+
149
+ [ Test ]
150
+ public void MultipleOutputJsonCanBeParsed ( )
151
+ {
152
+ var arguments = argumentParser . ParseArguments ( "targetDirectoryPath -output json -output json" ) ;
153
+ arguments . Output . ShouldContain ( OutputType . Json ) ;
154
+ arguments . Output . ShouldNotContain ( OutputType . BuildServer ) ;
146
155
}
147
156
148
157
[ Test ]
149
158
public void OutputBuildserverCanBeParsed ( )
150
159
{
151
160
var arguments = argumentParser . ParseArguments ( "targetDirectoryPath -output buildserver" ) ;
152
161
arguments . Output . ShouldContain ( OutputType . BuildServer ) ;
162
+ arguments . Output . ShouldNotContain ( OutputType . Json ) ;
163
+ }
164
+
165
+ [ Test ]
166
+ public void MultipleOutputBuildserverCanBeParsed ( )
167
+ {
168
+ var arguments = argumentParser . ParseArguments ( "targetDirectoryPath -output buildserver -output buildserver" ) ;
169
+ arguments . Output . ShouldContain ( OutputType . BuildServer ) ;
170
+ arguments . Output . ShouldNotContain ( OutputType . Json ) ;
153
171
}
154
172
155
173
[ Test ]
Original file line number Diff line number Diff line change @@ -264,12 +264,16 @@ public Arguments ParseArguments(string[] commandLineArguments)
264
264
265
265
if ( name . IsSwitch ( "output" ) )
266
266
{
267
- if ( ! Enum . TryParse ( value , true , out OutputType outputType ) )
267
+ foreach ( var v in values )
268
268
{
269
- throw new WarningException ( $ "Value '{ value } ' cannot be parsed as output type, please use 'json' or 'buildserver'") ;
269
+ if ( ! Enum . TryParse ( v , true , out OutputType outputType ) )
270
+ {
271
+ throw new WarningException ( $ "Value '{ value } ' cannot be parsed as output type, please use 'json' or 'buildserver'") ;
272
+ }
273
+
274
+ arguments . Output . Add ( outputType ) ;
270
275
}
271
276
272
- arguments . Output . Add ( outputType ) ;
273
277
continue ;
274
278
}
275
279
@@ -396,6 +400,11 @@ public Arguments ParseArguments(string[] commandLineArguments)
396
400
throw new WarningException ( couldNotParseMessage ) ;
397
401
}
398
402
403
+ if ( arguments . Output . Count == 0 )
404
+ {
405
+ arguments . Output . Add ( OutputType . Json ) ;
406
+ }
407
+
399
408
if ( arguments . TargetPath == null )
400
409
{
401
410
// If the first argument is a switch, it should already have been consumed in the above loop,
You can’t perform that action at this time.
0 commit comments