Merge pull request #109 from dylanaraps/stdout

Don't create a config file in stdout mode.
This commit is contained in:
Dylan Araps 2016-02-28 09:15:38 +11:00
commit 73a9038fbf

13
fetch
View file

@ -2185,9 +2185,6 @@ getconfig () {
return return
fi fi
# Make the directory if it doesn't exist
mkdir -p "$HOME/.config/fetch/"
# Check $HOME/.config/fetch and create the # Check $HOME/.config/fetch and create the
# dir/files if they don't exist. # dir/files if they don't exist.
if [ -f "$HOME/.config/fetch/config" ]; then if [ -f "$HOME/.config/fetch/config" ]; then
@ -2217,9 +2214,6 @@ case "$@" in
;; ;;
esac esac
# If config files are enabled
[ "$config" == "on" ] && getconfig
# }}} # }}}
@ -2441,7 +2435,7 @@ while [ "$1" ]; do
unset info_color colors unset info_color colors
case "$2" in case "$2" in
"--"* | "") echo "--stdout requires at least one argument"; exit ;; "--"* | "") echo "--stdout requires at least one argument"; exit ;;
*) shift; args=("$@"); stdout ;; *) shift; args=("$@"); config="off" stdout ;;
esac esac
;; ;;
@ -2469,6 +2463,11 @@ done
# Restore cursor and clear screen on ctrl+c # Restore cursor and clear screen on ctrl+c
trap 'printf "\033[?25h"; clear; exit' 2 trap 'printf "\033[?25h"; clear; exit' 2
if [ "$config" == "on" ]; then
mkdir -p "$HOME/.config/fetch/"
getconfig
fi
# Get colors / bold # Get colors / bold
colors colors
bold bold