todoman
todoman copied to clipboard
Add support for editing and printing categories.
This issue was moved from the issue tracker at GitLab.
todoman should show the CATEGORIES assigned to a task. i.e. the following task contains the "Online" category:
$ cat 9fe6d194-24e2-46cf-a600-faad711f9f20.ics
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN
BEGIN:VTIMEZONE
TZID:Europe/Berlin
X-LIC-LOCATION:Europe/Berlin
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
END:STANDARD
END:VTIMEZONE
BEGIN:VTODO
CREATED:20150414T065645Z
LAST-MODIFIED:20150414T065820Z
DTSTAMP:20150414T065820Z
UID:9fe6d194-24e2-46cf-a600-faad711f9f20
SUMMARY:Todoman Testtask
PRIORITY:1
STATUS:NEEDS-ACTION
CATEGORIES:Online
X-MOZ-LASTACK:20150414T065807Z
DTSTART;TZID=Europe/Berlin:20150414T090000
DUE;TZID=Europe/Berlin:20150428T090000
LOCATION:Location
PERCENT-COMPLETE:20
DESCRIPTION:Description \n\nHello World
SEQUENCE:1
X-MOZ-GENERATION:3
X-MOZ-SNOOZE-TIME:20150415T065807Z
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER;VALUE=DURATION:-PT15M
DESCRIPTION:Default Mozilla Description
END:VALARM
END:VTODO
END:VCALENDAR
but todoman doesn't show it:
$ todo show 22
Todoman Testtask
Due: 2015-04-28 Urgent
Description
Hello World
The internal model already supports categories (we can even filter by them!).
Mostly, we need to add this to show, edit, new and to the UI. In the UI, they can be comma-separated (since categories can't have commas anyway).
hello!! I want to work on this issue..should it require test case?
Hello @Sakshisaraswat, yes, please add a testcase as well. The checklist for this issue looks very similar to https://github.com/pimutils/todoman/issues/11#issuecomment-283273398, except for adding support for LOCATION, we add support for CATEGORIES.
@Sakshisaraswat I can see you have some code towards this issue. Are you still working on this? What is the state of the code?
I have reworked the original patch and rebased it on master. Using this code https://github.com/christf/todoman/tree/category I can create and edit categories.
Unfortunately when saving multiple categories into the same task, the "," is masked by a backslash. This results in a line like:
CATEGORIES:cat1\,cat2
This works from the todoman perspective tough I do not think this is properly formated. I would appreciate help, feedback and comments on the existing code. I have not worked with python until now, please be even more constructive than you usually would be. I am willing to continue to work on this until the feature can be merged.
@christf Would you mind opening a PR to discuss code details for this patch there?
https://github.com/pimutils/todoman/compare/master...christf:category
Regarding the commas issue, it looks like using t.set_inline('category', ['foo','bar']) sets them properly (and also escapes commas INSIDE categories properly).
I also think we might be able to use the multiple options feature here, so category names can actually contain commas (which would actually be escaped). This would slightly change usage to:
todo new blah --category foo --category bar
I think this is slightly tidier than forcing people to comma-separate.