Added '--disable' to disable info from printing at launch, see 1.1.md for more info

This commit is contained in:
Dylan 2016-02-01 18:50:10 +11:00
parent ee58843497
commit 7609445b89
3 changed files with 37 additions and 1 deletions

9
1.1.md
View File

@ -37,6 +37,15 @@ the distro ascii art and the automatic config creation.
### Info
- Added `--disable` which allows you to stop an info line from appearing at launch.<br \>
This works by using `unset -f` on the function causing it to not exist giving us<br \>
a blank output.
```sh
# Stop cpu, gpu, disk and shell functions from being called
fetch --disable cpu gpu disk shell
```
**Kernel:**
- Added `--kernel_shorthand` and `$kernel_shorthand` to print less or more kernel info

View File

@ -213,6 +213,10 @@ alias fetch2="fetch \
usage: ${0##*/} --option "value"
Info:
--disable infoname Allows you to disable an info line from
appearing in the output.
NOTE: You can supply multiple args. eg.
'fetch --disable cpu gpu disk shell'
--os_arch on/off Hide/Show Windows architecture.
--osx_buildversion Hide/Show Mac OS X build version.
--speed_type Change the type of cpu speed to display.

25
fetch
View File

@ -1703,11 +1703,15 @@ info () {
if [ -z "$2" ]; then
"get$1" 2>/dev/null
eval output="\$${1}"
else
"get$2" 2>/dev/null
eval output="\$${2}"
fi
# If the output is empty, don't print anything
[ -z "$output" ] && return
case "$1" in
title)
string="${bold}${title_color}${output}"
@ -1799,7 +1803,7 @@ bold () {
# Linebreak {{{
getlinebreak () {
linebreak=""
linebreak=" "
}
# }}}
@ -1875,6 +1879,20 @@ esac
# }}}
# Unset function {{{
unset_func () {
for func in "$@"; do
case "$func" in
"--disable") continue ;;
"--"*) return ;;
*) unset -f "get$func" ;;
esac
done
}
#}}}
# }}}
@ -1887,6 +1905,10 @@ usage () { cat << EOF
usage: ${0##*/} --option "value"
Info:
--disable infoname Allows you to disable an info line from
appearing in the output.
NOTE: You can supply multiple args. eg.
'fetch --disable cpu gpu disk shell'
--osx_buildversion Hide/Show Mac OS X build version.
--os_arch on/off Hide/Show Windows architecture.
--speed_type Change the type of cpu speed to display.
@ -1989,6 +2011,7 @@ exit 1
while [ "$1" ]; do
case $1 in
# Info
--disable) unset_func "$@" ;;
--os_arch) os_arch="$2" ;;
--osx_buildversion) osx_buildversion="$2" ;;
--speed_type) speed_type="$2" ;;