naggie / dstask

Git powered terminal-based todo/note manager -- markdown note page per task. Single binary!
https://calbryant.uk/blog/dstask-a-taskwarrior-alternative/
MIT License
801 stars 47 forks source link

Template IDs changing #122

Open cgardner opened 3 years ago

cgardner commented 3 years ago

Template IDs are not persistent, which causes some problems when scripting around dstask.

Alternately, when using templates from the command line, you have to constantly look up the templates to get the ID that you want to use.

We discussed this in slack and it sounded like the solution would be to use the UUID instead of ID for templates. Partially implemented in #37

I have worked around this by searching templates by name.

Here's my workaround:

function findTemplateBySummary() {
  local search=${1}
  local query=".[] | select(.summary == \"${search}\") | .id"
  echo $(command dstask show-templates | jq $query)
}
naggie commented 3 years ago

Thanks -- more specifically allowing addressing templates by numeric UUID as well as ID is the solution. The change will allow this for all tasks.

naggie commented 3 years ago

So they should be persistent on a given PC due to the ID cache.

Previously tasks stored their preferred ID in the yaml. This worked fine most of the time but would result in some merge conflicts.

I decided to cache IDs instead as otherwise I'd have to write something to deal with those (simple) conflicts which didn't seem like a good solution -- we'd end up with IDs that are consistent across hosts most of the time which is more dangerous that none of the time anyway.