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);
        }
Exemple #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);
        }
        // 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();
        }