ref: defce8f0eb8d6335bd6d0e63704db38a4d52e3b5
parent: 0da4c1d51afac61c1d5eee1e728ead95f621f61a
author: rodri <rgl@antares-labs.eu>
date: Fri Feb 21 11:30:09 EST 2025
workout: add the ability to decrease number of sets.
--- a/workout
+++ b/workout
@@ -109,10 +109,20 @@
echo -n '> '
e=`{read}
e=`{sanitize $e}
+ hasminus=0
+ if(~ $e -*){
+ hasminus=1
+ e=`{echo $e | sed 's/^\-//'}
+ }
if(isnumber $e && test $e -ge 1 && test $e -le $#session){
lo=`{echo $e-1 | bc}
hi=`{echo $e+1 | bc}
- sets=($sets(1-$lo) `{echo $sets($e)+1 | bc} $sets($hi-))
+ if(~ $hasminus 1){
+ if(test $sets($e) -gt 0)
+ sets=($sets(1-$lo) `{echo $sets($e)-1 | bc} $sets($hi-))
+ }
+ if not
+ sets=($sets(1-$lo) `{echo $sets($e)+1 | bc} $sets($hi-))
}
}