Exposes standard delegates to provide a mean to customize part of help screen generation. This type is consumed by CommandLine.Text.HelpText.
Beispiel #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;
            }
            catch (IOException)
            {
                maximumDisplayWidth = DefaultMaximumLength;
            }
            this.sentenceBuilder = sentenceBuilder;
            this.heading         = heading;
            this.copyright       = copyright;
        }
Beispiel #2
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);

            this.sentenceBuilder = sentenceBuilder;
            this.heading         = heading;
            this.copyright       = copyright;
        }
Beispiel #3
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)
 {
 }
Beispiel #4
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)
 {
 }
Beispiel #5
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)
 {
 }
Beispiel #6
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)
 {
 }
Beispiel #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandLine.Text.HelpText"/> class.
 /// </summary>
 public HelpText()
     : this(SentenceBuilder.Create(), string.Empty, string.Empty)
 {
 }
Beispiel #8
0
 /// <summary>
 /// Set custom default instance
 /// </summary>
 /// <param name="builder"></param>
 public static void UseSentenceBuilder(SentenceBuilder builder)
 {
     _defaultBuilder = builder;
 }