markdown launch code

This commit is contained in:
ville rantanen
2015-06-22 15:03:58 +03:00
parent 70196411b2
commit 57f924d94c
2 changed files with 140 additions and 33 deletions

View File

@@ -27,10 +27,12 @@ Underline: $U
Usage: highbeam [-c] [-h] [-f config]
-c Be case sensitive
-D Print current rules, not the input
-h Help
-f Define config file (default ~/.highbeamrc)
-r Define rules with a string, replaces the other rules
-r '\''"land[^[:space:]]\+" "$G" "sky" "$B"'\''
'
}
@@ -72,7 +74,8 @@ U="${E}4m"
CONF_FILE=~/.highbeamrc
CONF_LINE=""
FLAGS="ig"
while getopts chf:r: opt
PRINT=0
while getopts chf:r:D opt
do case "$opt" in
c)
FLAGS="g"
@@ -87,6 +90,9 @@ do case "$opt" in
r)
CONF_LINE=( $( eval echo $OPTARG ) )
;;
D)
PRINT=1
;;
esac
done
@@ -118,9 +124,28 @@ done
rIndex=$(( $rIndex + 1 ))
done
}
[[ $PRINT -eq 1 ]] && {
echo "From $CONF_FILE:"
for (( rIndex=0; rIndex<${#RULES[@]}; rIndex++ ));
do printf "%s\\t%s" "${RULES[$rIndex]}" "${RULES[$(( $rIndex + 1 ))]}"
rIndex=$(( $rIndex + 1 ))
done
echo "From argument switches:"
for (( rIndex=0; rIndex<${#CONF_LINE[@]}; rIndex++ ));
do printf "%s\\t%s" "${CONF_LINE[$rIndex]}" "${CONF_LINE[$(( $rIndex + 1 ))]}"
rIndex=$(( $rIndex + 1 ))
done
echo "From HB_RULES environment:"
for (( rIndex=0; rIndex<${#CONF_ENV[@]}; rIndex++ ));
do printf "%s\\t%s" "${CONF_ENV[$rIndex]}" "${CONF_ENV[$(( $rIndex + 1 ))]}"
rIndex=$(( $rIndex + 1 ))
done
#~ echo ${CONF_ENV[@]}
#~ echo $HB_RULES
#~ echo $REGEX
exit
}
[[ -z "$REGEX" ]] && {
cat -
} || {