public int HandleErrors(IEnumerable <IError> errors) { int?exitCode = null; foreach (var error in errors) { if (error is VerbIsMissingError || error is UnknownVerbError) { _helpPresenter.Present(); exitCode = EXIT_CODE_VERB_ERROR; break; } else if (error is RequiredParameterMissingError || error is OptionForArgumentNotFoundError) { _helpPresenter.Present(((IVerbError)error).Verb); exitCode = EXIT_CODE_ARGUMENT_ERROR; break; } } _errorPresenter.Present(errors); if (exitCode != null) { return(exitCode.Value); } return(EXIT_CODE_OTHER); }
public AttributeParseResult ShowHelp(IVerb verb) { _helpPresenter.Present(verb); return(AttributeParseResult.CreateHelpRequest(verb, Configuration.Services.GetService <ErrorHandler>())); }