aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2014-12-17 00:22:00 +0100
committerJohannes Löthberg <johannes@kyriasis.com>2014-12-17 00:22:00 +0100
commitfca5ab57513adbdbca677f0fb1d453db1285775f (patch)
treeb4a95a737c644eae5fcfeb7b025258502b894ecd
parentc54f82293b824d725243fa5b4878b867c64bb04e (diff)
downloadbin-fca5ab57513adbdbca677f0fb1d453db1285775f.tar.xz
todo: add format_priority to color priority
-rwxr-xr-xtodo13
1 files changed, 12 insertions, 1 deletions
diff --git a/todo b/todo
index 289f5e5..eaecf64 100755
--- a/todo
+++ b/todo
@@ -85,6 +85,17 @@ def color_blue(text):
color_string = '\x1b[38;2;050;150;250m{}\x1b[0m'
return color_string.format(text)
+def format_priority(priority):
+ text = '({})'.format(priority)
+ if priority == 'A':
+ return color_red(text)
+ elif priority == 'B':
+ return color_yellow(text)
+ elif priority == 'C':
+ return color_blue(text)
+ else:
+ return text
+
def main():
arguments = docopt(__doc__, version='todo 0.0.1.alpha')
config = parse_args(arguments)
@@ -101,7 +112,7 @@ def main():
task = todo_dict[t_id]
output = "{}. ".format(t_id)
if 'priority' in task:
- output += "({}) ".format(task['priority'])
+ output += '{} '.format(format_priority(task['priority']))
if 'date' in task:
output += "{}".format(task['date'])
if 'description' in task: