Case sensitivity switch for highbeam
This commit is contained in:
13
highbeam
13
highbeam
@@ -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)
|
Modify to bright version by prefixing with $H (e.g. $H$G)
|
||||||
Background colors: $BGR $BGG $BGB $BGY $BGC $BGM $BGW
|
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
|
-h Help
|
||||||
-f Define config file (default ~/.highbeamrc)
|
-f Define config file (default ~/.highbeamrc)
|
||||||
-r Define rules with a string, replaces the other rules
|
-r Define rules with a string, replaces the other rules
|
||||||
@@ -54,8 +55,12 @@ BGW="${E}47m"
|
|||||||
|
|
||||||
CONF_FILE=~/.highbeamrc
|
CONF_FILE=~/.highbeamrc
|
||||||
CONF_LINE=""
|
CONF_LINE=""
|
||||||
while getopts hf:r: opt
|
FLAGS="ig"
|
||||||
|
while getopts chf:r: opt
|
||||||
do case "$opt" in
|
do case "$opt" in
|
||||||
|
c)
|
||||||
|
FLAGS="g"
|
||||||
|
;;
|
||||||
h)
|
h)
|
||||||
usage
|
usage
|
||||||
exit
|
exit
|
||||||
@@ -77,13 +82,13 @@ done
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
for (( r=0; r<${#RULES[@]}; r++ ));
|
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 ))
|
r=$(( $r + 1 ))
|
||||||
done
|
done
|
||||||
} || {
|
} || {
|
||||||
# string fed rules
|
# string fed rules
|
||||||
for (( r=0; r<${#CONF_LINE[@]}; r++ ));
|
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 ))
|
r=$(( $r + 1 ))
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user