More minor work
This commit is contained in:
		
							
								
								
									
										17
									
								
								ptgdp
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								ptgdp
									
									
									
									
									
								
							@@ -7,8 +7,14 @@
 | 
			
		||||
#
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
# Import user-dirs.dirs
 | 
			
		||||
_xdguserdirs="${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs"
 | 
			
		||||
[ -z "$XDG_MUSIC_DIR" ] && [ -r "$_xdguserdirs" ] && source "$_xdguserdirs"
 | 
			
		||||
unset _xdguserdirs
 | 
			
		||||
# Read-only set-once variables
 | 
			
		||||
declare -r _name="$(basename -- "$0")"
 | 
			
		||||
declare -r _musicdir="${XDG_MUSIC_DIR:-$HOME/Music}"
 | 
			
		||||
declare -r _ptgdpmusicdir="$_musicdir/PTGDP Songs"
 | 
			
		||||
declare -ra _supportedbackends=("mpd")
 | 
			
		||||
# Options
 | 
			
		||||
declare -A _config=(
 | 
			
		||||
@@ -18,9 +24,10 @@ declare _optconfigfile="${XDG_CONFIG_HOME:-$HOME/.config}/${_name}.conf"
 | 
			
		||||
declare -i _opthelp
 | 
			
		||||
declare -i _optverbose=0
 | 
			
		||||
# Working variables
 | 
			
		||||
declare -a _args
 | 
			
		||||
declare _return
 | 
			
		||||
 | 
			
		||||
# Helper Functions
 | 
			
		||||
# Helper functions
 | 
			
		||||
log() {
 | 
			
		||||
	# Print a line to the terminal if _optverbose is greater than $2
 | 
			
		||||
	# $2 defaults to 0
 | 
			
		||||
@@ -52,6 +59,9 @@ has() {
 | 
			
		||||
	return 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# More complex helper functions
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Core program functions
 | 
			
		||||
printhelp() {
 | 
			
		||||
	cat << EOF
 | 
			
		||||
@@ -103,6 +113,11 @@ main() {
 | 
			
		||||
			fi
 | 
			
		||||
		done < "$_optconfigfile"
 | 
			
		||||
	fi
 | 
			
		||||
	# Store arguments
 | 
			
		||||
	shift $((OPTIND - 1))
 | 
			
		||||
	for arg in "$@"; do
 | 
			
		||||
		_args+=("$arg")
 | 
			
		||||
	done
 | 
			
		||||
	# Validate critical options
 | 
			
		||||
	(
 | 
			
		||||
		for backend in ${_supportedbackends[@]}; do
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user