Skip to content

feat(builtins): add pr - #2571

Merged
chaliy merged 1 commit into
mainfrom
claude/pr-builtin
Oct 7, 2026
Merged

chaliy merged 1 commit into
mainfrom
claude/pr-builtin

Conversation

@chaliy

@chaliy chaliy commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Requested by Михайло · project thread

What changed

New pr builtin, which paginates and columnates text. It supports:

  • page headers with date, title and page number
  • -COLUMN down or across (-a), balancing the columns on the last page
  • -m merge
  • -n, -N, -d, -o
  • -s, -S, -J
  • -l, -w, -W
  • +FIRST:LAST, -D, -h, -F

Output is byte-identical to GNU pr on an 88-case differential corpus. That includes GNU's tab padding in multi-column output and its error messages. Header dates come from the sandbox clock and TZ, the same ones date uses.

Why

Step 4 of the level-up roadmap: pr was one of the missing coreutils. It was written from GNU's observable behavior, not from GNU's source, because that source is GPL and bashkit is MIT.

Before / After

Before:

$ seq 7 | pr -t -3
bash: pr: command not found

After:

$ seq 7 | pr -t -3 | cat -A
1^I^I^I4^I^I^I6$
2^I^I^I5^I^I^I7$
3$
$ seq 3 | pr -l 13 -D DATE -h TITLE

DATE                          TITLE                             Page 1

1
2
3

GNU pr prints the same bytes.

Risk

  • Low
  • New command. Padding can multiply the input size, so output is capped at 16 MiB and options are bounded at 10,000.
  • -e and -i are not implemented (L-PR-001).
  • A fuzz run of 600 random inputs and option mixes found no panics.

Checklist

  • Tests added or updated (pr.test.sh with 25 cases checked against real bash, plus unit tests)
  • Backward compatibility considered

https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA


Generated by Claude Code

@chaliy chaliy self-assigned this Oct 7, 2026
@chaliy
chaliy force-pushed the claude/pr-builtin branch from cfcb9b9 to 44f13f6 Compare October 7, 2026 15:50
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit a74ccc3 Commit Preview URL

Branch Preview URL
Oct 07 2026, 04:35 PM

@chaliy
chaliy force-pushed the claude/pr-builtin branch from 44f13f6 to c85cff2 Compare October 7, 2026 16:04
pr paginates and columnates: page headers with date, title and page
number, -COLUMN down/across with last-page balancing, -m, -n, -d, -o,
-s/-S/-J, -l/-w/-W, +FIRST:LAST, -D, -h, -F. Written from GNU pr's
observable behavior (not its GPL source) and byte-identical to it on an
88-case differential corpus, including the multi-column tab padding.
Header dates use the sandbox clock and TZ. Output capped at 16 MiB.

Claude-Session: https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
@chaliy
chaliy force-pushed the claude/pr-builtin branch from c85cff2 to a74ccc3 Compare October 7, 2026 16:34
@chaliy
chaliy merged commit e95b6ed into main Oct 7, 2026
44 checks passed
@chaliy
chaliy deleted the claude/pr-builtin branch October 7, 2026 17:04
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