diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2023-04-11 14:50:12 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2023-04-11 14:50:12 +0800 |
commit | 9674fc1c8186a028391daaabfe3c5d738651a8d1 (patch) | |
tree | 58ed9f4d1d9252f8a789f9f3de270db028a89a7a /bin/task | |
parent | 37eed6a1184b5d60eded1310692657dae85ba157 (diff) |
Update
Diffstat (limited to 'bin/task')
-rwxr-xr-x | bin/task/context | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/bin/task/context b/bin/task/context index 44193d0..6642699 100755 --- a/bin/task/context +++ b/bin/task/context | |||
@@ -7,6 +7,9 @@ | |||
7 | 7 | ||
8 | LOG_FILE=~/log/.context && touch $LOG_FILE | 8 | LOG_FILE=~/log/.context && touch $LOG_FILE |
9 | PLAN_FILE=~/log/plan.context.md | 9 | PLAN_FILE=~/log/plan.context.md |
10 | PROC=$$ | ||
11 | trap 'exit 1' 10 | ||
12 | |||
10 | context="$(cat ~/.task/context)" | 13 | context="$(cat ~/.task/context)" |
11 | [[ "$*" =~ '-s' ]] && SET=true && shift | 14 | [[ "$*" =~ '-s' ]] && SET=true && shift |
12 | time="$1" | 15 | time="$1" |
@@ -27,6 +30,8 @@ _get_seconds() { | |||
27 | hour=$(grep -o '[0-9.]\+h' <<<"$1" | tr -d '[:alpha:]') | 30 | hour=$(grep -o '[0-9.]\+h' <<<"$1" | tr -d '[:alpha:]') |
28 | min=$(grep -o '[0-9.]\+m' <<<"$1" | tr -d '[:alpha:]') | 31 | min=$(grep -o '[0-9.]\+m' <<<"$1" | tr -d '[:alpha:]') |
29 | sec=$(grep -o '[0-9.]\+s' <<<"$1" | tr -d '[:alpha:]') | 32 | sec=$(grep -o '[0-9.]\+s' <<<"$1" | tr -d '[:alpha:]') |
33 | |||
34 | [ -z "$hour$min$sec" ] && kill -10 $PROC | ||
30 | echo "${hour:-0}*3600 + ${min:-0}*60 + ${sec:-0}" | bc | xargs printf '%.0f\n' | 35 | echo "${hour:-0}*3600 + ${min:-0}*60 + ${sec:-0}" | bc | xargs printf '%.0f\n' |
31 | } | 36 | } |
32 | 37 | ||