public static FluentBuilder <CommandLineParserOptions> ConfigureServices(this FluentBuilder <CommandLineParserOptions> builder, ServiceConfigurer configurer)
        {
            if (configurer == null)
            {
                throw new ArgumentNullException(nameof(configurer));
            }

            builder.AddTransformer(options => options.ServiceConfigurer = configurer);
            return(builder);
        }
        /// <summary>
        /// Quiets the parser with default options (suppressing errors and reporting).
        /// </summary>
        /// <param name="builder">Options builder.</param>
        /// <returns>The updated builder.</returns>
        public static FluentBuilder <CommandLineParserOptions> Quiet(this FluentBuilder <CommandLineParserOptions> builder)
        {
            builder.AddTransformer(options =>
            {
                options.DisplayUsageInfoOnError = false;
                options.Reporter = s => { };
            });

            return(builder);
        }
Esempio n. 3
0
 /// <summary>
 /// Updates the maximum width.
 /// </summary>
 /// <param name="builder">Options builder.</param>
 /// <param name="maxWidth">Maximum width.</param>
 /// <returns>The updated builder.</returns>
 public static FluentBuilder <ArgumentSetHelpOptions> MaxWidth(this FluentBuilder <ArgumentSetHelpOptions> builder, int maxWidth)
 {
     builder.AddTransformer(options => options.MaxWidth = maxWidth);
     return(builder);
 }
Esempio n. 4
0
 /// <summary>
 /// Updates the "use color or not" preference.
 /// </summary>
 /// <param name="builder">Options builder.</param>
 /// <param name="useColor">true to use color; false otherwise.</param>
 /// <returns>The updated builder.</returns>
 public static FluentBuilder <ArgumentSetHelpOptions> Color(this FluentBuilder <ArgumentSetHelpOptions> builder, bool useColor)
 {
     builder.AddTransformer(options => options.UseColor = useColor);
     return(builder);
 }
Esempio n. 5
0
 /// <summary>
 /// Removes the examples section from the output.
 /// </summary>
 /// <param name="builder">Options builder.</param>
 /// <returns>The updated builder.</returns>
 public static FluentBuilder <ArgumentSetHelpOptions> NoExamples(this FluentBuilder <ArgumentSetHelpOptions> builder)
 {
     builder.AddTransformer(options => options.Examples.Include = false);
     return(builder);
 }
Esempio n. 6
0
 /// <summary>
 /// Removes the basic syntax summary section from the output.
 /// </summary>
 /// <param name="builder">Options builder.</param>
 /// <returns>The updated builder.</returns>
 public static FluentBuilder <ArgumentSetHelpOptions> NoSyntaxSummary(this FluentBuilder <ArgumentSetHelpOptions> builder)
 {
     builder.AddTransformer(options => options.Syntax.Include = false);
     return(builder);
 }
Esempio n. 7
0
 /// <summary>
 /// Removes the description section from the output.
 /// </summary>
 /// <param name="builder">Options builder.</param>
 /// <returns>The updated builder.</returns>
 public static FluentBuilder <ArgumentSetHelpOptions> NoDescription(this FluentBuilder <ArgumentSetHelpOptions> builder)
 {
     builder.AddTransformer(options => options.Description.Include = false);
     return(builder);
 }
Esempio n. 8
0
 /// <summary>
 /// Updates help options to use a two-column layout.
 /// </summary>
 /// <param name="builder">Options builder.</param>
 /// <returns>The updated builder.</returns>
 public static FluentBuilder <ArgumentSetHelpOptions> TwoColumnLayout(this FluentBuilder <ArgumentSetHelpOptions> builder)
 {
     builder.AddTransformer(options => options.Arguments.Layout = new TwoColumnArgumentHelpLayout());
     return(builder);
 }
Esempio n. 9
0
 /// <summary>
 /// Updates default mode for display of arguments' short names.
 /// </summary>
 /// <param name="builder">Options builder.</param>
 /// <param name="mode">Desired mode.</param>
 /// <returns>The updated builder.</returns>
 public static FluentBuilder <ArgumentSetHelpOptions> ShortNames(this FluentBuilder <ArgumentSetHelpOptions> builder, ArgumentShortNameHelpMode mode)
 {
     builder.AddTransformer(options => options.Arguments.ShortName = mode);
     return(builder);
 }
Esempio n. 10
0
 /// <summary>
 /// Updates default mode for display of arguments' default values.
 /// </summary>
 /// <param name="builder">Options builder.</param>
 /// <param name="mode">Desired mode.</param>
 /// <returns>The updated builder.</returns>
 public static FluentBuilder <ArgumentSetHelpOptions> DefaultValues(this FluentBuilder <ArgumentSetHelpOptions> builder, ArgumentDefaultValueHelpMode mode)
 {
     builder.AddTransformer(options => options.Arguments.DefaultValue = mode);
     return(builder);
 }
Esempio n. 11
0
 /// <summary>
 /// Updates help options to add blank lines between adjacent arguments.
 /// </summary>
 /// <param name="builder">Options builder.</param>
 /// <param name="blankLineCount">Count of blank lines to add.</param>
 /// <returns>The updated builder.</returns>
 public static FluentBuilder <ArgumentSetHelpOptions> BlankLinesBetweenArguments(this FluentBuilder <ArgumentSetHelpOptions> builder, int blankLineCount = 1)
 {
     builder.AddTransformer(options => options.Arguments.BlankLinesBetweenArguments = blankLineCount);
     return(builder);
 }
Esempio n. 12
0
 /// <summary>
 /// Update enum value help flags.
 /// </summary>
 /// <param name="builder">Options builder.</param>
 /// <param name="flags">New flags.</param>
 /// <returns>The updated builder.</returns>
 public static FluentBuilder <ArgumentSetHelpOptions> EnumValueFlags(this FluentBuilder <ArgumentSetHelpOptions> builder, ArgumentEnumValueHelpFlags flags)
 {
     builder.AddTransformer(options => options.EnumValues.Flags = flags);
     return(builder);
 }