summaryrefslogtreecommitdiffstats
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
commit194ef093bbffaab5fa8215cd8262c4a9c5de1335 (patch)
tree04eb9b2f9d50ca5531b5ba06af6df960606c066d
parent0208e64ae8df331cc1b5e2e9c7e3b98544f5b15b (diff)
downloadtodo-194ef093bbffaab5fa8215cd8262c4a9c5de1335.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: