dstask icon indicating copy to clipboard operation
dstask copied to clipboard

Priority parsing

Open ghistes opened this issue 4 years ago • 4 comments

Hi,

this is a little strange behaviour when adding tasks with priorities:

dstask add P1 P2

this is not accepted but could conceivably be a task named "P2" with priority "P1".

dstask add P1 P3 P2 test

this is accepted (it really should be illegal) but can you guess the resulting priority? It's P2.

ghistes avatar Feb 03 '21 10:02 ghistes

Yes, the parser will grab the last priority it finds, not the first. I agree it should grab the first leaving the rest as part of the task description.

What version are you running by the way?

naggie avatar Feb 04 '21 20:02 naggie

Fixed and tested in master. Please re-open if you need to discuss more.

naggie avatar Feb 04 '21 21:02 naggie

Actually re-opening -- I did the same for projects, but I;m wondering if we should throw an error if multiple projects or priorities are supplied. I'm not sure yet, as I definitely have wanted to add things that look like a query in the description before.

naggie avatar Feb 04 '21 21:02 naggie

Definitely some parsing bugs around this.

I propose we allow stuff like this after the -- E.g. allow this (silly) example

task add P3 -- I parked my car on level P1 or was it P2

This currently yields the expected behavior. A task with priority P3 and the summary text "I parked my car on level P1 or was it P2"

But if we add an illegal, non-existent priority, we get a strange result.

% task add P4 -- I parked my car on level P1 or was it P2

Added 63: P4 I parked my car on level or was it P2
[master d074709] Added 63: P4 I parked my car on level or was it P2
 1 file changed, 11 insertions(+)
 create mode 100644 pending/593c64b0-ad10-4b27-8397-a4549be8399e.yml
                                                                                                                                                                                               
0 % task 63
Active context: +personal -someday
Name      Value                                   
ID        63                                      
Priority  P1                                      
Summary   P4 I parked my car on level or was it P2
Status    pending                                 
Project                                           
Tags                                              
UUID      593c64b0-ad10-4b27-8397-a4549be8399e    
Created   2022-03-24 18:52:56.368938538 -0400 EDT 
                                                           

dontlaugh avatar Mar 24 '22 22:03 dontlaugh