private int Execute(CommandTree leaf, CommandTree tree, ILookup <string, string> remaining, ITypeResolver resolver) { // Create the command and the settings. var settings = leaf.CreateSettings(resolver); // Bind the command tree against the settings. _binder.Bind(tree, ref settings, resolver); // Execute the command. var command = leaf.CreateCommand(resolver); return(command.Execute(settings, remaining)); }
private static Task <int> Execute( CommandTree leaf, CommandTree tree, CommandContext context, ITypeResolver resolver, IConfiguration configuration) { // Bind the command tree against the settings. var settings = CommandBinder.Bind(tree, leaf.Command.SettingsType, resolver); configuration.Settings.Interceptor?.Intercept(context, settings); // Create and validate the command. var command = leaf.CreateCommand(resolver); var validationResult = command.Validate(context, settings); if (!validationResult.Successful) { throw CommandRuntimeException.ValidationFailed(validationResult); } // Execute the command. return(command.Execute(context, settings)); }