Timew|task: Exit function if cmd is unavailable
This commit is contained in:
parent
c13951a8bb
commit
c37b5ae6df
40
zshrc
40
zshrc
|
@ -409,14 +409,14 @@ alias taperso="task +perso | head"
|
|||
function tase() {
|
||||
local search=""
|
||||
for i; do; search="$search /$i/"; done;
|
||||
task rc.search.case.sensitive:no $search all;
|
||||
task rc.search.case.sensitive:no $search all || return 0
|
||||
}
|
||||
## }}}
|
||||
## search a task by it's name (case SENSITIVE) {{{
|
||||
function tasec() {
|
||||
local search=""
|
||||
for i; do; search="$search /$i/"; done;
|
||||
task $search all;
|
||||
task $search all || return 0
|
||||
}
|
||||
## }}}
|
||||
|
||||
|
@ -429,72 +429,72 @@ zstyle ':completion:*:*:task:*' group-name ''
|
|||
## Display tasks of today {{{
|
||||
function tiday() {
|
||||
if [ "${#}" -eq 0 ]; then
|
||||
timew summary :day :ids
|
||||
timew summary :day :ids || return 0
|
||||
else
|
||||
timew summary :day :ids "${*}"
|
||||
timew summary :day :ids "${*}" || return 0
|
||||
fi
|
||||
}
|
||||
## }}}
|
||||
## Display tasks of last day {{{
|
||||
function tilastday() {
|
||||
if [ "${#}" -eq 0 ]; then
|
||||
timew summary :yesterday :ids
|
||||
timew summary :yesterday :ids || return 0
|
||||
else
|
||||
timew summary :yesterday :ids "${*}"
|
||||
timew summary :yesterday :ids "${*}" || return 0
|
||||
fi
|
||||
}
|
||||
## }}}
|
||||
## Display tasks of this week {{{
|
||||
function tiweek() {
|
||||
if [ "${#}" -eq 0 ]; then
|
||||
timew summary :week :ids
|
||||
timew summary :week :ids || return 0
|
||||
else
|
||||
timew summary :week :ids "${*}"
|
||||
timew summary :week :ids "${*}" || return 0
|
||||
fi
|
||||
}
|
||||
## }}}
|
||||
## Display tasks of last week {{{
|
||||
function tilastweek() {
|
||||
if [ "${#}" -eq 0 ]; then
|
||||
timew summary :lastweek :ids
|
||||
timew summary :lastweek :ids || return 0
|
||||
else
|
||||
timew summary :lastweek :ids "${*}"
|
||||
timew summary :lastweek :ids "${*}" || return 0
|
||||
fi
|
||||
}
|
||||
## }}}
|
||||
## Display tasks of this month {{{
|
||||
function timonth() {
|
||||
if [ "${#}" -eq 0 ]; then
|
||||
timew summary :month :ids
|
||||
timew summary :month :ids || return 0
|
||||
else
|
||||
timew summary :month :ids "${*}"
|
||||
timew summary :month :ids "${*}" || return 0
|
||||
fi
|
||||
}
|
||||
## }}}
|
||||
## Display tasks of last month {{{
|
||||
function tilastmonth() {
|
||||
if [ "${#}" -eq 0 ]; then
|
||||
timew summary :lastmonth :ids
|
||||
timew summary :lastmonth :ids || return 0
|
||||
else
|
||||
timew summary :lastmonth :ids "${*}"
|
||||
timew summary :lastmonth :ids "${*}" || return 0
|
||||
fi
|
||||
}
|
||||
## }}}
|
||||
## Display tasks of this year {{{
|
||||
function tiyear() {
|
||||
if [ "${#}" -eq 0 ]; then
|
||||
timew summary :year :ids
|
||||
timew summary :year :ids || return 0
|
||||
else
|
||||
timew summary :year :ids "${*}"
|
||||
timew summary :year :ids "${*}" || return 0
|
||||
fi
|
||||
}
|
||||
## }}}
|
||||
## Display tasks of last year {{{
|
||||
function tilastyear() {
|
||||
if [ "${#}" -eq 0 ]; then
|
||||
timew summary :lastyear :ids
|
||||
timew summary :lastyear :ids || return 0
|
||||
else
|
||||
timew summary :lastyear :ids "${*}"
|
||||
timew summary :lastyear :ids "${*}" || return 0
|
||||
fi
|
||||
}
|
||||
## }}}
|
||||
|
@ -511,7 +511,7 @@ function tidouble() {
|
|||
else
|
||||
## If no argument or more than one
|
||||
## Ask the user to choose an ID in tasks from the yesterday {{{
|
||||
timew summary from yesterday :ids
|
||||
timew summary from yesterday :ids || return 0
|
||||
|
||||
printf '%b' "Enter the ${MAGENTAB}ID${RESET} of the task to double spent time should be doubled : "
|
||||
read -r tidouble_task_id
|
||||
|
@ -551,7 +551,7 @@ function tirm() {
|
|||
else
|
||||
## If no argument or more than one
|
||||
## Ask the user to choose an ID in tasks from the yesterday {{{
|
||||
timew summary from yesterday :ids
|
||||
timew summary from yesterday :ids || return 0
|
||||
|
||||
printf '%b' "Enter the ${MAGENTAB}ID${RESET} of the task to delete : "
|
||||
read -r tirm_task_id
|
||||
|
|
Loading…
Reference in New Issue