bin: add timewarrior helper

This commit is contained in:
Oleksandr Smirnov 2025-09-09 23:31:10 +03:00
parent 1789289d99
commit 2f800f2b57
No known key found for this signature in database

38
bin/time.sh Executable file
View file

@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -euo pipefail
CATEGORIES=(
"stop"
"programming"
"notes"
"chat"
"chore"
"study"
"wasted"
)
_stop() { timew stop; }
_status() {
if current=$(timew get dom.active.tags 2>/dev/null); then
echo "$current"
else
echo "none"
fi
}
_select() {
selected=$(printf "%s\n" "${CATEGORIES[@]}" | sk --margin 25% --color="bw" --reverse)
[[ "$selected" == "" ]] && exit 1
if [[ "$selected" == "stop" ]]
then _stop
else timew start "$selected"
fi
}
case "${1:-}" in
status) _status ;;
stop) _stop ;;
*) _select ;;
esac