/// <summary> /// This gets called after the target property is populated. It cancels processing. /// </summary> /// <param name="context">Context passed by the parser</param> public override void AfterPopulateProperty(HookContext context) { base.AfterPopulateProperty(context); if (context.CurrentArgument.RevivedValue is bool && ((bool)context.CurrentArgument.RevivedValue) == true) { context.CancelAllProcessing(); } }
public override void AfterPopulateProperties(HookContext context) { var input = context.Args as ProgramArgs; var errMsgs = new List <string>(); if (input.Recurse && !input.NoMove) { errMsgs.Add("ERROR: Recurse is only available if NoMove is also true"); } if (input.NoOp && input.Force) { errMsgs.Add("ERROR: NoOp and Force cannot both be true"); } if (errMsgs.Any()) { Console.WriteLine(string.Concat(string.Join(Environment.NewLine, errMsgs), Environment.NewLine)); PrintUsage(); context.CancelAllProcessing(); } }