CLI passthrough (PTY) mode, standalone snippet output #256
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.
CLI passthrough (PTY), standalone snippets, and pager safeguards
Summary
--standalone
(-S
) to emit a minimal inline HTML snippet wrapped in<code>
.GIT_PAGER=cat
,PAGER=cat
) to prevent hangs; users can override.--help
, README/docs, and man page; add targeted tests.Why
Capturing realistic colorized output from CLIs (e.g.,
git
) usually requires a TTY. This PR makes it easy to run such commands, capture their ANSI-colored output, and convert it to HTMLreliably—without getting stuck behind pagers.
What’s Changed
TERM=xterm-256color
.--standalone
(-S
): like--inline
but wrapped in<code style='white-space: pre;'>…</code>
for convenient embedding.GIT_PAGER=cat
andPAGER=cat
by default to avoid hangs.Usage
Run a command and convert its colored output:
ansi2html git log -p > git-log.html
Separate ansi2html options from the child command:
ansi2html --inline -- git log -p > inline-git-log.html
Produce a minimal embeddable snippet:
echo $'\e[31mRED\e[0m' | ansi2html --standalone
short form:
echo $'\e[31mRED\e[0m' | ansi2html -S
Behavior Notes
Docs & Tests
Backwards Compatibility
Commits
Checklist