Case sensitivity switch for highbeam

This commit is contained in:
ville rantanen
2013-10-16 13:52:53 +03:00
parent 651249417c
commit 3002868165

View File

@@ -19,7 +19,8 @@ Color variables: $R $G $B $Y $M $C $W $BLACK
Modify to bright version by prefixing with $H (e.g. $H$G)
Background colors: $BGR $BGG $BGB $BGY $BGC $BGM $BGW
Usage: highbeam [-h] [-f config]
Usage: highbeam [-c] [-h] [-f config]
-c Be case sensitive
-h Help
-f Define config file (default ~/.highbeamrc)
-r Define rules with a string, replaces the other rules
@@ -54,8 +55,12 @@ BGW="${E}47m"
CONF_FILE=~/.highbeamrc
CONF_LINE=""
while getopts hf:r: opt
FLAGS="ig"
while getopts chf:r: opt
do case "$opt" in
c)
FLAGS="g"
;;
h)
usage
exit
@@ -77,13 +82,13 @@ done
exit 1
}
for (( r=0; r<${#RULES[@]}; r++ ));
do REGEX="$REGEX -e 's/\(${RULES[$r]}\)/${RULES[$(( $r + 1 ))]}\1${Z}/ig'"
do REGEX="$REGEX -e 's/\(${RULES[$r]}\)/${RULES[$(( $r + 1 ))]}\1${Z}/${FLAGS}'"
r=$(( $r + 1 ))
done
} || {
# string fed rules
for (( r=0; r<${#CONF_LINE[@]}; r++ ));
do REGEX="$REGEX -e 's/\(${CONF_LINE[$r]}\)/${CONF_LINE[$(( $r + 1 ))]}\1${Z}/ig'"
do REGEX="$REGEX -e 's/\(${CONF_LINE[$r]}\)/${CONF_LINE[$(( $r + 1 ))]}\1${Z}/${FLAGS}'"
r=$(( $r + 1 ))
done
}