/** * Automatically executed after the task action. * * @return void */ protected function after() { if ($this->auto_render === TRUE and $this->template instanceof View) { // Render and display template CLI::write($this->template->render()); } parent::after(); }
<?php /** * Server utilities */ CLI::on('server :action', function ($action) { switch ($action) { case 'run': $host = CLI::input("host", '0.0.0.0'); $port = CLI::input("port", 8888); CLI::write("[<white>APP</white>] <purple>Starting</purple> webserver on <cyan>{$host}</cyan>:<green>{$port}</green>"); CLI::writeln(""); exec("(which open && open http://{$host}:{$port}/); php -S {$host}:{$port} -t " . dirname(__DIR__) . "/public"); break; default: echo "Server utilities.", PHP_EOL; echo "- Available actions: run", PHP_EOL; break; } });
/** * Create task content and save in file. * * @return void */ protected function action() { CLI_Task_Scaffold::create($this->options['name'], $this->options['template']); CLI::write(__('Task `:name` created!', array(':name' => $this->options['name']))); }