mirror of
https://github.com/olexsmir/dotfiles.git
synced 2026-01-15 08:41:34 +02:00
bin: add timewarrior helper
This commit is contained in:
parent
1789289d99
commit
2f800f2b57
1 changed files with 38 additions and 0 deletions
38
bin/time.sh
Executable file
38
bin/time.sh
Executable 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue