Filter functionality and keys
This commit is contained in:
20
src/main.sh
20
src/main.sh
@@ -30,6 +30,9 @@ MODE_INSERT="show"
|
||||
# Load keys
|
||||
. "sh/keys.sh"
|
||||
|
||||
# Load filters
|
||||
. "sh/filter.sh"
|
||||
|
||||
# Load AWK scripts
|
||||
. "sh/awk.sh"
|
||||
|
||||
@@ -86,6 +89,14 @@ case "${1:-}" in
|
||||
esac
|
||||
exit 0
|
||||
;;
|
||||
"--filter")
|
||||
mode=$2
|
||||
view=$3
|
||||
q="$(default_query "$view" "$FZF_KEY")"
|
||||
printf "show-input+change-query(%s )" "$q"
|
||||
[ "$mode" = "$MODE_NORMAL" ] && printf "+hide-input"
|
||||
exit 0
|
||||
;;
|
||||
"--jumpto-artist")
|
||||
mode=$2
|
||||
view=$3
|
||||
@@ -100,9 +111,7 @@ case "${1:-}" in
|
||||
if [ "${j:-}" ]; then
|
||||
cnt=$(echo "$j" | $JQ 'length')
|
||||
[ "$cnt" -eq 1 ] && aid="$(echo "$j" | $JQ -r '.[0].artist.id')"
|
||||
debug "cnt=$cnt; artistid=${artistid:-}"
|
||||
fi
|
||||
[ "${aid:-}" ] && debug "$0 --draw \"$mode\" \"$VIEW_ARTIST\" \"$aid\"" || debug "$(printf "print(%s)+print(%s)+accept" "$VIEW_SELECT_ARTIST" "$j")"
|
||||
[ "${aid:-}" ] && $0 --draw "$mode" "$VIEW_ARTIST" "$aid" || printf "print(%s)+print(%s)+accept" "$VIEW_SELECT_ARTIST" "$j"
|
||||
exit 0
|
||||
;;
|
||||
@@ -179,11 +188,7 @@ case "${1:-}" in
|
||||
*) ;;
|
||||
esac
|
||||
# Set initial query
|
||||
case "$view" in
|
||||
"$VIEW_ARTIST") q="!'$QUERY_HAS_SECONDARY' " ;;
|
||||
"$VIEW_RELEASEGROUP") [ "$QUERY_RV" ] && q="'$QUERY_RV' " || q="" ;;
|
||||
esac
|
||||
printf "show-input+change-query(%s)" "${q:-}"
|
||||
printf "show-input+change-query(%s )" "$(default_query "$view")"
|
||||
# Store current state
|
||||
printf "+change-border-label(%s)+change-list-label(%s)" "$view" "$mbid"
|
||||
# Set header
|
||||
@@ -460,6 +465,7 @@ esac" \
|
||||
\"$VIEW_SEARCH_ARTIST\") $0 --draw $MODE_NORMAL $VIEW_LIST_ARTISTS ;;
|
||||
\"$VIEW_SEARCH_ALBUM\") $0 --draw $MODE_NORMAL $VIEW_LIST_ALBUMS ;;
|
||||
esac" \
|
||||
--bind="$KEYS_FILTER:transform:$0 --filter $FZF_CURRENT_MODE $FZF_CURRENT_VIEW" \
|
||||
--bind="$KEYS_BROWSE:execute-silent:
|
||||
[ {3} ] || exit 0
|
||||
case \"\$FZF_BORDER_LABEL\" in
|
||||
|
Reference in New Issue
Block a user