Skip to content

feat: install and update bat like the other tools - #57

Merged
YASoftwareDev merged 2 commits into
masterfrom
feat/bat
Sep 19, 2026
Merged

YASoftwareDev merged 2 commits into
masterfrom
feat/bat

Conversation

@YASoftwareDev

Copy link
Copy Markdown
Owner

What

bat is now installed, updated and tested like every comparable tool. It was
absent from this repo entirely - not in the apt list, not in _KNOWN_TOOLS, no
installer, 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 bat but installs the binary as batcat
(the name was already taken). So has bat is false after a successful apt install,
and an installer that only checks bat would refetch it forever, while an
installer that treats batcat as "installed" would leave no bat on PATH at all.

fd/fdfind has exactly this shape and the repo already solved it, so this
follows that precedent: both names count as present, and a shim is created in
both install_base and install_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_bat self-skips and that
path 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.sh only checked tmux generically.
It is now checked strictly in ~/.local/bin alongside the other no-sudo binaries.

check_local_bin takes a version flag for this, because tmux --version prints its
usage 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, apt
path. The shim fired:

/root/.local/bin/bat -> /usr/bin/batcat

bash ci-local.sh --ubuntu 24.04 --profile nosudo-auto - PASS 1/1, GitHub path:

✓  bat   →  /home/user/.local/bin/bat   (bat 0.26.1 (979ba22))
✓  tmux  →  /home/user/.local/bin/tmux  (tmux 3.5a)

(and the -V flag renders tmux 3.5a, not the usage text.)

Red-proofs, both on the built image:

mutation result
rm ~/.local/bin/bat test_rc=1, bat / batcat not found + bat not found in ~/.local/bin
rm ~/.local/bin/tmux test_rc=1, 3 findings

bash test.sh workstation 62/63, 0 failures, 1 skip. shellcheck clean (the SC2088
warnings it prints are pre-existing, on lines this PR does not touch).

A measurement note

While checking the shim I first read command -v bat inside bash -lc in the
image, saw nothing, and briefly concluded the shim had not fired. It had - the file
was there; ~/.local/bin simply is not on PATH in that shell, because .zshrc sets
it and test.sh exports it explicitly. Checking the file rather than command -v
is the reliable form, and this is the second time that context has misled me in this
work.

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.
@YASoftwareDev
YASoftwareDev merged commit 365a5cf into master Sep 19, 2026
30 checks passed
@YASoftwareDev
YASoftwareDev deleted the feat/bat branch September 19, 2026 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants