Added '--config off' and '--config none' to disable config files at launch
This commit is contained in:
parent
f86b796a5c
commit
c99d472ebb
3 changed files with 27 additions and 11 deletions
3
1.1.md
3
1.1.md
|
@ -13,7 +13,8 @@
|
||||||
- Fetch now has a config file that you can share with people and<br \>
|
- Fetch now has a config file that you can share with people and<br \>
|
||||||
keep between script versions!
|
keep between script versions!
|
||||||
- Added `--config` and `$config_file` to specify a custom config location.
|
- Added `--config` and `$config_file` to specify a custom config location.
|
||||||
- Added `$config` to enable / disable config files
|
- Added `--config off`, `--config none` and `$config` to enable / disable config files<br \>
|
||||||
|
at launch or in script.
|
||||||
|
|
||||||
|
|
||||||
### Info
|
### Info
|
||||||
|
|
|
@ -184,7 +184,7 @@ alias fetch2="fetch \
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
|
||||||
usage: ${0##*/} --option "value" --option
|
usage: ${0##*/} --option "value"
|
||||||
|
|
||||||
Info:
|
Info:
|
||||||
--osx_buildversion Hide/Show Mac OS X build version.
|
--osx_buildversion Hide/Show Mac OS X build version.
|
||||||
|
@ -257,9 +257,9 @@ alias fetch2="fetch \
|
||||||
|
|
||||||
Ascii:
|
Ascii:
|
||||||
--ascii Where to get the ascii from, Possible values:
|
--ascii Where to get the ascii from, Possible values:
|
||||||
'distro', '/path/to/ascii'
|
distro, /path/to/ascii
|
||||||
--ascii_color Color to print the ascii art
|
--ascii_color Color to print the ascii art
|
||||||
--ascii_distro distro Which Distro's ascii art to print
|
--ascii_distro distro Which Distro\'s ascii art to print
|
||||||
|
|
||||||
|
|
||||||
Screenshot:
|
Screenshot:
|
||||||
|
@ -269,6 +269,8 @@ alias fetch2="fetch \
|
||||||
--scrot_cmd Screenshot program to launch
|
--scrot_cmd Screenshot program to launch
|
||||||
|
|
||||||
Other:
|
Other:
|
||||||
|
--config Specify a path to a custom config file
|
||||||
|
--config none Launch the script without a config file
|
||||||
--help Print this text and exit
|
--help Print this text and exit
|
||||||
|
|
||||||
|
|
||||||
|
|
27
fetch
27
fetch
|
@ -1744,6 +1744,7 @@ getscriptdir () {
|
||||||
|
|
||||||
# Check for $config_file first
|
# Check for $config_file first
|
||||||
getconfig () {
|
getconfig () {
|
||||||
|
# Check $config_file
|
||||||
if [ -f "$config_file" ]; then
|
if [ -f "$config_file" ]; then
|
||||||
source "$config_file"
|
source "$config_file"
|
||||||
return
|
return
|
||||||
|
@ -1768,6 +1769,14 @@ getconfig () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check the commandline flags early for '--config none/off'
|
||||||
|
case "$@" in
|
||||||
|
*"--config off"* | *'--config "off"'* | *"--config 'off'"* | \
|
||||||
|
*"--config none"* | *'--config "none"'* | *"--config 'none'"*)
|
||||||
|
config="off"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# If config files are enabled
|
# If config files are enabled
|
||||||
[ "$config" == "on" ] && getconfig
|
[ "$config" == "on" ] && getconfig
|
||||||
|
|
||||||
|
@ -1868,6 +1877,8 @@ usage () { cat << EOF
|
||||||
--scrot_cmd Screenshot program to launch
|
--scrot_cmd Screenshot program to launch
|
||||||
|
|
||||||
Other:
|
Other:
|
||||||
|
--config Specify a path to a custom config file
|
||||||
|
--config none Launch the script without a config file
|
||||||
--help Print this text and exit
|
--help Print this text and exit
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
@ -1926,9 +1937,7 @@ while [ "$1" ]; do
|
||||||
[ -z "$2" ] && image="ascii"
|
[ -z "$2" ] && image="ascii"
|
||||||
|
|
||||||
case "$2" in
|
case "$2" in
|
||||||
"--"*)
|
"--"*) image="ascii" ;;
|
||||||
image="ascii"
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -1949,9 +1958,7 @@ while [ "$1" ]; do
|
||||||
[ -z "$2" ] && ascii="distro"
|
[ -z "$2" ] && ascii="distro"
|
||||||
|
|
||||||
case "$2" in
|
case "$2" in
|
||||||
"--"*)
|
"--"*) ascii="distro" ;;
|
||||||
ascii="distro"
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -1964,7 +1971,13 @@ while [ "$1" ]; do
|
||||||
--scrot_cmd) scrot_cmd="$2" ;;
|
--scrot_cmd) scrot_cmd="$2" ;;
|
||||||
|
|
||||||
# Other
|
# Other
|
||||||
--config) config_file="$2"; getconfig ;;
|
--config)
|
||||||
|
case "$2" in
|
||||||
|
"none" | "off") config="off" ;;
|
||||||
|
*) config_file="$2"; config="on"; getconfig ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
|
||||||
--help) usage ;;
|
--help) usage ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue