tobixen / calendar-cli

Simple command-line CalDav client, for adding and browsing calendar items, todo list items
GNU General Public License v3.0
247 stars 23 forks source link

Add todo without due #63

Closed Unkn0wn-MDCLXIV closed 4 years ago

Unkn0wn-MDCLXIV commented 4 years ago

Is there a way to add items to a todo list without setting a due date? I'm adding items to a shopping list which obv dont need a due date.

tobixen commented 4 years ago

Of course items in a shopping list has a due date. You probably want to buy more milk this week, not the next? :-)

That's an interesting question. I do remember that when I made it, it made sense for me personally to have the default due set one day ahead (I would then go through all overdue tasks and push the due date forward), but I also remembered I was a bit concerned that this default probably didn't make much sense for everyone else.

I can see in the todo_add function at line 418 in master that if the set-due argument is not set, then the todo will be added with no due date. However, at line 844 the set-due argument gets a default value, and as far as I know it's not possible to unset it. One quick-fix would be to just remove the default value from that line, though I'm wary to break backward compatibility.

Another fix could be to add a check on 418 and treat blank values as non-existing. That's probably the best fix. Then it's just to add --set-due='' and it won't be set. I should probably also fix it so that the default value can be configured through the config file.

tobixen commented 4 years ago

I was reading the code slightly wrong, but anyway ... now it should be possible to do like this:

$ ./calendar-cli.py --config-section=work-tasks todo add --set-due='' 'test task'
Added todo item with uid=45a3ebe8-7e4b-11ea-8fed-9c8e99d15218

Now there is another potential problem that when trying to list the calendar item, it will show the default due date if the task has no due date.

$ ./calendar-cli.py --config-section=work-tasks todo --todo-uid=4723afda-7e4b-11ea-a713-9c8e99d15218 list 2020-04-14 (Tue)! 2020-04-28 (Tue) test task

Unkn0wn-MDCLXIV commented 4 years ago

Thanks for the quick fix. Todo list also shows the default date when a todo was added from a different client. This happened before, too.

tobixen commented 4 years ago

Yes. It is sort of a bug, at the other hand difficult to do something with it as the backward compatibility will be broken. I should probably make a calendar-cli version 1.0 soon, breaking backward compatibility and python2-compatibility.

tobixen commented 4 years ago

I'll close this and track a "proper" fix in a new isse.