private static T DoStandardExceptionHandling<T>(ArgException ex, ArgHook.HookContext context, CommandLineArgumentsDefinition definition) where T : class { Console.WriteLine(ex.Message); ArgUsage.GetStyledUsage(definition, definition.ExceptionBehavior.ExeName, new ArgUsageOptions { ShowPosition = definition.ExceptionBehavior.ShowPositionColumn, ShowType = definition.ExceptionBehavior.ShowTypeColumn, ShowPossibleValues = definition.ExceptionBehavior.ShowPossibleValues, }).Write(); return CreateEmptyResult<T>(context, ex); }
/// <summary> /// Writes the help as long as WriteHelp is true /// </summary> /// <param name="context">Context passed by the parser</param> public override void AfterCancel(ArgHook.HookContext context) { base.AfterCancel(context); if (WriteHelp == false) { return; } ArgUsage.GetStyledUsage(context.Definition, EXEName, new ArgUsageOptions() { ShowPosition = ShowPositionColumn, ShowType = ShowTypeColumn, ShowPossibleValues = ShowPossibleValues, }).Write(); }