<?php return array('arg0' => 'schedule', 'command' => 'schedule', 'description' => 'List tasks scheduled for app.', 'run' => function ($args) { $client = new Client\Client(); $schedule = $client->get("apps/tasks"); $project = Client\Project::getConfig(); if (!$args['json']) { if ($schedule) { Client\Console::output("# crontab"); foreach ($schedule as $task) { Client\Console::output($task->command); } } else { Client\Console::output("No tasks scheduled for: '{$project['name']}'."); } } return $schedule; });
<?php return array('arg0' => 'console', 'command' => 'console [evaluate_file.js]', 'description' => 'Start interactive console, or run filename.', 'run' => function ($args) use($commands) { $config_path = Client\Project::getConfigFile(); if (!file_exists($config_path)) { throw new Exception("Missing file: '" . $config_path . "'.\n"); } // flag for server-side console $options = $args['server'] ? " --server" : ""; $options .= ' --environment ' . Client\Project::getEnvironment(); $descriptors = array(array('file', 'php://stdin', 'r'), array('file', 'php://stdout', 'w'), array('file', 'php://stderr', 'w')); $process = proc_open('node ' . __DIR__ . '/../../console/bootstrap.js ' . $config_path . ' ' . $args[1] . ' ' . $options, $descriptors, $pipes); // keep `hook` process open, to keep STDIN/STDOUT reference // while `console` is running. while (is_resource($process)) { usleep(50); } });