pimutils / khal

:calendar: CLI calendar application
https://lostpackets.de/khal/
MIT License
2.61k stars 202 forks source link

On new event, with -i flag, daterange parsing error shouldn't wipe the whole event #789

Open amandabee opened 6 years ago

amandabee commented 6 years ago

If I screw up the datetime range when adding a new event, khal should...

  1. give me a clue about what was wrong with the range given (same as #786 ), and also
  2. give me a chance to revise the datetime range, without starting over.

Right now if I screw up, I have to add the whole event from scratch:

amanda@mona:\~$ khal new -i calendar: logistics summary: Coffee w/Somebody at a Place datetime range: tuesday 13:30 - 14:30 Traceback (most recent call last): File "/usr/local/bin/khal", line 11, in sys.exit(main_khal()) File "/home/amanda/.local/lib/python3.5/site-packages/click/core.py", line 722, in call return self.main(args, kwargs) File "/home/amanda/.local/lib/python3.5/site-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/home/amanda/.local/lib/python3.5/site-packages/click/core.py", line 1066, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/amanda/.local/lib/python3.5/site-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/amanda/.local/lib/python3.5/site-packages/click/core.py", line 535, in invoke return callback(args, *kwargs) File "/home/amanda/.local/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func return f(get_current_context(), args, **kwargs) File "/home/amanda/.local/lib/python3.5/site-packages/khal/cli.py", line 396, in new format=format, File "/home/amanda/.local/lib/python3.5/site-packages/khal/controllers.py", line 301, in new_interactive daterange, conf['locale'], adjust_reasonably=True) File "/home/amanda/.local/lib/python3.5/site-packages/khal/utils.py", line 438, in guessrangefstr raise ValueError('Could not parse {} as a daterange'.format(daterange)) ValueError: Could not parse tuesday 13:30 - 14:30 as a daterange amanda@mona:~$

geier commented 6 years ago

agreed

amandabee commented 6 years ago

Ideally it would also give me the preferred date format. Like "Could not parse tuesday 13:30 - 14:30 as a daterange -- try formatting dates as 01-Jan-2018 2PM" or something.