Make script silent/quiet by default

It's common for unix tools to be quiet by default, and verbose by
toggle.
This commit is contained in:
M.B. Christiansen 2022-10-10 11:00:19 +02:00
parent 19fb4c78a1
commit e0a0e9ce1c
1 changed files with 6 additions and 6 deletions

12
kunst
View File

@ -17,7 +17,7 @@ PROG_NAME=$(basename "$0")
show_help() { show_help() {
printf "%s" "\ printf "%s" "\
usage: kunst [-h] [--size \"px\"] [--position \"+x+y\"][--music_dir \"path/to/dir\"] [--silent] [--version] usage: kunst [-h] [--size \"px\"] [--position \"+x+y\"][--music_dir \"path/to/dir\"] [--verbose] [--version]
┬┌─┬ ┬┌┐┌┌─┐┌┬┐ ┬┌─┬ ┬┌┐┌┌─┐┌┬┐
├┴┐│ ││││└─┐ │ ├┴┐│ ││││└─┐ │
@ -29,14 +29,14 @@ optional arguments:
--size what size to display the album art in --size what size to display the album art in
--position the position where the album art should be displayed --position the position where the album art should be displayed
--music_dir the music directory which MPD plays from --music_dir the music directory which MPD plays from
--silent dont show the output --verbose show the output
--force-online force getting cover from the internet --force-online force getting cover from the internet
--version show the version of kunst you are using --version show the version of kunst you are using
" "
} }
log() { log() {
[ ! "$SILENT" ] && echo "$PROG_NAME: $1" [ "$VERBOSE" ] && echo "$PROG_NAME: $1"
} }
logError() { logError() {
@ -46,7 +46,7 @@ logError() {
# Parse the arguments # Parse the arguments
options=$(getopt -o h --long position:,size:,music_dir:,version,force-online,silent,help -- "$@") options=$(getopt -o h --long 'position:,size:,music_dir:,version,force-online,verbose,help' -- "$@")
eval set -- "$options" eval set -- "$options"
while true; do while true; do
@ -74,8 +74,8 @@ while true; do
--force-online) --force-online)
ONLINE_ALBUM_ART=true ONLINE_ALBUM_ART=true
;; ;;
--silent) --verbose)
SILENT=true verbose=true
;; ;;
--) --)
shift shift