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
88{
99 public class Arguments
1010 {
11- public Arguments ( )
12- {
13- Output . Add ( OutputType . Json ) ;
14- }
1511 public AuthenticationInfo Authentication ;
1612
1713 public Config OverrideConfig ;
Original file line number Diff line number Diff line change @@ -143,13 +143,31 @@ public void OutputJsonCanBeParsed()
143143 {
144144 var arguments = argumentParser . ParseArguments ( "targetDirectoryPath -output json" ) ;
145145 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 ) ;
146155 }
147156
148157 [ Test ]
149158 public void OutputBuildserverCanBeParsed ( )
150159 {
151160 var arguments = argumentParser . ParseArguments ( "targetDirectoryPath -output buildserver" ) ;
152161 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 ) ;
153171 }
154172
155173 [ Test ]
Original file line number Diff line number Diff line change @@ -264,12 +264,16 @@ public Arguments ParseArguments(string[] commandLineArguments)
264264
265265 if ( name . IsSwitch ( "output" ) )
266266 {
267- if ( ! Enum . TryParse ( value , true , out OutputType outputType ) )
267+ foreach ( var v in values )
268268 {
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 ) ;
270275 }
271276
272- arguments . Output . Add ( outputType ) ;
273277 continue ;
274278 }
275279
@@ -396,6 +400,11 @@ public Arguments ParseArguments(string[] commandLineArguments)
396400 throw new WarningException ( couldNotParseMessage ) ;
397401 }
398402
403+ if ( arguments . Output . Count == 0 )
404+ {
405+ arguments . Output . Add ( OutputType . Json ) ;
406+ }
407+
399408 if ( arguments . TargetPath == null )
400409 {
401410 // 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