本文整理汇总了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"));
}