Browse Source

fzmp: use -v to test if variables exist rather than -n for non-empty strings

pull/6/head
DanielFGray 4 years ago
parent
commit
c9dd3faf91
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      fzmp

+ 4
- 4
fzmp View File

@@ -71,13 +71,13 @@ fzf() {
parseConfigFile() {
local default_view format fzf_options
source "$config_file" || die 'error reading configuration file'
case "$default_view" in
[[ -v default_view ]] && case "$default_view" in
playlist) filter='filterPlaylist' ;;
songs) filter='filterAllSongs' ;;
artists) filter='filterByArtist' ;;
esac
[[ -n "$format" ]] && track_format="$format"
[[ ! -v FZMP_FZF_OPTIONS && -n "$fzf_options" ]] && FZMP_FZF_OPTIONS="$fzf_options"
[[ -v format ]] && track_format="$format"
[[ ! -v FZMP_FZF_OPTIONS && -v fzf_options ]] && FZMP_FZF_OPTIONS="$fzf_options"
}

filterAllSongs() {
@@ -190,6 +190,6 @@ while :; do
done

has -v fzf mpc || die
isRunning mpd || [[ -n "$MPD_HOST" ]] || die "can't connect to mpd"
isRunning mpd || [[ ! -v MPD_HOST ]] || die "can't connect to mpd"

$filter

Loading…
Cancel
Save