setName('serve') ->setDescription('Serve documentation') // Serve the current documentation ->addOption('serve', null, InputOption::VALUE_NONE, 'Serve the current directory') ->addOption('host', null, InputOption::VALUE_REQUIRED, 'The host to serve on', 'localhost') ->addOption('port', null, InputOption::VALUE_REQUIRED, 'The port to serve on', 8085); } protected function execute(InputInterface $input, OutputInterface $output) { $host = $input->getOption('host'); $port = $input->getOption('port'); $daux = $this->prepareDaux($input, $output); // Daux can only serve HTML $daux->getParams()->setFormat('html'); chdir(__DIR__ . '/../../'); putenv('DAUX_SOURCE=' . $daux->getParams()->getDocumentationDirectory()); putenv('DAUX_THEME=' . $daux->getParams()->getThemesPath()); putenv('DAUX_CONFIGURATION=' . $daux->getParams()->getConfigurationOverrideFile()); putenv('DAUX_EXTENSION=' . DAUX_EXTENSION); $base = escapeshellarg(__DIR__ . '/../../'); $binary = escapeshellarg((new PhpExecutableFinder)->find(false)); echo "Daux development server started on http://{$host}:{$port}/\n"; passthru("{$binary} -S {$host}:{$port} {$base}/index.php"); } }