summaryrefslogtreecommitdiff
path: root/src (unfollow)
Commit message (Collapse)AuthorFilesLines
9 daysAccept getopts-style attached -pPROFILE againEuAndreh1-1/+4
Via gobang.ExpandBundles("p:", argv), now that it understands optstring value flags: -pp1 expands to -p p1 before stdlib flag parsing, and nothing after "--" is expanded, so the wrapped command's own argv passes through byte-for-byte. signals.sh goes back to its original attached-form invocations, which now double as the compat test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
9 daysRewrite remembering in GoEuAndreh3-165/+338
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 <noreply@anthropic.com>
2023-04-02aux/checks/repo.sh: WIP Fix testsEuAndreh1-1/+1
Notes: See CI logs with: git notes --ref=refs/notes/ci-logs show 22a7b4f0c8e018077984d58476a0c419b5e11942 git notes --ref=refs/notes/ci-data show 22a7b4f0c8e018077984d58476a0c419b5e11942 Exit status: 2 Duration: 7
2022-11-25Refactor: rewrite logic to make it simpler and fasterEuAndreh1-70/+85
2022-11-08src/remembering.in: Use indented heredoc for usage() and help()EuAndreh1-9/+14
2022-11-08src/remembering.in: Remove hyphen between name and versionEuAndreh1-1/+1
Also use the @NAME@ placeholder over the hard-coded "remembering" value. Update tests/clip-opts.sh to match.
2022-11-08src/: Remove C filesEuAndreh7-577/+0
2021-09-08src/remembering.in: Add trailing "/remembering" to the value defined in ↵EuAndreh1-1/+1
$XDG_DATA_HOME
2021-09-05Makefile: Generate src/config.h from src/config.h.inEuAndreh1-0/+9
2021-09-02src/remembering.c: Stick (mostly) to 80 columnsEuAndreh1-7/+13
2021-09-02src/remembering.c: prevent free() of unitialized valueEuAndreh1-1/+1
2021-09-01src/remembering.c: Enforce C styleEuAndreh1-10/+20
2021-09-01Refactor C files, split logerr and tests-libEuAndreh6-11/+145
2021-09-01mv src/remembering-c.c src/remembering.cEuAndreh1-0/+0
2021-09-01src/remembering.in: Add empty line on help textEuAndreh1-0/+1
2021-06-28src/remembering-c.c: Free leaking "home" string variableEuAndreh1-0/+1
2021-06-28src/remembering-c.c: Fix usage of strcat()EuAndreh1-5/+5
As it turns out, after doing a malloc(), strcat() can't be used directly on top of it. I'd guess that the implementation of strcat() goes through the first string until its end, the \0 NULL terminator, and then starts copying the characters to the new string, overwriting the existing terminator to allow the string to actually be continuous. However, strcat() can't do this in a string that was just malloced and has no content. So it will probably run over the end of the memory untill it finds a NULL byte, and concatenate starting from that. I didn't check this elsewhere, but this explanation sounds reasonable, and Valgrind's diagnostics seem to confirm that. The solution is to strcpy() the first string, and than strcat() the others after that, so that strcat() has an existing string to work on, while strcpy doesn't need that. Fixes #task-bd165b74-c559-48ee-1d29-eaa906aa0393.
2021-06-28src/remembering-c.c: Use better grouping of parentheses for strcmp()EuAndreh1-1/+1
2021-06-27src/unit-test.h: Make its output equal to aux/tests-lib.shEuAndreh1-1/+1
2021-06-27src/remembering-c.c: Add tests for mkdir_p()EuAndreh1-3/+49
2021-06-27src/remembering-c.c: Mark as static two functions leftEuAndreh1-2/+2
2021-06-27src/remembering-c.c: Add mkdir_pEuAndreh1-4/+52
2021-06-27src/remembering-c.c: Provide more precise location of errors for perror()EuAndreh1-6/+6
2021-06-27src/remembering-c.c: Add unit tests for get_profile_file()EuAndreh2-5/+164
Those tests led me to handling the case where $XDG_DATA_HOME was set, but as an empty string. This is the equivalent of the "[ -z ".." ]" test. I also parameterized get_profile_file() to receive the stream where it should write to in case of failing to getenv("HOME"). Even though this makes the arguments of functions that print longer, it looks like an overall good pattern. It is the equivalent of every sh function printing to STDOUT, and let the caller decide if it should go to STDOUT or STDERR.
2021-06-27src/remembering-c.c: Add get_profile_file()EuAndreh1-0/+54
2021-06-27src/remembering-c.c: Mark all functions as staticEuAndreh1-3/+3
2021-06-27src/remembering.in: Stop ignoring unrecognized flagsEuAndreh1-1/+2
2021-06-27src/remembering.in: Don't look for --help and --version flags after --EuAndreh1-8/+16
2021-06-27src/remembering.in: Fix ShellCheck offense, remove disableEuAndreh1-2/+1
2021-06-27src/remembering.in: Better instruction on looking at manpage in help stringEuAndreh1-1/+1
2021-06-27src/remembering.in: Fix syntax of help string output optionsEuAndreh1-2/+2
2021-06-27src/remembering-c.c: Restart C versionEuAndreh1-899/+66
2021-06-26git mv src/remembering.sh src/remembering.inEuAndreh1-0/+0
2021-06-26git mv src/remembering.c src/remembering-c.cEuAndreh1-0/+0
2021-06-26src/remembering.c: Comment existing codeEuAndreh1-7/+7
2021-06-13src/remembering.sh: Remove \" from COMMAND in help textEuAndreh1-2/+2
2021-06-13src/remembering.sh: Choose output only at the topEuAndreh1-3/+3
2021-06-13src/remembering.sh: Use printf over echoEuAndreh1-3/+3
2021-06-13src/remembering.sh: Remove verbose "exit 0" in favor of "exit"EuAndreh1-2/+2
2021-06-13src/remembering.sh: Use "cat <<EOF" for printing help stringEuAndreh1-6/+7
2021-06-07src/remembering.c: Use tabs over spacesEuAndreh1-637/+688
2021-06-06src/remembering.sh: Use tabs for separating options columnsEuAndreh1-4/+4
2021-06-06mv src/remembering.in src/remembering.shEuAndreh1-0/+0
2021-03-23src/remembering.c: clang-formatEuAndreh1-42/+42
2021-03-22src/remembering.c: WIP more tests for mkdir_pEuAndreh1-5/+81
2021-03-10src/remembering.c: clang-formatEuAndreh1-13/+13
2021-03-10src/remembering.c: Write more tests, make existing tests more robustEuAndreh1-62/+250
2021-03-10Support --version flagEuAndreh1-1/+8
2021-03-07src/remembering.c: Add tests for negative and floating-point numbers in the ↵EuAndreh1-0/+12
profile lines
2021-03-07src/remembering.c: Be more explicit on manpage pointerEuAndreh1-1/+1