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 | |
parent | 37eed6a1184b5d60eded1310692657dae85ba157 (diff) |
Update
-rw-r--r-- | alias | 2 | ||||
-rwxr-xr-x | bin/task/context | 5 |
2 files changed, 6 insertions, 1 deletions
@@ -300,7 +300,7 @@ alias b='bean' | |||
300 | # about vimwiki | 300 | # about vimwiki |
301 | alias cdl='cd ~/log' | 301 | alias cdl='cd ~/log' |
302 | alias chw='tig -C ~/log' | 302 | alias chw='tig -C ~/log' |
303 | ww() { entry="${1:-guideline}"; vim -c Goyo ~/log/${entry%%.md}.md; } | 303 | ww() { entry="${1:-plan.context}"; vim -c Goyo ~/log/${entry%%.md}.md; } |
304 | wg() { grep -r "$@" --color --exclude-dir={logseq,.git,.obsidian} ~/log; } | 304 | wg() { grep -r "$@" --color --exclude-dir={logseq,.git,.obsidian} ~/log; } |
305 | wi() { cat ~/log/${1%%.md}.md; } | 305 | wi() { cat ~/log/${1%%.md}.md; } |
306 | alias dia='diary' | 306 | alias dia='diary' |
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 | ||