public void Run([NotNull] string[] args) { ShowTitle(); IEnumerable <PreferenceGroupInfo> preferenceGroups = _generationService.GetPreferences(); if (args.Contains("--help", StringComparer.OrdinalIgnoreCase) || args.Contains("-help", StringComparer.OrdinalIgnoreCase) || args.Contains("-?", StringComparer.OrdinalIgnoreCase) || args.Contains("--?", StringComparer.OrdinalIgnoreCase)) { _helpWriter.WriteHelp(preferenceGroups); Environment.ExitCode = (int)ExitCodes.HelpShown; return; } var consoleInputToPreferenceConverter = new ConsoleInputToPreferenceConverter(); ParsedConsoleInput preferences = consoleInputToPreferenceConverter.ParseConsoleInput(args, preferenceGroups); if (preferences.ParseErrors.Any()) { foreach (var parseError in preferences.ParseErrors) { _consoleWriter.Info(parseError); } Environment.ExitCode = (int)ExitCodes.ConsoleInputParseError; return; } GenerateResult results = _generationService.Generate(preferences.ParsedPreferences.ToDictionary(kvp => kvp.Key.Name, kvp => kvp.Value)); //TODO: cleanup _resultWriter.Report(results); Environment.ExitCode = results.AllErrors.Any() ? (int)ExitCodes.GenerationFailed : (int)ExitCodes.Success; }