diff --git a/src/GitVersionExe/ArgumentParser.cs b/src/GitVersionExe/ArgumentParser.cs index 07d151c3b1..166ac6a99c 100644 --- a/src/GitVersionExe/ArgumentParser.cs +++ b/src/GitVersionExe/ArgumentParser.cs @@ -50,6 +50,10 @@ public static OptionSet GetOptionSet(Arguments arguments) "p|password=", "Password in case authentication is required", v => arguments.Authentication.Password = v }, + { + "output=", "Determines the output to the console. Can be either 'json' or 'buildserver', will default to 'json'", + v => arguments.SetOutPutType(v) + }, }; } @@ -90,7 +94,6 @@ public static Arguments ParseArguments(List commandLineArguments) arguments.TargetPath = additionalArguments[0]; } - return arguments; /* @@ -262,17 +265,17 @@ public static Arguments ParseArguments(List commandLineArguments) continue; } - if (IsSwitch("output", name)) - { - OutputType outputType; - if (!Enum.TryParse(value, true, out outputType)) - { - throw new WarningException(string.Format("Value '{0}' cannot be parsed as output type, please use 'json' or 'buildserver'", value)); - } - - arguments.Output = outputType; - continue; - } + //if (IsSwitch("output", name)) + //{ + // OutputType outputType; + // if (!Enum.TryParse(value, true, out outputType)) + // { + // throw new WarningException(string.Format("Value '{0}' cannot be parsed as output type, please use 'json' or 'buildserver'", value)); + // } + + // arguments.Output = outputType; + // continue; + //} if (IsSwitch("nofetch", name)) { diff --git a/src/GitVersionExe/Arguments.cs b/src/GitVersionExe/Arguments.cs index fa3cfb9717..7313704fdb 100644 --- a/src/GitVersionExe/Arguments.cs +++ b/src/GitVersionExe/Arguments.cs @@ -1,5 +1,7 @@ namespace GitVersion { + using System; + public class Arguments { public Arguments() @@ -24,7 +26,15 @@ public Arguments() public string ShowVariable; public OutputType Output; - + + public void SetOutPutType(string value) + { + if (!Enum.TryParse(value, true, out Output)) + { + throw new WarningException(string.Format("Value '{0}' cannot be parsed as output type, please use 'json' or 'buildserver'", value)); + } + } + public string Proj; public string ProjArgs; public string Exec; @@ -35,5 +45,6 @@ public Arguments() public bool ShowConfig; public bool NoFetch { get; set; } + } } \ No newline at end of file