Пример #1
0
 internal static InstantiateCommandArgs FromNewCommandArgs(NewCommandArgs newCommandArgs)
 {
     if (!newCommandArgs.Tokens.Any())
     {
         return(new InstantiateCommandArgs(null, Array.Empty <string>(), newCommandArgs));
     }
     return(new InstantiateCommandArgs(newCommandArgs.Tokens[0], newCommandArgs.Tokens.Skip(1), newCommandArgs));
 }
Пример #2
0
 public IEnumerable <HelpSectionDelegate> CustomHelpLayout()
 {
     yield return((context) =>
     {
         if (context.ParseResult.CommandResult.Command is not NewCommand newCommand)
         {
             throw new ArgumentException($"{nameof(context)} should be for {nameof(NewCommand)}");
         }
         NewCommandArgs args = new NewCommandArgs(newCommand, context.ParseResult);
         using IEngineEnvironmentSettings environmentSettings = CreateEnvironmentSettings(args, context.ParseResult);
         InstantiateCommandArgs instantiateCommandArgs = InstantiateCommandArgs.FromNewCommandArgs(args);
         InstantiateCommand.WriteHelp(context, instantiateCommandArgs, environmentSettings);
     });
 }
Пример #3
0
 internal static Task <NewCommandStatus> ExecuteAsync(NewCommandArgs newCommandArgs, IEngineEnvironmentSettings environmentSettings, ITelemetryLogger telemetryLogger, InvocationContext context)
 {
     return(ExecuteIntAsync(InstantiateCommandArgs.FromNewCommandArgs(newCommandArgs), environmentSettings, telemetryLogger, context));
 }