1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-12-01 11:12:41 +01:00

Changed the rendering of the priority column color based on the priorityColor property

Summary:
I changed the rendering of the bar color for the `priority` column when running `arc tasks` to match the `priorityColor` property.

If the `priorityColor` property is one of the basic colors already supported by ansi, then the bar is set to that color, otherwise it is set to white.

This will allow the user to customize maniphest priorities and then set their own colors and have those colors display correctly when running `arc tasks`

Fixed some linting errors

Test Plan:
Run `arc tasks` and ensure that:
 * the priority column is displayed with a colored bar
 * the priority column bar is the correct color (or white if it is an unsupported color)

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D8735
This commit is contained in:
epriestley 2014-04-09 12:13:34 -07:00
parent 7e394dcf11
commit ac528ab3a8

View file

@ -122,29 +122,33 @@ EOTEXT
'len' => phutil_utf8_console_strlen($formatted_title), 'len' => phutil_utf8_console_strlen($formatted_title),
); );
// Render the "Priority" column. // Render the "Priority" column.
switch ($task['priority']) { $web_to_terminal_colors = array(
case 'Needs Triage': 'violet' => 'magenta',
$color = 'magenta'; 'indigo' => 'magenta',
break; 'orange' => 'red',
case 'Unbreak Now!': 'sky' => 'cyan',
$color = 'red'; 'red' => 'red',
break; 'yellow' => 'yellow',
case 'High': 'green' => 'green',
$color = 'yellow'; 'blue' => 'blue',
break; 'cyan' => 'cyan',
case 'Normal': 'magenta' => 'magenta',
$color = 'green'; 'lightred' => 'red',
break; 'lightorange' => 'red',
case 'Low': 'lightyellow' => 'yellow',
$color = 'blue'; 'lightgreen' => 'green',
break; 'lightblue' => 'blue',
case 'Wishlist': 'lightsky' => 'blue',
$color = 'cyan'; 'lightindigo' => 'magenta',
break; 'lightviolet' => 'magenta'
default: );
if (isset($task['priorityColor'])) {
$color = idx($web_to_terminal_colors, $task['priorityColor'], 'white');
} else {
$color = 'white'; $color = 'white';
break;
} }
$formatted_priority = phutil_console_format( $formatted_priority = phutil_console_format(
"<bg:{$color}> </bg> %s", "<bg:{$color}> </bg> %s",