public void Run(CommandLine commandLine) { var config = this.LoadConfig(commandLine.SitePath, commandLine.OutputPath); var lastRunState = this.LoadLastRunState(commandLine.SitePath); switch (commandLine.Command) { case ProcessingCommand.Render: { var engines = RenderingEngine.Load(); var command = new RunRenderCommand(config, lastRunState, engines); lastRunState = command.Execute(); } break; case ProcessingCommand.Serve: { var command = new RunServeCommand(config, commandLine.Port); command.Execute(); } break; case ProcessingCommand.Watch: { var engines = RenderingEngine.Load(); var command = new RunWatchCommand(config, commandLine.Port, lastRunState, engines); command.Execute(); } break; default: throw new InvalidOperationException($"Unknown ProcessingCommand: {commandLine.Command}"); } this.SaveLastRunState(commandLine.SitePath, lastRunState); }
private void Render() { var command = new RunRenderCommand(this.Config, this.LastRunState, this.Engines); command.Execute(); }