Beispiel #1
0
        public Options AddOption(Option option)
        {
            String key = option.Key();

            // add it to the long option list
            if (option.HasLongName()) {
                longOpts[option.LongName] = option;
            }

            // if the option is required add it to the required list
            if (option.IsRequired) {
                if (requiredOpts.Contains(key)) {
                    requiredOpts.RemoveAt(requiredOpts.IndexOf(key));
                }
                requiredOpts.Add(key);
            }

            shortOpts[key] = option;

            return this;
        }
Beispiel #2
0
        public Options AddOption(Option option)
        {
            String key = option.Key();

            // add it to the long option list
            if (option.HasLongName())
            {
                longOpts[option.LongName] = option;
            }

            // if the option is required add it to the required list
            if (option.IsRequired)
            {
                if (requiredOpts.Contains(key))
                {
                    requiredOpts.RemoveAt(requiredOpts.IndexOf(key));
                }
                requiredOpts.Add(key);
            }

            shortOpts[key] = option;

            return(this);
        }