Fix config issues

This commit is contained in:
Dylan Araps 2016-08-14 13:13:21 +10:00
parent 1805fcce59
commit ba569f78cd

View file

@ -2512,7 +2512,7 @@ trim() {
# Error {{{
err() {
err+="$(color 1)[!]$(color fg) $1
err+="$(color 1)[!]\033[0m $1
"
}
@ -2598,17 +2598,6 @@ getuserconfig() {
err "Sourced user config ($config_file)"
}
# Check the commandline flags early for '--config none/off'
case "$@" in
*"--config off"* | *'--config "off"'* | *"--config 'off'"* | \
*"--config none"* | *'--config "none"'* | *"--config 'none'"* | *"--stdout"*)
config="off"
;;
esac
getdefaultconfig 2>/dev/null
[ "${config:-on}" == "on" ] && getuserconfig 2>/dev/null
# }}}
# Progress bars {{{
@ -2816,6 +2805,20 @@ exit 1
# Args {{{
getargs() {
# Check the commandline flags early for '--config none/off'
case "$@" in
*"--config off"* | *'--config "off"'* | *"--config 'off'"* | \
*"--config none"* | *'--config "none"'* | *"--config 'none'"* | *"--stdout"*)
config="off"
;;
*"--config --"*) ;;
*"--config"*) config="off" ;;
esac
[ "${config:-on}" == "on" ] && getuserconfig 2>/dev/null
while [ "$1" ]; do
case $1 in
# Info
@ -3000,12 +3003,15 @@ while [ "$1" ]; do
shift
done
}
# }}}
# Call Functions and Finish Up {{{
main() {
getdefaultconfig 2>/dev/null
getargs "$@"
getos
# Restore cursor and clear screen on ctrl+c
@ -3058,12 +3064,12 @@ main() {
[ "$scrot" == "on" ] && takescrot
# Show error messages
[ "$verbose" == "on" ] && printf "%s" "$err"
[ "$verbose" == "on" ] && printf "%b%s" "$err"
# Reset exit status of the tests above
printf "%s"
}
main
main "$@"
# }}}