本文整理匯總了PHP中Terminus::colorize方法的典型用法代碼示例。如果您正苦於以下問題:PHP Terminus::colorize方法的具體用法?PHP Terminus::colorize怎麽用?PHP Terminus::colorize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Terminus
的用法示例。
在下文中一共展示了Terminus::colorize方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: show_help
/**
* @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);
}
示例2: __invoke
/**
* 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");
}
}
示例3: show_help
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);
}
示例4: error
function error($message)
{
fwrite(STDERR, \Terminus::colorize("%RError:%n {$message}\n"));
}