示例#1
0
        /**
         * Build the m_optionIndex lookup map for the parsed options.
         */
        private void BuildOptionIndex()
        {
            m_optionIndex = new Dictionary <Object, CLOption>(m_options.Count * 2);

            foreach (CLOption option in m_options)
            {
                CLOptionDescriptor optionDescriptor = GetDescriptorFor(option.GetDescriptor().GetId());

                m_optionIndex.Add(option.GetDescriptor().GetId(), option);

                if (null != optionDescriptor && null != optionDescriptor.GetName())
                {
                    m_optionIndex.Add(optionDescriptor.GetName(), option);
                }
            }
        }
示例#2
0
        private String DescribeDualOption(Int32 id)
        {
            CLOptionDescriptor descriptor = GetDescriptorFor(id);

            if (null == descriptor)
            {
                return("<parameter>");
            }
            else
            {
                StringBuilder sb            = new StringBuilder();
                Boolean       hasCharOption = false;

                if (Char.IsLetter((Char)id))
                {
                    sb.Append('-');
                    sb.Append((Char)id);
                    hasCharOption = true;
                }

                String longOption = descriptor.GetName();
                if (null != longOption)
                {
                    if (hasCharOption)
                    {
                        sb.Append('/');
                    }
                    sb.Append("--");
                    sb.Append(longOption);
                }

                return(sb.ToString());
            }
        }
示例#3
0
 private String GetOptionDescription(CLOptionDescriptor descriptor)
 {
     if (m_isLong)
     {
         return("--" + descriptor.GetName());
     }
     else
     {
         return("-" + (char)descriptor.GetId());
     }
 }
示例#4
0
 private String GetOptionDescription(CLOptionDescriptor descriptor)
 {
     if (m_isLong)
     {
         return "--" + descriptor.GetName();
     } else {
         return "-" + (char) descriptor.GetId();
     }
 }