示例#1
0
        private void AppendOption(HelpSettings settings, StringBuilder buff, Option option, bool required)
        {
            if (!required)
            {
                buff.Append("[");
            }

            if (option.Name != null)
            {
                buff.Append("-").Append(option.Name);
            }
            else
            {
                buff.Append("--").Append(option.LongName);
            }

            // if the Option has a value
            if (option.HasArgument())
            {
                if (option.HasArgumentName)
                {
                    buff.Append(" <").Append(option.ArgumentName).Append(">");
                }
                else if (!String.IsNullOrEmpty(settings.ArgumentName))
                {
                    buff.Append(" <").Append(settings.ArgumentName).Append(">");
                }
            }

            // if the Option is not a required option
            if (!required)
            {
                buff.Append("]");
            }
        }