File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,7 +34,9 @@ file already depends on them. Follow the existing editor hints: 2-space
3434indentation, no tabs, and an approximately 79-character text width. Public
3535functions in ` lib/base.sh ` are unprefixed, internal helpers use ` base_ ` , and
3636global variables use the ` BASE_ ` prefix. Keep new test files aligned with the
37- current pattern, for example ` app/test-realpath-ok ` .
37+ current pattern, for example ` app/test-realpath-ok ` . Write comments in
38+ third-person singular, and place a vertical gap before standalone comment lines
39+ inside function bodies.
3840
3941## Testing Guidelines
4042
Original file line number Diff line number Diff line change @@ -128,9 +128,9 @@ The public functions are, in alphabetical order:
128128{url-base}#L866[`validate_cmd`],
129129{url-base}#L873[`validate_var`],
130130{url-base}#L880[`var_exists`],
131- {url-base}#L914 [`ver_ge`],
132- {url-base}#L922 [`vid2aud`],
133- {url-base}#L936 [`ytda`].
131+ {url-base}#L916 [`ver_ge`],
132+ {url-base}#L924 [`vid2aud`],
133+ {url-base}#L938 [`ytda`].
134134
135135Global variables have the `BASE_` prefix and can be used by clients.
136136Clients should place temporary files under `$BASE_WIP`.
Original file line number Diff line number Diff line change @@ -7,15 +7,16 @@ set -- "$@" --quiet
77BSH=" $(
88 CDPATH=' ' cd -- " $( dirname -- " $0 " 2>&1 ) " 2>&1 && pwd -P 2>&1
99) " /../lib/base.sh || {
10- # Capture status before printf; local is invalid outside functions.
10+
11+ # Captures status before printf; local is invalid outside functions.
1112 err=$?
1213 printf >&2 %s\\ n " $BSH "
1314 exit " $err "
1415}
1516
1617# shellcheck disable=SC2034 # Variable appears unused.
1718readonly \
18- BASE_APP_VERSION=0.9.20260402 \
19+ BASE_APP_VERSION=0.9.20260409 \
1920 BASE_MIN_VERSION=0.9.20240831 \
2021 BSH \
2122 DST=/usr/local/bin \
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ BASE_RC_CON_NO=14
4747BASE_RC_CON_TO=13
4848BASE_RC_DIE_NO=10
4949BASE_SHOULD_CON=false
50- BASE_VERSION=0.9.20260407
50+ BASE_VERSION=0.9.20260409
5151
5252# Removes any file besides mp3, m4a, flac in the current directory.
5353# Removes empty directories.
@@ -880,6 +880,7 @@ validate_var() {
880880var_exists () {
881881 local arg ret=0 var
882882 for arg; do
883+
883884 # Accepts only POSIX identifiers: [A-Za-z_][A-Za-z0-9_]*.
884885 case " $arg " in
885886 ' ' | [!A-Za-z_]* | * [!A-Za-z0-9_]* )
@@ -888,6 +889,7 @@ var_exists() {
888889 continue
889890 ;;
890891 esac
892+
891893 # ${name-} expands to empty when name is undefined and avoids nounset
892894 # failures under set -o nounset.
893895 eval " var=\$ {$arg -}" || {
@@ -1389,6 +1391,7 @@ for arg; do
13891391 -x | --execute) set -x ;;
13901392 -y | --yes) BASE_SHOULD_CON=true ;;
13911393 * )
1394+
13921395 # If an argument is not skipped, sets it back to all.
13931396 if [ $skp = false ]; then
13941397 set -- " $@ " " $arg "
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ BSH="$(
1313
1414# shellcheck disable=SC2034 # Variable appears unused.
1515readonly \
16- BASE_APP_VERSION=0.9.20250819 \
16+ BASE_APP_VERSION=0.9.20260409 \
1717 BASE_MIN_VERSION=0.9.20231228 \
1818 BSH
1919set -- "$@" --quiet
@@ -27,6 +27,7 @@ for sh in ash bash dash fish ksh oksh tcsh yash zsh; do
2727 "$sh" -c "$ok 2>&1" || die "$ok" on "$sh" returns negative.
2828 done
2929 for no in ./app/*-no; do
30+
3031 # shellcheck disable=SC2015 # A && B || C.
3132 "$sh" -c "$no 2>&1" && die "$no" on "$sh" returns positive. || :
3233 done
You can’t perform that action at this time.
0 commit comments