# Uncomment this when developing this file for quick shellcheck results,
# otherwise it is redundant.
-. /a/c/fsf-script-lib
+#. /a/c/fsf-script-lib
# Must be called from beetag for variables to be setup
beetag-help() {
# Call from beetag. Queries our songlist and parses it into variables.
#
-# Sets ls_lines, id_count, paths, ids
+# Sets ls_lines, id_count, ls_paths, ids
#
# Input vars: pl_tags, pl_seed_path, random, beet_query
beetag-ls-setup() {
id_count=${#ls_out[@]}
for line in "${ls_out[@]}"; do
- paths+=("${line#*PijokVipiotOzeph }")
+ ls_paths+=("${line#*PijokVipiotOzeph }")
line_no_path="${line% PijokVipiotOzeph*}"
ids+=("${line_no_path##* }")
right_pad="${line_no_path%% |*}"
fi
}
+# Call from beetag. Run after printing a list of tracks, then this
+# prompts the user and for one and processes the input.
+#
# Input vars: j, skip_start
#
# Output vars: j, got_track
# constants
local escape_char pl_state_path pl_seed_path
- local -ar buttons=( {a..i} {l..p} {r..w} {6..8} , . / - "=" '\' )
+ local -ar buttons=( {a..i} {l..p} {r..w} {6..8} , . / - "=" \\ )
# song list vars:
- local -a ids ls_lines paths
+ local -a ids ls_lines ls_paths
local -i id_count
# current song vars:
# misc vars
local char_i escaped_input new_item seek_sec
local -i scrolled=999 # more than any $LINES
- local -i i ret line_int skip_start pre_j_count skip_lookback overflow_lines overflow
+ local -i i ret line_int skip_start skip_lookback overflow_lines overflow
### begin arg processing ###
random=false
while true; do
id=${ids[j]}
- path="${paths[$j]}"
+ path="${ls_paths[$j]}"
ls_out="${ls_lines[j]}"
tags=( ${ls_out%%,*} )
beetag-help
sk-p() {
[[ ! -L $f ]] && istext "$1" && [[ $(head -n1 "$1" 2>/dev/null) == '#!/bin/bash'* ]]
}
+shellcheck-except() {
+ local quotes others
+ quotes=2048,2064,2068,2086,2119,2206,2254,2231
+ others=2029,2032,2033,2054,2164,2317
+ shellcheck -e $quotes,$others "$@" || return $?
+}
# wrapper for shellcheck with better defaults.
sk() {
# see https://savannah.gnu.org/maintenance/fsf/bash-style-guide/ for justifications
- local quotes others ret
+ local quotes others
+ local -i ret=0
quotes=2048,2064,2068,2086,2119,2206,2254,2231
others=2029,2032,2033,2054,2164,2317
- shellcheck -ax -W 999 -e $quotes,$others "$@" || ret=$?
+ shellcheck-except -ax -W 999 "$@" || ret=$?
if (( ret >= 1 )); then
echo "A template comment to disable is now in clipboard. eg: # shellcheck disable=SC2206 # reason"
cbs "# shellcheck disable=SC"