/** * @param $command */ private function show_help($command) { $out = self::get_initial_markdown($command); $longdesc = $command->getLongdesc(); if ($longdesc) { if (is_array($longdesc)) { $flag_list = array_pop($longdesc); $flags = array(); foreach ($flag_list as $desc) { $flags[$desc['synopsis']] = $desc['desc']; } $out['parameters'] = $flags; $out = json_encode($out); } else { $out .= wordwrap($longdesc, 79) . "\n"; } } if (is_string($out)) { // section headers $out = preg_replace('/^## ([A-Z]+)/m', Terminus::colorize('%9\\1%n'), $out); // definition lists $out = preg_replace_callback('/([^\\n]+)\\n: (.+?)(\\n\\n|$)/s', array(__CLASS__, 'rewrap_param_desc'), $out); $out = str_replace("\t", ' ', $out); } $this->pass_through_pager($out); }
/** * View Pantheon artwork * * ## Options * * fist * * unicorn * * druplicon * * wordpress */ function __invoke($args, $assoc_args) { $artwork = array_shift($args) ?: array_rand($this->works); if (!empty($artwork) && array_key_exists($artwork, $this->works)) { echo Terminus::colorize("%g" . base64_decode($this->works[$artwork]) . "%n") . "\n"; } else { throw new TerminusException("No formula for requested artwork"); } }
private static function show_help($command) { $out = self::get_initial_markdown($command); $longdesc = $command->get_longdesc(); if ($longdesc) { $out .= wordwrap($longdesc, 79) . "\n"; } // section headers $out = preg_replace('/^## ([A-Z ]+)/m', Terminus::colorize('%9\\1%n'), $out); // definition lists $out = preg_replace_callback('/([^\\n]+)\\n: (.+?)(\\n\\n|$)/s', array(__CLASS__, 'rewrap_param_desc'), $out); $out = str_replace("\t", ' ', $out); self::pass_through_pager($out); }
function error($message) { fwrite(STDERR, \Terminus::colorize("%RError:%n {$message}\n")); }