diff options
author | lonkaars <loek@pipeframe.xyz> | 2024-03-12 10:19:24 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2024-03-12 10:19:24 +0100 |
commit | 501dd5505d950d89f5b4d0ad8249c38c36a102da (patch) | |
tree | ababe6702dbdcc19467167c8043cd7d2a5a12fcb /core/lap | |
parent | d3b396b17602ad71a62cbc2eaf595a1d94579c4a (diff) |
replace hard-coded breaks with plugin
Diffstat (limited to 'core/lap')
-rwxr-xr-x | core/lap | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/core/lap b/core/lap new file mode 100755 index 0000000..3c51c0c --- /dev/null +++ b/core/lap @@ -0,0 +1,17 @@ +#!/bin/sh +[ "$1" = "info" ] && echo "calculate lap duration" && exit 2 + +lap="$1" +break_rule() { + break_interval=$1 + break_duration=$2 + if [ $(( $lap % $break_interval )) -eq $(( $break_interval - 1 )) ] ; then + echo $break_duration + exit 0 + fi +} + +break_rule 6 $(( 15 * 60 )) # every 6th lap (every 3rd break) is a 15 minute break +break_rule 2 $(( 5 * 60 )) # every 2nd lap is a 5 minute break +echo $(( 25 * 60 )) # every other lap is a normal 25 minute lap + |