Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CommandLine.Text.HelpText"/> class
        /// specifying heading and copyright strings.
        /// </summary>
        /// <param name="sentenceBuilder">A <see cref="SentenceBuilder"/> instance.</param>
        /// <param name="heading">A string with heading or an instance of <see cref="CommandLine.Text.HeadingInfo"/>.</param>
        /// <param name="copyright">A string with copyright or an instance of <see cref="CommandLine.Text.CopyrightInfo"/>.</param>
        /// <exception cref="System.ArgumentNullException">Thrown when one or more parameters are null or empty strings.</exception>
        public HelpText(SentenceBuilder sentenceBuilder, string heading, string copyright)
        {
            if (sentenceBuilder == null)
            {
                throw new ArgumentNullException("sentenceBuilder");
            }
            if (heading == null)
            {
                throw new ArgumentNullException("heading");
            }
            if (copyright == null)
            {
                throw new ArgumentNullException("copyright");
            }

            preOptionsHelp  = new StringBuilder(BuilderCapacity);
            postOptionsHelp = new StringBuilder(BuilderCapacity);
            try
            {
                maximumDisplayWidth = Console.WindowWidth;
                if (maximumDisplayWidth < 1)
                {
                    maximumDisplayWidth = DefaultMaximumLength;
                }
            }
            catch (IOException)
            {
                maximumDisplayWidth = DefaultMaximumLength;
            }
            this.sentenceBuilder = sentenceBuilder;
            this.heading         = heading;
            this.copyright       = copyright;
            this.autoHelp        = true;
            this.autoVersion     = true;
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandLine.Text.HelpText"/> class
 /// specifying heading and copyright strings.
 /// </summary>
 /// <param name="heading">A string with heading or an instance of <see cref="CommandLine.Text.HeadingInfo"/>.</param>
 /// <param name="copyright">A string with copyright or an instance of <see cref="CommandLine.Text.CopyrightInfo"/>.</param>
 /// <exception cref="System.ArgumentNullException">Thrown when one or more parameters are null or empty strings.</exception>
 public HelpText(string heading, string copyright)
     : this(SentenceBuilder.Create(), heading, copyright)
 {
 }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandLine.Text.HelpText"/> class
 /// specifying the sentence builder and heading string.
 /// </summary>
 /// <param name="sentenceBuilder">A <see cref="SentenceBuilder"/> instance.</param>
 /// <param name="heading">A string with heading or an instance of <see cref="CommandLine.Text.HeadingInfo"/>.</param>
 public HelpText(SentenceBuilder sentenceBuilder, string heading)
     : this(sentenceBuilder, heading, string.Empty)
 {
 }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandLine.Text.HelpText"/> class
 /// specifying heading string.
 /// </summary>
 /// <param name="heading">An heading string or an instance of <see cref="CommandLine.Text.HeadingInfo"/>.</param>
 /// <exception cref="System.ArgumentException">Thrown when parameter <paramref name="heading"/> is null or empty string.</exception>
 public HelpText(string heading)
     : this(SentenceBuilder.Create(), heading, string.Empty)
 {
 }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandLine.Text.HelpText"/> class
 /// specifying the sentence builder.
 /// </summary>
 /// <param name="sentenceBuilder">
 /// A <see cref="SentenceBuilder"/> instance.
 /// </param>
 public HelpText(SentenceBuilder sentenceBuilder)
     : this(sentenceBuilder, string.Empty, string.Empty)
 {
 }
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandLine.Text.HelpText"/> class.
 /// </summary>
 public HelpText()
     : this(SentenceBuilder.Create(), string.Empty, string.Empty)
 {
 }