Page MenuHomePhabricator

D7647.id17268.diff

D7647.id17268.diff

diff --git a/src/workflow/ArcanistFeatureWorkflow.php b/src/workflow/ArcanistFeatureWorkflow.php
--- a/src/workflow/ArcanistFeatureWorkflow.php
+++ b/src/workflow/ArcanistFeatureWorkflow.php
@@ -60,6 +60,9 @@
'by-status' => array(
'help' => 'Sort branches by status instead of time.',
),
+ 'output-json' => array(
+ 'help' => 'Output feature info as json.',
+ ),
'*' => 'branch',
);
}
@@ -324,6 +327,7 @@
'current' => $branch['current'],
'status' => $status,
'desc' => $desc,
+ 'revision' => $revision ? $revision['id'] : null,
'color' => $color,
'esort' => $epoch,
'ssort' => $ssort,
@@ -338,16 +342,25 @@
} else {
$out = isort($out, 'esort');
}
-
- $console = PhutilConsole::getConsole();
- foreach ($out as $line) {
- $color = $line['color'];
- $console->writeOut(
- "%s **%s** <fg:{$color}>%s</fg> %s\n",
- $line['current'] ? '* ' : ' ',
- str_pad($line['name'], $len_name),
- str_pad($line['status'], $len_status),
- $line['desc']);
+ if ($this->getArgument('output-json')) {
+ $dictionary = array();
+ foreach ($out as $feature) {
+ $feature['epoch'] = $feature['esort'];
+ unset($feature['color'], $feature['ssort'], $feature['esort']);
+ $dictionary[$feature['name']] = $feature;
+ }
+ echo json_encode($dictionary) . "\n";
+ } else {
+ $console = PhutilConsole::getConsole();
+ foreach ($out as $line) {
+ $color = $line['color'];
+ $console->writeOut(
+ "%s **%s** <fg:{$color}>%s</fg> %s\n",
+ $line['current'] ? '* ' : ' ',
+ str_pad($line['name'], $len_name),
+ str_pad($line['status'], $len_status),
+ $line['desc']);
+ }
}
}

File Metadata

Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/dh/or/gwfcu7adfrp5ltae
Default Alt Text
D7647.id17268.diff (1 KB)

Event Timeline