Fix config issues

This commit is contained in:
Dylan Araps 2016-08-14 13:13:21 +10:00
parent 1805fcce59
commit ba569f78cd
1 changed files with 199 additions and 193 deletions

View File

@ -2512,7 +2512,7 @@ trim() {
# Error {{{ # Error {{{
err() { err() {
err+="$(color 1)[!]$(color fg) $1 err+="$(color 1)[!]\033[0m $1
" "
} }
@ -2598,17 +2598,6 @@ getuserconfig() {
err "Sourced user config ($config_file)" 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 {{{ # Progress bars {{{
@ -2816,7 +2805,21 @@ exit 1
# Args {{{ # Args {{{
while [ "$1" ]; do 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 case $1 in
# Info # Info
--os_arch) os_arch="$2" ;; --os_arch) os_arch="$2" ;;
@ -2999,13 +3002,16 @@ while [ "$1" ]; do
esac esac
shift shift
done done
}
# }}} # }}}
# Call Functions and Finish Up {{{ # Call Functions and Finish Up {{{
main() { main() {
getdefaultconfig 2>/dev/null
getargs "$@"
getos getos
# Restore cursor and clear screen on ctrl+c # Restore cursor and clear screen on ctrl+c
@ -3058,12 +3064,12 @@ main() {
[ "$scrot" == "on" ] && takescrot [ "$scrot" == "on" ] && takescrot
# Show error messages # Show error messages
[ "$verbose" == "on" ] && printf "%s" "$err" [ "$verbose" == "on" ] && printf "%b%s" "$err"
# Reset exit status of the tests above # Reset exit status of the tests above
printf "%s" printf "%s"
} }
main main "$@"
# }}} # }}}