Return to repo list

stctpw

Portage-compatible patch maker for suckless tools.
Return to HMagellan.com

commit ffa6beff948b9f16ae5d57a031c32917171c2c3a
parent 52e970edaff7f2e10ebbf7118b01164ca891981c
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Tue, 28 Jul 2020 12:52:47 -0500

redo options system

Diffstat:
Mstctpw.sh | 37+++++++++++++++++++++++++++----------
1 file changed, 27 insertions(+), 10 deletions(-)

diff --git a/stctpw.sh b/stctpw.sh @@ -2,16 +2,33 @@ MODFILE="$HOME/config.def.h" -# Flags -while getopts ":f:" option -do - case "${option}" - in - f ) - MODFILE=${OPTARG} - ;; +# Vars +FETCHWEB=0 +INSTALLPATCH=0 +NUMARGS=0 + +# Opts +while [[ "$#" -gt 0 ]]; do + case $1 in + -f) + MODFILE=="$2"; shift ;; + -w|--web) + FETCHWEB=1 ;; + -i|--install) + INSTALLPATCH=1 ;; + *) + echo "Argument was: $1" + NUMARGS=$NUMARGS+1 + if [[ $NUMARGS -eq 2 ]]; then + echo "Too many arguments!" + exit 1 + fi + ;; esac + shift done -shift $((OPTIND -1)) -echo "Test: $MODFILE" +echo "$MODFILE" +echo "fetch online? $FETCHWEB" +echo "install patch? $INSTALLPATCH" +