reworked command line reading
This commit is contained in:
@@ -17,7 +17,7 @@ read_commandline()
|
|||||||
syntax_error()
|
syntax_error()
|
||||||
{
|
{
|
||||||
prnt E "Erreur d'analyse de la ligne de commande, vérifiez vos paramètres."
|
prnt E "Erreur d'analyse de la ligne de commande, vérifiez vos paramètres."
|
||||||
die 1
|
die 1 --force
|
||||||
}
|
}
|
||||||
|
|
||||||
# Processing command line options
|
# Processing command line options
|
||||||
@@ -26,8 +26,6 @@ read_commandline()
|
|||||||
local want_conffile=false
|
local want_conffile=false
|
||||||
|
|
||||||
for opt in $@; do
|
for opt in $@; do
|
||||||
if [[ $want_module != true ]] && [[ $want_logfile != true ]] &&
|
|
||||||
[[ $want_conffile != true ]]; then
|
|
||||||
case $opt in
|
case $opt in
|
||||||
"-h"|"--help")
|
"-h"|"--help")
|
||||||
disp_help
|
disp_help
|
||||||
@@ -68,11 +66,6 @@ read_commandline()
|
|||||||
local want_conffile=true
|
local want_conffile=true
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
prnt E "Paramètre \"$opt\" non géré."
|
|
||||||
die 1 --force
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
if [[ $want_module == true ]]; then
|
if [[ $want_module == true ]]; then
|
||||||
[[ $want_logfile == true ]] && synthax_error
|
[[ $want_logfile == true ]] && synthax_error
|
||||||
[[ $want_conffile == true ]] && synthax_error
|
[[ $want_conffile == true ]] && synthax_error
|
||||||
@@ -99,12 +92,16 @@ read_commandline()
|
|||||||
[[ $want_logfile == true ]] && synthax_error
|
[[ $want_logfile == true ]] && synthax_error
|
||||||
export CONFFILES="$CONFFILES $opt"
|
export CONFFILES="$CONFFILES $opt"
|
||||||
want_logfile=false
|
want_logfile=false
|
||||||
|
else
|
||||||
|
prnt E "Paramètre \"$opt\" non géré."
|
||||||
|
die 1 --force
|
||||||
fi
|
fi
|
||||||
fi
|
;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# If those var are true at that point, something is wrong
|
# If those var are true at that point, something is wrong
|
||||||
if [[ $want_logfile == true ]] || [[ $want_module == true ]]; then
|
if [[ $want_logfile == true ]] || [[ $want_module == true ]] || [[ $want_conffile == true ]]; then
|
||||||
syntax_error
|
syntax_error
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user