Fix ShellCheck findings in Bash CLI libraries#7
Merged
codeforester merged 2 commits intomainfrom Apr 15, 2026
Merged
Conversation
Clean up the remaining ShellCheck issues reported by CI across the Bash
wrapper, shared env bootstrap, and Bash libraries.
Changes include:
- add Bash shell directives/shebangs where ShellCheck could not infer the shell
- export BANYAN_BASH_BOOTSTRAP_SOURCE before sourcing stdlib from bash-wrapper
- rewrite lib_file status checks so command results are checked directly
- quote the Git upstream ref '@{u}' in lib_git
- replace a nameref assignment in git_get_current_branch with printf -v
- split __SCRIPT_DIR__ declaration and assignment in lib_std
- avoid masked return values and unquoted exits in lib_std
- make safe_mkdir and safe_truncate ShellCheck-friendly
- tighten pushd/popd handling in stdlib and git helpers
- simplify banyanenv sourced-error handling
Validation:
- bash -n over CLI shell scripts
- full BATS suite: 98 tests, 0 failures, 1 skipped
Make the stdlib BATS pseudo-TTY helper portable across macOS and
GitHub Actions Linux runners.
The TTY-related stdlib tests used BSD/macOS `script` syntax:
script -q /dev/null <command> ...
That works locally on macOS but fails on Ubuntu GitHub Actions, where
`script` is provided by util-linux and expects the command via `-c`.
Update `run_tty_script` to:
- skip TTY tests when `script` is unavailable
- detect util-linux `script` via `script --version`
- use `script -q -e -c "<command>" /dev/null` on Linux
- keep the existing BSD/macOS invocation for local runs
This fixes CI failures for:
- `is_interactive is true when run through a tty`
- `color initialization honors tty mode when --color is passed`
- `print_tty emits output when a tty is present`
Validation:
- full BATS suite: 98 tests, 0 failures, 1 skipped
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clean up the remaining ShellCheck issues reported by CI across the Bash wrapper, shared env bootstrap, and Bash libraries.
Changes include:
Validation: