예제 #1
0
        public static bool CheckForArgsError(ITemplateMatchInfo template, out string commandParseFailureMessage)
        {
            bool argsError;

            if (template.HasParseError())
            {
                commandParseFailureMessage = template.GetParseError();
                argsError = true;
            }
            else
            {
                commandParseFailureMessage = null;
                IReadOnlyList <string> invalidParams = template.GetInvalidParameterNames();

                if (invalidParams.Count > 0)
                {
                    HelpForTemplateResolution.DisplayInvalidParameters(invalidParams);
                    argsError = true;
                }
                else
                {
                    argsError = false;
                }
            }

            return(argsError);
        }
예제 #2
0
        internal static bool CheckForArgsError(ITemplateMatchInfo template)
        {
            bool argsError;
            IEnumerable <string> invalidParams = template.GetInvalidParameterNames();

            if (invalidParams.Any())
            {
                HelpForTemplateResolution.DisplayInvalidParameters(invalidParams);
                argsError = true;
            }
            else
            {
                argsError = false;
            }

            return(argsError);
        }
예제 #3
0
        // This version is preferred, its clear which template the results are in the context of.
        public static bool ValidateRemainingParameters(ITemplateMatchInfo template, out IReadOnlyList<string> invalidParams)
        {
            invalidParams = template.GetInvalidParameterNames();

            return !invalidParams.Any();
        }