From: epriestley Date: Wed, 9 Apr 2014 19:13:34 +0000 (-0700) Subject: Changed the rendering of the `priority` column color based on the `priorityColor... X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=ac528ab3a83b3c7f0400f073f883135e40cdcdcc;p=arcanist.git 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 --- diff --git a/src/workflow/ArcanistTasksWorkflow.php b/src/workflow/ArcanistTasksWorkflow.php index ad88fc11..197a3ef0 100644 --- a/src/workflow/ArcanistTasksWorkflow.php +++ b/src/workflow/ArcanistTasksWorkflow.php @@ -122,29 +122,33 @@ EOTEXT 'len' => phutil_utf8_console_strlen($formatted_title), ); + // Render the "Priority" column. - switch ($task['priority']) { - case 'Needs Triage': - $color = 'magenta'; - break; - case 'Unbreak Now!': - $color = 'red'; - break; - case 'High': - $color = 'yellow'; - break; - case 'Normal': - $color = 'green'; - break; - case 'Low': - $color = 'blue'; - break; - case 'Wishlist': - $color = 'cyan'; - break; - default: - $color = 'white'; - break; + $web_to_terminal_colors = array( + 'violet' => 'magenta', + 'indigo' => 'magenta', + 'orange' => 'red', + 'sky' => 'cyan', + 'red' => 'red', + 'yellow' => 'yellow', + 'green' => 'green', + 'blue' => 'blue', + 'cyan' => 'cyan', + 'magenta' => 'magenta', + 'lightred' => 'red', + 'lightorange' => 'red', + 'lightyellow' => 'yellow', + 'lightgreen' => 'green', + 'lightblue' => 'blue', + 'lightsky' => 'blue', + 'lightindigo' => 'magenta', + 'lightviolet' => 'magenta' + ); + + if (isset($task['priorityColor'])) { + $color = idx($web_to_terminal_colors, $task['priorityColor'], 'white'); + } else { + $color = 'white'; } $formatted_priority = phutil_console_format( " %s",