private static ICommandResult ProcessCommand(IUser user, IPlugin plugin, string commandLine, ICommandResult previousResullt) { try { return SafeProcessCommand(user, plugin, commandLine, previousResullt); } catch(Exception ex) { return CommandResult.Exception(ex); } }
private static ICommandResult SafeProcessCommand(IUser user, IPlugin plugin, string commandLine, ICommandResult previousResullt) { var ctx = PipedContextFor(plugin, user, commandLine, previousResullt); return plugin.ExecuteCommand(GetCommandName(commandLine), ctx); }
private static IContext PipedContextFor(IPlugin plugin, IUser user, string commandLine, ICommandResult result) { var passedArguments = CommandParameters(commandLine); return result.PipeThrough(passedArguments, pipedArgs => new Context(user, plugin, pipedArgs)); }