/// <summary> /// Sets an action to invoke, but only when there is a validation error. /// </summary> /// <param name="app"></param> /// <param name="action"></param> public static void OnValidationError(this CommandLineApplication app, Action <ValidationResult> action) { app.OnValidationError(r => { action(r); return(1); }); }
private ReflectionAppBuilder(CommandLineApplication app) { App = app; App.OnExecute((Func <int>)OnExecute); App.OnValidationError(r => { App.Invoke(); var ctx = (BindContext)App.State; ctx.ValidationResult = r; }); }