public AffectedRootCommand() { this.Name = "affected"; this.Description = "Determines which projects are affected by a set of changes."; this.AddCommand(new DescribeCommand()); this.AddGlobalOption(new RepositoryPathOptions()); this.AddGlobalOption(new SolutionPathOption()); this.AddGlobalOption(new VerboseOption()); this.AddGlobalOption(new AssumeChangesOption()); var fromOption = new FromOption(); this.AddGlobalOption(fromOption); this.AddGlobalOption(new ToOption(fromOption)); this.AddOption(new FormatOption()); this.AddOption(new DryRunOption()); this.AddOption(new OutputDirOption()); this.AddOption(new OutputNameOption()); // TODO: We need to specify the handler manually ONLY for the RootCommand this.Handler = CommandHandler.Create( typeof(AffectedCommandHandler).GetMethod(nameof(ICommandHandler.InvokeAsync)) !); }
public ToOption(FromOption fromOption) : base(new[] { "--to" }) { this.Description = "A branch or commit to compare against --from"; this.AddValidator(optionResult => { if (optionResult.FindResultFor(fromOption) is null) { optionResult.ErrorMessage = $"{fromOption.Aliases.First()} is required when using {this.Aliases.First()}"; } }); }