/** * Get meta field value. * * @synopsis <id> <key> [--format=<format>] */ public function get($args, $assoc_args) { list($object_id, $meta_key) = $args; $value = \get_metadata($this->meta_type, $object_id, $meta_key, true); if ('' === $value) { die(1); } \Terminus::print_value($value, $assoc_args); }
private static function pass_through_pager($out) { if (Utils\is_windows() || (bool) Terminus::get_config('bash') || (bool) Terminus::get_config('json')) { // No paging for Windows cmd.exe; sorry Terminus::print_value($out); return 0; } // convert string to file handle $fd = fopen("php://temp", "r+"); fputs($fd, $out); rewind($fd); $descriptorspec = array(0 => $fd, 1 => STDOUT, 2 => STDERR); return proc_close(proc_open('less -r', $descriptorspec, $pipes)); }
/** * Show multiple fields of an object. * * @param object|array Data to display * @param string Format to display the data in */ private static function show_multiple_fields($data, $format) { switch ($format) { case 'table': self::assoc_array_to_table($data); break; case 'json': \Terminus::print_value($data, array('format' => $format)); break; default: \Terminus::error("Invalid format: " . $format); break; } }