feat: install and update bat like the other tools - #57
Merged
Merged
Conversation
bat was absent from this repo entirely - not installed, not updated, not tested, and not referenced anywhere - while every comparable tool (rg, fd, jq, zoxide, delta, eza, yazi) was managed. Hosts that needed it were fixed by hand. It follows the fd pattern exactly, including fd's trap: the Debian/Ubuntu package installs the binary as 'batcat', so `has bat` is false and the installer would self-skip forever. Both install_base and install_base_docker create the shim. The docker branch needs it even though its apt list does not ask for bat, because a base image may already carry batcat - without the shim that path would end with no `bat` on PATH at all. test.sh gains a core check (accepting either name) and a strict ~/.local/bin check for the no-sudo profile. tmux joins that strict check too, covering the installer added in 1.12.0; check_local_bin takes a version flag now because tmux prints its usage for --version and that would have been reported as the version string. Verified: ci-local.sh minimal on ubuntu:24.04 (apt path - shim created /root/.local/bin/bat -> /usr/bin/batcat) and nosudo-auto (GitHub path - bat 0.26.1 and tmux 3.5a both strict-checked in ~/.local/bin), both PASS 1/1; test.sh workstation 62/63, 0 failures. Red-proofed: deleting ~/.local/bin/bat fails the suite with 2 findings, deleting tmux with 3.
check_cmd hardcoded --version, and tmux answers that with its usage, so the suite printed 'usage: tmux [-2CDlNuVv]...' where a version belongs - visible in CI right next to the strict check that had already been fixed. Same optional version-flag parameter as check_local_bin; every other caller keeps the --version default.
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.
What
batis now installed, updated and tested like every comparable tool. It wasabsent from this repo entirely - not in the apt list, not in
_KNOWN_TOOLS, noinstaller, no test, and referenced nowhere - while rg, fd, jq, zoxide, delta, eza
and yazi were all managed. Hosts that wanted it were fixed by hand.
The trap this shares with fd
The Debian/Ubuntu package is called
batbut installs the binary asbatcat(the name was already taken). So
has batis false after a successful apt install,and an installer that only checks
batwould refetch it forever, while aninstaller that treats
batcatas "installed" would leave nobaton PATH at all.fd/fdfindhas exactly this shape and the repo already solved it, so thisfollows that precedent: both names count as present, and a shim is created in
both
install_baseandinstall_base_docker.The docker branch needs the shim even though its apt list does not ask for bat - a
base image may already carry
batcat, and then_install_batself-skips and thatpath ends with no
bat. That is a bug this PR would have introduced without it.Also here: tmux joins the strict no-sudo check
1.12.0 added the no-sudo tmux installer but
test.shonly checked tmux generically.It is now checked strictly in
~/.local/binalongside the other no-sudo binaries.check_local_bintakes a version flag for this, becausetmux --versionprints itsusage rather than a version - it would have been reported as the version string.
Verified
bash ci-local.sh --ubuntu 24.04 --profile minimal --skip-nosudo- PASS 1/1, aptpath. The shim fired:
bash ci-local.sh --ubuntu 24.04 --profile nosudo-auto- PASS 1/1, GitHub path:(and the
-Vflag renderstmux 3.5a, not the usage text.)Red-proofs, both on the built image:
rm ~/.local/bin/battest_rc=1,bat / batcat not found+bat not found in ~/.local/binrm ~/.local/bin/tmuxtest_rc=1, 3 findingsbash test.sh workstation62/63, 0 failures, 1 skip. shellcheck clean (the SC2088warnings it prints are pre-existing, on lines this PR does not touch).
A measurement note
While checking the shim I first read
command -v batinsidebash -lcin theimage, saw nothing, and briefly concluded the shim had not fired. It had - the file
was there;
~/.local/binsimply is not on PATH in that shell, because.zshrcsetsit and
test.shexports it explicitly. Checking the file rather thancommand -vis the reliable form, and this is the second time that context has misled me in this
work.