Skip to content

refactor/3.5c gnu rest - #247

Merged
sf624 merged 1 commit into
mainfrom
refactor/3.5c-gnu-rest
Oct 23, 2026
Merged

sf624 merged 1 commit into
mainfrom
refactor/3.5c-gnu-rest

Conversation

@sf624

@sf624 sf624 commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Refactor step 3.5 (option parsing), layer 1 of 3.

Addresses: D3 (rest)

  • D3: the other GNU entries use the getopt_long parser, with every long option of their --help: coreutils in every dict file (about 90 entries; not dd, expr), diffutils, gzip/gunzip/zcat and GNU tar. Each is in test/prefixes-real.test.ts's list, which runs the tool for every long option and its shortest unique prefix. The check found value kinds that differed from the tools (od -w, split --numeric-suffixes, the long forms of ls -F, cp -u, tail -f, diff -u, shred -u take an optional value; install -t was missing; tar's -k, --wildcards texts).
  • D3: grep -E -F (two different matchers): grep's matchers select modes, and the new CommandSpec.conflictingModes adds grep's refusal ("conflicting matchers specified", status 2) to the second one; 9 rows against GNU grep in prefixes-real.
  • D3: new preset openssl (single-dash, and --name is -name, as OpenSSL's opt.c reads it); single-dash is now compared with gcc. Go's flag package reads --name too, but no Go tool is installed to compare with: go, terraform and shfmt stay on single-dash (recorded in the table).

CHANGELOG: the prefix bullet is extended; new bullets for grep -E -F and openssl --hex. sample.sh dump unchanged.

Review fixes: a refused line (grep -E -F) is marked refused in the parse, so it gets no pipeline example and its pattern no regex reading (rows in prefixes-real); tar's operations use conflictingModes too (tar -c -x, tar cxf; 6 rows against GNU tar); prefixes-real tolerates other tool releases (RELEASES comment); gzip --ascii text.

Checks: npm test, extract-snippets --check, Node 24 coverage (every line and branch) pass.

🤖 Generated with Claude Code

@sf624
sf624 added this pull request to stack #250 October 23, 2026 11:48
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

@sf624
sf624 force-pushed the refactor/3.5c-gnu-rest branch from 23d3de3 to e0c8204 Compare October 23, 2026 12:02
@sf624 sf624 mentioned this pull request Oct 23, 2026
…flicting matchers; OpenSSL's --name (refactor 3.5, D3)

GNU coreutils (in commands.ts, basic.ts, distro.ts, system.ts, admin.ts,
ops.ts), diffutils, gzip and tar use the getopt_long parser, with
`--help`, `--version` (GNU_INFO, now in types.ts) and every long option
of their `--help`. test/prefixes-real.test.ts checks each of them against
the tool; stty checks its words before getopt_long, so its prefixes are
checked with ours and one row runs it.

The check found options whose value differed from the tool's: `od -w`
and `--width`, `split --numeric-suffixes`, the optional values of
`sort --check`, `ls --classify`, `cp --update`, `tail --follow`, `diff
--unified`, `shred --remove` and others; `install -t` was missing.
tar's `-k` and `--wildcards` texts are fixed.

grep's matchers select modes, and `conflictingModes` says that grep
refuses two different ones (`grep -E -F`: "conflicting matchers
specified", status 2), as rows against GNU grep show.

The `openssl` preset reads `--name` as `-name`, as OpenSSL's opt.c does;
single-dash is compared with gcc, which refuses `--dumpversion`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sf624
sf624 force-pushed the refactor/3.5c-gnu-rest branch from e0c8204 to 54a1c2c Compare October 23, 2026 13:03
@sf624
sf624 merged commit 1e45fab into main Oct 23, 2026
11 checks passed
@sf624
sf624 deleted the refactor/3.5c-gnu-rest branch October 23, 2026 13:22

This branch was previously deployed

1 inactive deployment
github-pages — 54a1c2ca Deployed Oct 23, 2026 by sf624 via Deploy to GitHub Pages #509
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.

1 participant