2022-08-19 16:39:33 +03:00
|
|
|
function __tas_task_idx() {
|
2022-08-19 17:15:17 +03:00
|
|
|
echo "$@" | sed 's/^[> ] \([0-9]\+\)\..\+$/\1/'
|
2022-08-19 16:39:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function __tas_show() {
|
2022-08-20 16:17:55 +03:00
|
|
|
tas show $(__tas_task_idx "$1")
|
2022-08-19 16:39:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function __tas_start() {
|
2022-08-20 16:14:17 +03:00
|
|
|
if [[ "$1" != "" ]]; then
|
2022-08-20 16:17:55 +03:00
|
|
|
tas start $(__tas_task_idx "$1")
|
2022-08-20 16:14:17 +03:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function __tas_remove() {
|
|
|
|
if [[ "$1" != "" ]]; then
|
2022-08-20 16:17:55 +03:00
|
|
|
tas remove $(__tas_task_idx "$1")
|
2022-08-20 16:14:17 +03:00
|
|
|
fi
|
2022-08-19 16:39:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function __tas_list() {
|
2022-08-19 17:15:17 +03:00
|
|
|
tas list | fzf \
|
|
|
|
--info=inline --height=50% --no-sort --keep-right --layout=reverse \
|
|
|
|
--preview="tas show \$(sed 's/^[> ] \\([0-9]\\+\\)\\..\\+$/\\1/' {+f})"
|
2022-08-19 16:39:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function taz() {
|
|
|
|
case $1 in
|
|
|
|
"" | "show" | "sh")
|
2022-08-19 17:15:17 +03:00
|
|
|
__tas_show "$(__tas_list)"
|
2022-08-19 16:39:33 +03:00
|
|
|
;;
|
|
|
|
|
|
|
|
"list" | "ls")
|
|
|
|
__tas_list
|
|
|
|
;;
|
|
|
|
|
|
|
|
"start" | "st")
|
2022-08-19 17:15:17 +03:00
|
|
|
__tas_start "$(__tas_list)"
|
2022-08-20 16:14:17 +03:00
|
|
|
;;
|
|
|
|
|
|
|
|
"remove" | "rm")
|
|
|
|
__tas_remove "$(__tas_list)"
|
|
|
|
;;
|
2022-08-19 16:39:33 +03:00
|
|
|
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|