Task: Use delimiter to search tasks

This commit is contained in:
Jeremy Gardais 2023-05-02 15:58:56 +02:00
parent a9e7c1b5b7
commit 60f5788fce
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 4 additions and 5 deletions

View File

@ -82,16 +82,15 @@ display_current_task() { # {{{
## Display active tasks list and get title from the choosen one ## Display active tasks list and get title from the choosen one
TITLE=$(rofi -theme solarized_alternate -location 2 -l 5 -no-auto-select -i -dmenu -p "RUNNING task(s)" < "${TASKW_CURRENT_LIST}" | TITLE=$(rofi -theme solarized_alternate -location 2 -l 5 -no-auto-select -i -dmenu -p "RUNNING task(s)" < "${TASKW_CURRENT_LIST}" |
cut --delimiter=" " --field=2 | cut --delimiter=" " --field=2)
sed "s/[0-9]//g") ID=$(task "/${TITLE}/" simpleid | grep --after-context=2 -- ID | tail --lines=1 || return 0)
ID=$(task "${TITLE}" simpleid | grep --after-context=2 -- ID | tail --lines=1 || return 0)
## Remove temp file ## Remove temp file
rm --force -- "${TASKW_CURRENT_LIST}" rm --force -- "${TASKW_CURRENT_LIST}"
## If no task was selected (empty var) then exit ## If no task was selected (empty var) then exit
if [ -z "${TITLE}" ]; then if [ -z "${TITLE}" ]; then
echo "Cancelled." echo "Cancelled no selected task."
debug_message "display_current_task \ debug_message "display_current_task \
TITLE var is ${RED}empty${COLOR_DEBUG}." TITLE var is ${RED}empty${COLOR_DEBUG}."
exit 0 exit 0
@ -102,7 +101,7 @@ TITLE var: ${RED}${TITLE}${RESET}."
## If no ID was found (empty var) then exit ## If no ID was found (empty var) then exit
if [ -z "${ID}" ]; then if [ -z "${ID}" ]; then
echo "Cancelled." echo "Cancelled no ID found for this task."
debug_message "display_current_task \ debug_message "display_current_task \
ID var is ${RED}empty${COLOR_DEBUG}." ID var is ${RED}empty${COLOR_DEBUG}."
exit 0 exit 0