Repository navigation
pr: implement it - #247
Open
metif12 wants to merge 2 commits into
Open
pr: implement it#247metif12 wants to merge 2 commits into
metif12 wants to merge 2 commits into
Conversation
Paginate and columnate files for printing, with -t, -n, -d, -N, -o, -l, -w, -h, -s, -f, -F, the long -- spellings and multiple file operands. Line handling and operand parsing live in common/pr; src/pr is a thin main. The page header is deliberately not emitted: it carries the current date, so any test against the default output would be non-deterministic, and the deterministic work is the line handling underneath it. Ten cases were compared byte-for-byte against GNU 9.4 through WSL: bare passthrough, -n, -n with -d, -o indentation both with and without numbering, -N first line number, the -l and -w error messages, the missing-file diagnostic, and -d alone. -d was the one that took two attempts, because a blank line follows every line including the last one and not just the ones in between. Named gaps rather than faked: the multi-column layouts (-2, -3, -a, -m) and page breaks are not implemented, since the inter-column padding was not decoded; and --block-size operands take plain decimal only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
prpaginates and columnates files for printing, with-t,-n,-d,-N,-o,-l,-w,-h,-s,-f,-F, the long--spellings and multiple file operands.Line handling and operand parsing live in
common/pr;src/pris a thin main.The page header is deliberately not emitted. It carries the current date and time, so any test against the default output would be non-deterministic, and there is no way to assert on it that survives a day. The deterministic work underneath it — the line handling — is what this implements and tests.
Ten cases were compared byte-for-byte against GNU 9.4 through WSL: bare passthrough,
-n,-nwith-d,-oindentation both with and without numbering,-Nfirst line number, the-land-werror messages, the missing-file diagnostic, and-dalone. Zero diffs.-dtook two attempts, and the reason is worth recording: a blank line follows every line including the last one, not just the ones in between. My first version appended one blank at the end of the file, which passed a casual read and failed the comparison.Named gaps rather than faked: the multi-column layouts (
-2,-3,-a,-m) and page breaks are not implemented. The inter-column padding was not decoded —pr -t -2 -nemits1\ta\t\t\t \t3 c, where the gap is not a simple multiple of the column width, and guessing would have produced a layout that looks plausible and is wrong.