blob: 65e9c1fb39128b42011765d48b4b9032d226267c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#!/bin/sh
[ "$1" = "info" ] && echo "start or resume the timer" && exit 2
usage() {
cat << EOF
usage:
$subcmd [options]
options:
-h, --help display this help text
-s, --skip skip to next lap, even if the timer is currently running
EOF
}
. "$core_path/lib"
. "$core_path/update"
allow_skip=0
while [ $# -gt 0 ] ; do
case "$1" in
-h|--help) usage && exit 0 ;;
-s|--skip) shift ; allow_skip=1 ;;
--) shift ; break ;;
*) err "unknown parameter: $1" ;;
esac
done
if [ $running -eq 1 ] ; then
[ $allow_skip -eq 0 ] && err "timer is already running, use -s to skip lap"
lap=$(( $lap + 1 ))
update_time=1
. "$core_path/update"
fi
time="$(echo "$now + $time" | bc)"
running=1
save_state
|