From 46fd0362bce11d709e5efe6d540358533985d363 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Jun 2026 09:19:28 -0300 Subject: Rewrite remembering in Go The shell pipeline (sed | sort | tee | awk | sort | cut | "$@" plus the cut | uniq | awk profile rewrite) becomes a single static binary with the same observable behaviour, pinned by the original ranking.sh, signals.sh and cli-opts.sh suites, now aimed at remembering.bin: - the profile keeps the exact on-disk format, COUNT profile TEXT, byte-sorted with new picks appended at 1 and offered-but-never- picked entries persisted at 0; - the menu stays count-descending with byte-order ties, stdin alone defines what is offered, and duplicate profile lines sum for ranking but collapse to the highest count on rewrite, as sort | uniq -f1 did; - the wrapped command's exit status is forwarded as-is (128+sig for signal deaths), its stderr passes through, and an empty pick learns nothing; - the profile rewrite stays atomic via .tmp plus rename. Per the house CLI conventions, -h/-V/--help/--version are gone (the manpage is the documentation; bad options print the usage on stderr and exit 2), and getopts-style attached option arguments (-pNAME) are not accepted any more --- no script in the wild used them. The project layout follows rot: raw go tool compile/link Makefile, mkdeps.sh-generated deps.mk, white-box unit suite, fuzz target over the profile parse/serialize roundtrip, functional pick roundtrip, a 1M-line ranking benchmark, and a single English asciidoc manpage absorbing the old .5 page; the po4a/aux release machinery goes away. Co-Authored-By: Claude Fable 5 --- mkdeps.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 mkdeps.sh (limited to 'mkdeps.sh') diff --git a/mkdeps.sh b/mkdeps.sh new file mode 100644 index 0000000..d7d2f06 --- /dev/null +++ b/mkdeps.sh @@ -0,0 +1,32 @@ +#!/bin/sh +set -eu + +export LANG=POSIX.UTF-8 + + +libs() { + find src tests -name '*.go' | + grep -Ev '/(main|meta)\.go$' +} + +mains() { + find src tests -name '*.go' | grep '/main\.go$' +} + + +libs | varlist 'libs.go' +mains | varlist 'mains.go' + +find doc -name '*.adoc' | varlist 'manpages.adoc' + +find tests/functional/*/*.go -not -name main.go | varlist 'functional/lib.go' +find tests/functional/*/main.go | varlist 'functional/main.go' +find tests/fuzz/*/*.go -not -name main.go | varlist 'fuzz/lib.go' +find tests/fuzz/*/main.go | varlist 'fuzz/main.go' +find tests/benchmarks/*/*.go -not -name main.go | varlist 'benchmarks/lib.go' +find tests/benchmarks/*/main.go | varlist 'benchmarks/main.go' + +{ libs; mains; } | sort | sed 's/^\(.*\)\.go$/\1.a:\t\1.go/' +mains | sort | sed 's/^\(.*\)\.go$/\1.bin:\t\1.a/' +mains | sort | sed 's/^\(.*\)\.go$/\1.bin-check:\t\1.bin/' +mains | sort | sed 's|^\(.*\)/main\.go$|\1/main.a:\t\1/$(NAME).a|' -- cgit v1.3