From c13951a8bb947e3d6696b38410e5daa05b83654f Mon Sep 17 00:00:00 2001 From: Gardouille Date: Thu, 7 Oct 2021 17:52:20 +0200 Subject: [PATCH] Timew: use local var or unset them --- zshrc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/zshrc b/zshrc index 3cd428d..db3879e 100644 --- a/zshrc +++ b/zshrc @@ -407,14 +407,14 @@ alias taperso="task +perso | head" ## search a task by it's name (case INsensitive) {{{ function tase() { - search=""; + local search="" for i; do; search="$search /$i/"; done; task rc.search.case.sensitive:no $search all; } ## }}} ## search a task by it's name (case SENSITIVE) {{{ function tasec() { - search=""; + local search="" for i; do; search="$search /$i/"; done; task $search all; } @@ -502,7 +502,7 @@ function tilastyear() { ## "double" cause by default my tasks runs for 25 minutes function tidouble() { # Default duration time to add to a task - tidouble_extra_time="25mins" + local tidouble_extra_time="25mins" # Verify argument if [ "${#}" -eq 1 ]; then @@ -526,7 +526,7 @@ function tidouble() { # }}} # Get task's description from all task of this year - tidouble_task_desc=$(timew summary :year :ids | sed -n "s/.*@\(${tidouble_task_id} .*\)/\1/p" | sed 's/ */ − /g') + local tidouble_task_desc=$(timew summary :year :ids | sed -n "s/.*@\(${tidouble_task_id} .*\)/\1/p" | sed 's/ */ − /g') printf '%b' "Add ${tidouble_extra_time} to \"${MAGENTAB}${tidouble_task_desc}${RESET}\" [Y/n] ? " read -r tidouble_confirmation @@ -537,6 +537,9 @@ function tidouble() { timew split @"${tidouble_task_id}" || return 0 printf '%b' "${tidouble_extra_time} were added to \"${MAGENTAB}${tidouble_task_desc}${RESET}\" task." fi + + # Unset defined variables + unset tidouble_confirmation tidouble_task_id } ## }}} ## Delete a time tracking {{{ @@ -563,7 +566,7 @@ function tirm() { # }}} # Get task's description from all task of this year - tirm_task_desc=$(timew summary :year :ids | sed -n "s/.*@\(${tirm_task_id} .*\)/\1/p" | sed 's/ */ − /g') + local tirm_task_desc=$(timew summary :year :ids | sed -n "s/.*@\(${tirm_task_id} .*\)/\1/p" | sed 's/ */ − /g') printf '%b' "Delete to \"${MAGENTAB}${tirm_task_desc}${RESET}\" [Y/n] ? " read -r tirm_confirmation @@ -573,6 +576,9 @@ function tirm() { timew delete @"${tirm_task_id}" || return 0 printf '%b' "${tirm_task_desc} was deleted" fi + + # Unset defined variables + unset tirm_confirmation tirm_task_id } ## }}}