shellcheck fixes
authorIan Kelling <ian@iankelling.org>
Sat, 1 Mar 2025 23:58:21 +0000 (18:58 -0500)
committerIan Kelling <ian@iankelling.org>
Sat, 1 Mar 2025 23:58:21 +0000 (18:58 -0500)
beet-data
beetag
brc
brc2
fsf-script-lib
shellcheck-this-repo

index 8af190b4e2e82627876505ec7494cda6de935d46..f1e9823f08dda14309b5688f3f5ce7aa28fff36e 100644 (file)
--- a/beet-data
+++ b/beet-data
@@ -49,7 +49,7 @@ pl_tags=(
   lesser_version
 )
 
-
+nav_convert_query="^genre:spoken-w ^genre:skit ^lesser_version:t rating:3..5"
 
 common_genres=(
   ambient
diff --git a/beetag b/beetag
index 846fff4ea53e15a207ed47f2572e9d4567ae5879..392efa63e36c0df700f7fb5eaa19cbf233d7a639 100755 (executable)
--- a/beetag
+++ b/beetag
@@ -22,7 +22,7 @@
 
 # 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() {
@@ -253,7 +253,7 @@ toggle-rare-genres() {
 
 # 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() {
@@ -279,7 +279,7 @@ 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%% |*}"
@@ -318,6 +318,9 @@ beetag-advance-maybe() {
   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
@@ -382,10 +385,10 @@ beetag()  {
 
   # 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:
@@ -401,7 +404,7 @@ beetag()  {
   # 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
@@ -447,7 +450,7 @@ beetag()  {
 
   while true; do
     id=${ids[j]}
-    path="${paths[$j]}"
+    path="${ls_paths[$j]}"
     ls_out="${ls_lines[j]}"
     tags=( ${ls_out%%,*} )
     beetag-help
diff --git a/brc b/brc
index 1c42e799f124f1a97cf2fa390a226c2eb1c15232..214102f4c81da745deb5e02cf36be9858373b572 100644 (file)
--- a/brc
+++ b/brc
@@ -2984,13 +2984,20 @@ sgu() {
 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"
diff --git a/brc2 b/brc2
index 5639e0edb85fcf10a4cfe434d2207064c9e64f0e..bdbe6dbb4f159c4d7b5a3d0136faa448beb62aed 100644 (file)
--- a/brc2
+++ b/brc2
@@ -4650,8 +4650,9 @@ linediff() {
 
 # list count of files in directories
 wc-l-dirs() {
-  for f in "$@"; do
-    e $(ls -1Uq $f| wc -l) $f
+  local dir
+  for dir in "$@"; do
+    e "$(find $dir -maxdepth 1 -type f -printf x | wc -c)" "$dir"
   done | sort -n
 }
 
index 32dcdfbdef57329fc8c4780d9afba66ea4076127..b4767d4504be61f80add7c9537c24f971f908f46 100644 (file)
@@ -53,6 +53,7 @@ uint_regex='^[0-9]+$'
 
 
 # horizontal row. used to break up output
+# shellcheck disable=SC2120 # not a big deal.
 hr() {
   local start end end_count arg
   # 180 is long enough. 5 for start.
index 926797ccc3541a171835825774f52eb72b05d8ae..80ec3f71a2aadd05dfb5606f08bc17dc004ad279 100755 (executable)
@@ -42,4 +42,4 @@ for f in "${ls_files[@]}"; do
   fi
 done
 
-sk "${standard_files[@]}"
+shellcheck-except -x -W 999 "${standard_files[@]}"