tasks
This commit is contained in:
parent
78998ff52a
commit
840ed37540
7 changed files with 242 additions and 24 deletions
19
modules/home/taskwarrior/hooks/on-add-expire
Executable file
19
modules/home/taskwarrior/hooks/on-add-expire
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Read the new task JSON object from standard input
|
||||
read new_task
|
||||
|
||||
# Extract the status and the 'expires' attribute from the new task
|
||||
status=$(echo "$new_task" | jq -r '.status')
|
||||
due=$(echo "$new_task" | jq -r '.due // empty')
|
||||
expires=$(echo "$new_task" | jq -r '.expires // empty')
|
||||
|
||||
# Check if the status is not 'recurring' and the 'expires' attribute is set
|
||||
if [[ "$status" != "recurring" && -n "$expires" ]]; then
|
||||
# Update the 'until' attribute with the value of 'expires'
|
||||
new_expire_date=$(task calc "$due + $expires")
|
||||
new_task=$(echo "$new_task" | jq -r -c --arg expires "$new_expire_date" '. + {until: $expires}')
|
||||
fi
|
||||
|
||||
# Output the new task
|
||||
echo "$new_task"
|
Loading…
Add table
Add a link
Reference in a new issue