public static IParameterType analyze(string parameter, IParameterStyle type)
        {
            Dictionary <string, string> keyValue = new Dictionary <string, string>();
            var matches = type.flagStyle.Match(parameter);
            var count   = matches.Captures.Count;

            if (count == 1)
            {
                // flag
                return(new FlagParameter(matches.Groups[1].Value));
            }

            matches = type.parameterStyle.Match(parameter);
            count   = matches.Captures.Count;
            if (count == 1)
            {
                // parameter
                return(new KeyValueParameter(matches.Groups[1].Value, matches.Groups[2].Value));
            }


            return(null);
        }
示例#2
0
 private IParameterType getResult(string parameter, IParameterStyle style = null)
 {
     return(style == null?ParameterAnalyzer.analyze(parameter) :
                ParameterAnalyzer.analyze(parameter, style));
 }