本文整理汇总了PHP中phutil_console_format函数的典型用法代码示例。如果您正苦于以下问题:PHP phutil_console_format函数的具体用法?PHP phutil_console_format怎么用?PHP phutil_console_format使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phutil_console_format函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCommandHelp
public function getCommandHelp()
{
return phutil_console_format(<<<EOTEXT
View all assigned tasks.
EOTEXT
);
}
示例2: run
public function run()
{
$roots = array();
$roots['libphutil'] = dirname(phutil_get_library_root('phutil'));
$roots['arcanist'] = dirname(phutil_get_library_root('arcanist'));
foreach ($roots as $lib => $root) {
echo "Upgrading {$lib}...\n";
if (!Filesystem::pathExists($root . '/.git')) {
throw new ArcanistUsageException("{$lib} must be in its git working copy to be automatically " . "upgraded. This copy of {$lib} (in '{$root}') is not in a git " . "working copy.");
}
$working_copy = ArcanistWorkingCopyIdentity::newFromPath($root);
$configuration_manager = clone $this->getConfigurationManager();
$configuration_manager->setWorkingCopyIdentity($working_copy);
$repository_api = ArcanistRepositoryAPI::newAPIFromConfigurationManager($configuration_manager);
$this->setRepositoryAPI($repository_api);
// Require no local changes.
$this->requireCleanWorkingCopy();
// Require the library be on master.
$branch_name = $repository_api->getBranchName();
if ($branch_name != 'master') {
throw new ArcanistUsageException("{$lib} must be on branch 'master' to be automatically upgraded. " . "This copy of {$lib} (in '{$root}') is on branch '{$branch_name}'.");
}
chdir($root);
try {
phutil_passthru('git pull --rebase');
} catch (Exception $ex) {
phutil_passthru('git rebase --abort');
throw $ex;
}
}
echo phutil_console_wrap(phutil_console_format("**Updated!** Your copy of arc is now up to date.\n"));
return 0;
}
示例3: getCommandHelp
public function getCommandHelp()
{
return phutil_console_format(<<<EOTEXT
Deprecated. Moved to "close-revision".
EOTEXT
);
}
示例4: getCommandHelp
public function getCommandHelp()
{
return phutil_console_format(<<<EOTEXT
Supports: cli
Create an alias from __command__ to __target__ (optionally, with
__options__). For example:
arc alias fpatch patch -- --force
...will create a new 'arc' command, 'arc fpatch', which invokes
'arc patch --force ...' when run. NOTE: use "--" before specifying
options!
If you start an alias with "!", the remainder of the alias will be
invoked as a shell command. For example, if you want to implement
'arc ls', you can do so like this:
arc alias ls '!ls'
You can now run "arc ls" and it will behave like "ls". Of course, this
example is silly and would make your life worse.
You can not overwrite builtins, including 'alias' itself. The builtin
will always execute, even if it was added after your alias.
To remove an alias, run:
arc alias fpatch
Without any arguments, 'arc alias' will list aliases.
EOTEXT
);
}
示例5: run
public function run()
{
$revisions = $this->getConduit()->callMethodSynchronous('differential.query', array('authors' => array($this->getUserPHID()), 'status' => 'status-open'));
if (!$revisions) {
echo "You have no open Differential revisions.\n";
return 0;
}
$repository_api = $this->getRepositoryAPI();
$info = array();
$status_len = 0;
foreach ($revisions as $key => $revision) {
$revision_path = Filesystem::resolvePath($revision['sourcePath']);
$current_path = Filesystem::resolvePath($repository_api->getPath());
if ($revision_path == $current_path) {
$info[$key]['here'] = 1;
} else {
$info[$key]['here'] = 0;
}
$info[$key]['sort'] = sprintf('%d%04d%08d', $info[$key]['here'], $revision['status'], $revision['id']);
$info[$key]['statusColorized'] = BranchInfo::renderColorizedRevisionStatus($revision['statusName']);
$status_len = max($status_len, strlen($info[$key]['statusColorized']));
}
$info = isort($info, 'sort');
foreach ($info as $key => $spec) {
$revision = $revisions[$key];
printf("%s %-" . ($status_len + 4) . "s D%d: %s\n", $spec['here'] ? phutil_console_format('**%s**', '*') : ' ', $spec['statusColorized'], $revision['id'], $revision['title']);
}
return 0;
}
示例6: getCommandHelp
public function getCommandHelp()
{
return phutil_console_format(<<<EOTEXT
Display inline comments related to a particular revision.
EOTEXT
);
}
示例7: getCommandHelp
public function getCommandHelp()
{
return phutil_console_format(<<<TXT
Shows coverage data from prior test run
TXT
);
}
示例8: getCommandHelp
public function getCommandHelp()
{
return phutil_console_format(<<<EOTEXT
Please use arc backout instead
EOTEXT
);
}
示例9: run
public function run()
{
$roots = array('libphutil' => dirname(phutil_get_library_root('phutil')), 'arcanist' => dirname(phutil_get_library_root('arcanist')));
foreach ($roots as $lib => $root) {
echo phutil_console_format("%s\n", pht('Upgrading %s...', $lib));
$working_copy = ArcanistWorkingCopyIdentity::newFromPath($root);
$configuration_manager = clone $this->getConfigurationManager();
$configuration_manager->setWorkingCopyIdentity($working_copy);
$repository = ArcanistRepositoryAPI::newAPIFromConfigurationManager($configuration_manager);
if (!Filesystem::pathExists($repository->getMetadataPath())) {
throw new ArcanistUsageException(pht("%s must be in its git working copy to be automatically upgraded. " . "This copy of %s (in '%s') is not in a git working copy.", $lib, $lib, $root));
}
$this->setRepositoryAPI($repository);
// Require no local changes.
$this->requireCleanWorkingCopy();
// Require the library be on master.
$branch_name = $repository->getBranchName();
if ($branch_name != 'master') {
throw new ArcanistUsageException(pht("%s must be on branch '%s' to be automatically upgraded. " . "This copy of %s (in '%s') is on branch '%s'.", $lib, 'master', $lib, $root, $branch_name));
}
chdir($root);
try {
phutil_passthru('git pull --rebase');
} catch (Exception $ex) {
phutil_passthru('git rebase --abort');
throw $ex;
}
}
echo phutil_console_format("**%s** %s\n", pht('Updated!'), pht('Your copy of arc is now up to date.'));
return 0;
}
示例10: run
public function run()
{
$srcdir = dirname(__FILE__) . '/../../';
$engine = new WatchmanIntegrationEngine();
$engine->setProjectRoot($srcdir);
$paths = $this->getArgument('args');
$results = $engine->run($paths);
$failed = 0;
$colors = array('pass' => '<fg:green>OK</fg> ', 'fail' => '<fg:red>FAIL</fg>', 'skip' => '<fg:yellow>SKIP</fg>');
foreach ($results as $result) {
$res = $result->getResult();
$status = idx($colors, $res, $res);
echo phutil_console_format("{$status} %s (%.2fs)\n", $result->getName(), $result->getDuration());
if ($res == 'pass' || $res == 'skip') {
continue;
}
echo $result->getUserData() . "\n";
$failed++;
}
if (!$failed) {
echo phutil_console_format("\nAll %d tests passed/skipped :successkid:\n", count($results));
} else {
echo phutil_console_format("\n%d of %d tests failed\n", $failed, count($results));
}
return $failed ? 1 : 0;
}
示例11: didExecute
public function didExecute(PhutilArgumentParser $args)
{
foreach ($this->getAPIs() as $api) {
$patches = $this->getPatches();
$applied = $api->getAppliedPatches();
if ($applied === null) {
echo phutil_console_format("**%s**: %s\n", pht('Database Not Initialized'), pht('Run **%s** to initialize.', './bin/storage upgrade'));
return 1;
}
$ref = $api->getRef();
$table = id(new PhutilConsoleTable())->setShowHeader(false)->addColumn('id', array('title' => pht('ID')))->addColumn('host', array('title' => pht('Host')))->addColumn('status', array('title' => pht('Status')))->addColumn('duration', array('title' => pht('Duration')))->addColumn('type', array('title' => pht('Type')))->addColumn('name', array('title' => pht('Name')));
$durations = $api->getPatchDurations();
foreach ($patches as $patch) {
$duration = idx($durations, $patch->getFullKey());
if ($duration === null) {
$duration = '-';
} else {
$duration = pht('%s us', new PhutilNumber($duration));
}
$table->addRow(array('id' => $patch->getFullKey(), 'host' => $ref->getRefKey(), 'status' => in_array($patch->getFullKey(), $applied) ? pht('Applied') : pht('Not Applied'), 'duration' => $duration, 'type' => $patch->getType(), 'name' => $patch->getName()));
}
$table->draw();
}
return 0;
}
示例12: getCommandHelp
public function getCommandHelp()
{
return phutil_console_format(<<<TXT
Generates an RPM suitable for use at Facebook
TXT
);
}
示例13: getCommandHelp
public function getCommandHelp()
{
return phutil_console_format(<<<EOTEXT
Show what you're currently tracking in Phrequent.
EOTEXT
);
}
示例14: getCommandHelp
public function getCommandHelp()
{
return phutil_console_format(<<<EOTEXT
Close a task.
EOTEXT
);
}
示例15: progress
private function progress($results, $numTests)
{
static $colors = array(ArcanistUnitTestResult::RESULT_PASS => 'green', ArcanistUnitTestResult::RESULT_FAIL => 'red', ArcanistUnitTestResult::RESULT_SKIP => 'yellow', ArcanistUnitTestResult::RESULT_BROKEN => 'red', ArcanistUnitTestResult::RESULT_UNSOUND => 'yellow', ArcanistUnitTestResult::RESULT_POSTPONED => 'yellow');
$s = "[";
$lastColor = "";
foreach ($results as $result) {
$color = $colors[$result->getResult()];
if (!$color && $lastColor) {
$s .= "</bg>";
} elseif (!$lastColor && $color) {
$s .= "<bg:{$color}>";
} elseif ($lastColor !== $color) {
$s .= "</bg><bg:{$color}>";
}
$lastColor = $color;
$s .= ".";
}
if ($lastColor) {
$s .= "</bg>";
}
$c = count($results);
if ($numTests) {
$s .= str_repeat(" ", $numTests - $c) . " {$c}/{$numTests}]";
} else {
$s .= " {$c}]";
}
return phutil_console_format($s);
}