Skip to content

Commit

Permalink
Merge pull request #181 from codingforfun/strip_category
Browse files Browse the repository at this point in the history
Strip spaces from category and task
  • Loading branch information
mgedmin committed May 1, 2020
2 parents 52aa8f2 + 6e73951 commit 2988cab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/gtimelog/timelog.py
Expand Up @@ -249,9 +249,10 @@ def split_category(entry):
Return a tuple (category, task).
"""
if ': ' in entry:
return tuple(entry.split(': ', 1))
cat, tsk = entry.split(': ', 1)
return cat.strip(), tsk.strip()
elif entry.endswith(':'):
return entry.partition(':')[0], ''
return entry.partition(':')[0].strip(), ''
else:
return None, entry

Expand Down

0 comments on commit 2988cab

Please sign in to comment.