private static void HandleGraphAndHelp <T>(T build) where T : NukeBuild { if (build.Help == null) { return; } if (build.Help.Length == 0 || build.Help.Any(x => "targets".StartsWithOrdinalIgnoreCase(x))) { Logger.Log(HelpTextService.GetTargetsText(build)); } if (build.Help.Length == 0 || build.Help.Any(x => "parameters".StartsWithOrdinalIgnoreCase(x))) { Logger.Log(HelpTextService.GetParametersText(build)); } if (build.Graph) { GraphService.ShowGraph(build); } if (build.Help != null || build.Graph) { Environment.Exit(exitCode: 0); } }
private static void HandleGraphAndHelp <T>(T build) where T : NukeBuild { if (build.Help) { Logger.Log(HelpTextService.GetTargetsText(build)); Logger.Log(HelpTextService.GetParametersText(build)); } if (build.Graph) { GraphService.ShowGraph(build); } if (build.Help || build.Graph) { Environment.Exit(exitCode: 0); } }
private static TargetDefinition GetDefinition( string targetName, NukeBuild build) { if (targetName.EqualsOrdinalIgnoreCase(BuildExecutor.DefaultTarget)) { return(build.TargetDefinitions.Single(x => x.IsDefault)); } var targetDefinition = build.TargetDefinitions.SingleOrDefault(x => x.Name.EqualsOrdinalIgnoreCase(targetName)); if (targetDefinition == null) { var stringBuilder = new StringBuilder() .AppendLine($"Target with name '{targetName}' is not available.") .AppendLine() .AppendLine(HelpTextService.GetTargetsText(build)); ControlFlow.Fail(stringBuilder.ToString()); } return(targetDefinition); }