/// <summary>
 /// When the first argument is [parse], the framework will output the result of all <see cref="TokenTransformation"/>s<br/>
 /// </summary>
 public static AppRunner UseParseDirective(this AppRunner appRunner)
 {
     AssertDirectivesAreEnabled(appRunner);
     return(ParseDirective.UseParseDirective(appRunner));
 }
 /// <summary>When an invalid arguments is entered, suggests context based alternatives</summary>
 public static AppRunner UseTypoSuggestions(this AppRunner appRunner, int maxSuggestionCount = 5)
 {
     return(TypoSuggestionsMiddleware.UseTypoSuggestions(appRunner, maxSuggestionCount));
 }
 /// <summary>Adds the --version option to the app</summary>
 public static AppRunner UseVersionMiddleware(this AppRunner appRunner)
 {
     return(VersionMiddleware.UseVersionMiddleware(appRunner));
 }
 /// <summary>Provide your own strategies for setting argument defaults from a configuration source</summary>
 public static AppRunner UseDefaultsFromConfig(this AppRunner appRunner,
                                               params Func <IArgument, ArgumentDefault>[] getDefaultValueCallbacks)
 => SetArgumentDefaultsMiddleware.SetArgumentDefaultsFrom(appRunner, getDefaultValueCallbacks);
 public static AppRunner UseCommandLogger(this AppRunner appRunner,
                                          Func <CommandContext, Action <string> > writerFactory = null,
                                          bool excludeSystemInfo = false,
                                          bool includeAppConfig  = false,
                                          Func <CommandContext, IEnumerable <(string key, string value)> > additionalInfoCallback = null)
 /// <summary>
 /// When <see cref="EnvVarAttribute"/> is present, looks for the key in the provided envVars config.<br/>
 /// If envVars is not provided the default <see cref="Environment.GetEnvironmentVariables()"/>
 /// </summary>
 public static AppRunner UseDefaultsFromEnvVar(this AppRunner appRunner, IDictionary envVars = null)
 {
     return(appRunner.UseDefaultsFromConfig(
                DefaultSources.EnvVar.GetDefaultValue(envVars, DefaultSources.EnvVar.GetKeyFromAttribute)));
 }
 /// <summary>
 /// Sets <see cref="AppConfig.CancellationToken"/> and cancels the token on
 /// <see cref="Console.CancelKeyPress"/>, <see cref="AppDomain.ProcessExit"/> and
 /// <see cref="AppDomain.UnhandledException"/> if <see cref="UnhandledExceptionEventArgs.IsTerminating"/> is true.<br/>
 /// Once cancelled, the pipelines will not progress to the next step.
 /// </summary>
 public static AppRunner UseCancellationHandlers(this AppRunner appRunner)
 {
     return(CancellationMiddleware.UseCancellationHandlers(appRunner));
 }
 /// <summary>Prefix a filepath with @ and it will be replaced by its contents during <see cref="MiddlewareStages.Tokenize"/></summary>
 /// <param name="appRunner">The <see cref="AppRunner"/></param>
 /// <param name="tokenTransformationOrder">
 /// The order response files token transformation should be run in relation to other <see cref="TokenTransformation"/>s.<br/>
 /// The default is 1. Change this if other transformations should be run before it.
 /// </param>
 public static AppRunner UseResponseFiles(this AppRunner appRunner, int tokenTransformationOrder = 1)
 {
     return(ExpandResponseFilesTransformation.UseResponseFiles(appRunner, tokenTransformationOrder));
 }
 /// <summary>Piped input will be appended to an operand list if one exists for the command</summary>
 public static AppRunner AppendPipedInputToOperandList(this AppRunner appRunner)
 {
     return(PipedInputMiddleware.AppendPipedInputToOperandList(appRunner));
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Returns the list of all possible types that could be instantiated to execute commands.<br/>
 /// Use get the list of types to register in your DI container.
 /// </summary>
 public static IEnumerable <Type> GetCommandClassTypes(this AppRunner appRunner) =>
 ClassCommandDef.GetAllCommandClassTypes(appRunner.RootCommandType);