better argument handling. closes #135
This commit is contained in:
parent
99ba07c5cd
commit
13fd601d0b
29
pfetch
29
pfetch
|
@ -1742,16 +1742,29 @@ get_ascii() {
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
[ "$1" = --version ] && {
|
case $* in
|
||||||
printf 'pfetch 0.7.0\n'
|
-v)
|
||||||
exit 0
|
printf '%s 0.7.0\n' "${0##*/}"
|
||||||
}
|
return 0
|
||||||
|
;;
|
||||||
|
|
||||||
# Hide 'stderr' unless the first argument is '-v'. This saves
|
-d)
|
||||||
# polluting the script with '2>/dev/null'.
|
# Below exec is not run, stderr is shown.
|
||||||
[ "$1" = -v ] || {
|
;;
|
||||||
|
|
||||||
|
'')
|
||||||
exec 2>/dev/null
|
exec 2>/dev/null
|
||||||
}
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
cat <<EOF
|
||||||
|
${0##*/} show system information
|
||||||
|
${0##*/} -d show stderr (debug mode)
|
||||||
|
${0##*/} -v show version information
|
||||||
|
EOF
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Hide 'stdout' and selectively print to it using '>&6'.
|
# Hide 'stdout' and selectively print to it using '>&6'.
|
||||||
# This gives full control over what it displayed on the screen.
|
# This gives full control over what it displayed on the screen.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user