private static int ExecuteOperationByInputOptions(CommandLineOptions options) { int exitCode = 0; switch (options.Operation) { case Operation.ShowHelp: CommandLineParser.PrintUsage(); exitCode = 0; break; case Operation.ListRules: var ruleRunner = new RuleRunner(); ruleRunner.RunListRules(); exitCode = 0; break; case Operation.Format: var formatRunner = new FormatRunner(); exitCode = formatRunner.RunFormat(options); break; default: throw new Exception("Invalid enum value: " + options.Operation); } return(exitCode); }
private static int Main(string[] args) { var result = CommandLineParser.Parse(args); if (result.IsError) { Console.Error.WriteLine(result.Error); CommandLineParser.PrintUsage(); return(-1); } var options = result.Options; int exitCode; switch (options.Operation) { case Operation.ListRules: RunListRules(); exitCode = 0; break; case Operation.Format: exitCode = RunFormat(options); break; default: throw new Exception("Invalid enum value: " + options.Operation); } return(0); }
private static int Main(string[] args) { var result = CommandLineParser.Parse(args); if (result.IsError) { Console.Error.WriteLine(result.Error); CommandLineParser.PrintUsage(); return(-1); } string msBuildPath; if (!string.IsNullOrEmpty(result.Options.MsBuildPath)) { msBuildPath = result.Options.MsBuildPath; MSBuildLocator.RegisterMSBuildPath(msBuildPath); } else { var vsInstance = MSBuildLocator.RegisterDefaults(); msBuildPath = vsInstance.MSBuildPath; } Console.WriteLine("Using MsBuild from: {0}", msBuildPath); var options = result.Options; int exitCode; switch (options.Operation) { case Operation.ShowHelp: CommandLineParser.PrintUsage(); exitCode = 0; break; case Operation.ListRules: RunListRules(); exitCode = 0; break; case Operation.Format: exitCode = RunFormat(options); break; default: throw new Exception("Invalid enum value: " + options.Operation); } return(exitCode); }
private static int Main(string[] args) { var result = CommandLineParser.Parse(args); if (result.IsError) { Console.Error.WriteLine(result.Error); CommandLineParser.PrintUsage(); return(-1); } var options = result.Options; int exitCode = ExecuteOperationByInputOptions(options); return(exitCode); }