/** * Print various data about the CLI environment. * * ## OPTIONS * * [--format=<format>] * : Accepted values: json */ function info($_, $assoc_args) { $php_bin = defined('PHP_BINARY') ? PHP_BINARY : getenv('TERMINUS_PHP_USED'); $runner = Terminus::get_runner(); $info = array('php_binary_path' => $php_bin, 'php_version' => PHP_VERSION, 'php_ini' => get_cfg_var('cfg_file_path'), 'global_config_path' => $runner->global_config_path, 'project_config_path' => $runner->project_config_path, 'wp_cli_dir_path' => TERMINUS_ROOT, 'wp_cli_version' => TERMINUS_VERSION); $labels = array('php_binary_path' => 'PHP binary', 'php_version' => 'PHP version', 'php_ini' => 'php.ini used', 'global_config_path' => 'Terminus global config', 'project_config_path' => 'Terminus project config', 'wp_cli_dir_path' => 'Terminus root dir', 'wp_cli_version' => 'Terminus version'); $this->output()->outputRecord($info, $labels); }
/** * Print various data about the CLI environment. * * ## OPTIONS * * [--format=<format>] * : Accepted values: json */ function info($_, $assoc_args) { $php_bin = defined('PHP_BINARY') ? PHP_BINARY : getenv('TERMINUS_PHP_USED'); $runner = Terminus::get_runner(); if (isset($assoc_args['format']) && 'json' === $assoc_args['format']) { $info = array('php_binary_path' => $php_bin, 'global_config_path' => $runner->global_config_path, 'project_config_path' => $runner->project_config_path, 'wp_cli_dir_path' => TERMINUS_ROOT, 'wp_cli_version' => TERMINUS_VERSION); Terminus::line(json_encode($info)); } else { Terminus::line("PHP binary:\t" . $php_bin); Terminus::line("PHP version:\t" . PHP_VERSION); Terminus::line("php.ini used:\t" . get_cfg_var('cfg_file_path')); Terminus::line("Terminus root dir:\t" . TERMINUS_ROOT); Terminus::line("Terminus global config:\t" . $runner->global_config_path); Terminus::line("Terminus project config:\t" . $runner->project_config_path); Terminus::line("Terminus version:\t" . TERMINUS_VERSION); } }
private function get_command($words) { $positional_args = $assoc_args = array(); foreach ($words as $arg) { if (preg_match('|^--([^=]+)=?|', $arg, $matches)) { $assoc_args[$matches[1]] = true; } else { $positional_args[] = $arg; } } $r = \Terminus::get_runner()->find_command_to_run($positional_args); if (!is_array($r) && array_pop($positional_args) == $this->cur_word) { $r = \Terminus::get_runner()->find_command_to_run($positional_args); } if (!is_array($r)) { return $r; } list($command, $args) = $r; return array($command, $args, $assoc_args); }
if (PHP_SAPI == 'cli' && isset($argv)) { $source = explode('/', $argv[0]); $source = end($source); } define('TERMINUS_SCRIPT', $source); date_default_timezone_set('UTC'); include TERMINUS_ROOT . '/php/utils.php'; include TERMINUS_ROOT . '/php/FileCache.php'; include TERMINUS_ROOT . '/php/dispatcher.php'; include TERMINUS_ROOT . '/php/class-terminus.php'; include TERMINUS_ROOT . '/php/class-terminus-command.php'; \Terminus\Utils\load_dependencies(); //Set a custom exception handler set_exception_handler('\\Terminus\\Utils\\handle_exception'); if (isset($_SERVER['TERMINUS_HOST']) && $_SERVER['TERMINUS_HOST'] != '') { define('TERMINUS_HOST', $_SERVER['TERMINUS_HOST']); } else { define('TERMINUS_HOST', 'dashboard.getpantheon.com'); } define('TERMINUS_PORT', '443'); if (isset($_SERVER['VCR_CASSETTE'])) { \VCR\VCR::configure()->enableRequestMatchers(array('method', 'url', 'body')); \VCR\VCR::configure()->setMode($_SERVER['VCR_MODE']); \VCR\VCR::turnOn(); \VCR\VCR::insertCassette($_SERVER['VCR_CASSETTE']); } Terminus::get_runner()->run(); if (isset($_SERVER['VCR_CASSETTE'])) { \VCR\VCR::eject(); \VCR\VCR::turnOff(); }