Add debug to file

This commit is contained in:
Santiago Lo Coco 2022-01-01 22:16:24 -03:00
parent 952e2fdb63
commit 3f90fe973a
2 changed files with 10 additions and 4 deletions

View File

@ -21,6 +21,8 @@ and then
sh CocoASAIS sh CocoASAIS
``` ```
You can use `-d` or `-f`...
## Contributing <a name="contributing"></a> ## Contributing <a name="contributing"></a>
PRs are welcome. PRs are welcome.

View File

@ -108,6 +108,8 @@ debug() {
while read input; do while read input; do
if [ $debugFlag = true ]; then if [ $debugFlag = true ]; then
echo $input echo $input
elif [ $debugFlagToFile = true ]; then
echo $input >> CocoASAIS.debug
else else
echo $input > /dev/null 2>&1 echo $input > /dev/null 2>&1
fi fi
@ -363,11 +365,12 @@ steps=(
) )
runScript() { runScript() {
debugFlag=false debugFlag=false; debugFlagToFile=false
while getopts ':hd' flag; do while getopts ':hdf' flag; do
case $flag in case $flag in
h) printf "usage: ${0##*/} [command]\n\t-h\tPrint this help message.\n\t-d\tDebug.\n" && exit 0 ;; h) printf "usage: ${0##*/} [command]\n\t-h\tPrint this help message.\n\t-d\tDebug to stdout.\n\t-d\tDebug to CocoASAIS.debug file.\n" && exit 0 ;;
d) debugFlag=true ;; d) debugFlag=true ;;
f) debugFlagToFile=true ;;
?) printf '%s: invalid option -''%s'\\n "${0##*/}" "$OPTARG" && exit 1 ;; ?) printf '%s: invalid option -''%s'\\n "${0##*/}" "$OPTARG" && exit 1 ;;
esac esac
done done
@ -404,4 +407,5 @@ runScript() {
done done
} }
runScript $@ # runScript $@
updateMirrors