Example #1
0
        private bool isJuxtaPos(string flag)
        {
            int       max         = -1;
            StrOption currLongest = null;

            foreach (string k in this.longFlags)
            {
                Option o = this.options.GetValueOrDefault(k, null);
                if (o.GetType() == typeof(StrOption))
                {
                    StrOption so  = o as StrOption;
                    int       num = so.LongestJuxtaPos(flag);
                    if (num > 0 && num > max)
                    {
                        max         = num;
                        currLongest = so;
                    }
                }
            }

            if (currLongest != null)
            {
                currLongest.isSet = true;
                currLongest.AddParameter(flag.Substring(max));
                return(true);
            }

            return(false);
        }
Example #2
0
        public void AddStrOption(IEnumerable <string> flags)
        {
            var so = new StrOption(flags: flags);

            longFlags.Add(so.getName());
            foreach (string f in flags)
            {
                options.Add(f, so);
            }
        }
Example #3
0
        public List <string> GetOptions(string flag)
        {
            Option o = options.GetValueOrDefault(flag, null);

            if (o != null)
            {
                StrOption so = o as StrOption;
                if (so != null)
                {
                    return(so.values);
                }
            }
            return(null);
        }
Example #4
0
        public string GetOption(string flag)
        {
            Option o = options.GetValueOrDefault(flag, null);

            if (o != null)
            {
                StrOption so = o as StrOption;
                if (so != null)
                {
                    return(so.GetOption());
                }
            }
            return(null);
        }