aboutsummaryrefslogtreecommitdiffhomepage
path: root/bin/task/context
diff options
context:
space:
mode:
Diffstat (limited to 'bin/task/context')
-rwxr-xr-xbin/task/context5
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
8LOG_FILE=~/log/.context && touch $LOG_FILE 8LOG_FILE=~/log/.context && touch $LOG_FILE
9PLAN_FILE=~/log/plan.context.md 9PLAN_FILE=~/log/plan.context.md
10PROC=$$
11trap 'exit 1' 10
12
10context="$(cat ~/.task/context)" 13context="$(cat ~/.task/context)"
11[[ "$*" =~ '-s' ]] && SET=true && shift 14[[ "$*" =~ '-s' ]] && SET=true && shift
12time="$1" 15time="$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