Repository navigation
Align and style red's CLI output - #391
Merged
Merged
Conversation
Replace tab-separated rows, which drifted whenever a plugin id crossed an 8-column tab stop, with a shared print_plugin_table helper that sizes each column to its widest cell and adds an uppercase header row.
Extract onboarding's paint/color_enabled helpers into a cli_style module and use them to style plugin catalog/list output: dim header, bold name, cyan Official tier, green/red compatibility, dim host target with yellow for unavailable. Widths are measured on plain text before painting, and color is emitted only on a TTY without NO_COLOR, so piped output stays plain and aligned.
Plugin table output now goes through a locked stdout handle that maps a broken pipe (e.g. `red plugin catalog | head`) to exit status 141, the conventional SIGPIPE status, instead of panicking. Allow the linker_messages lint for the red package: Apple's ld reports the debug binary's __eh_frame exceeding the 16MB compact unwind limit, which only affects panic-unwind speed and cannot be avoided at this binary size.
Move the table renderer and the broken-pipe-safe writer into cli_style and apply the same conventions across red's non-editor output: - --check-config: colored severity, bold setting path, dimmed location and fallback; a green check on success - --agent-check: dimmed labels, green/red readiness verdict - --runtime-files: aligned columns, user and $RED_RUNTIME files highlighted, embedded files dimmed - --self-check: status colored per plugin state - plugin, language and --eject success messages get a green check and bold subject; Error: prefix is bold red when stderr is a terminal - plugin enable/disable on a missing plugin reports it is not installed instead of failing to read its install record Plain output keeps its exact text: release CI and the updater grep --self-check lines, so color is only ever added around existing words and only on a terminal without NO_COLOR.
shared_session_lock_blocks_replacement assumed the update lock is free immediately after the shared owner is dropped. flock locks belong to the open file description, which a child forked by a concurrently running test inherits until it execs, so the lock can stay held briefly. This made the test fail intermittently on CI (including on main). A local stress run reproduced it: re-locking right after release failed up to 14 of 3000 times while other threads spawned processes, and 0 of 9000 without them. Retry for up to five seconds instead.
Contributor
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 43a98f8183
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A CJK or emoji cell occupies more terminal columns than it has chars, so char counting let the aligned plugin and runtime-file columns drift. Delegate cell measurement to unicode_utils::display_width.
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.
Summary
Gives red's non-editor commands consistent, readable terminal output, built on a new shared
src/cli_style.rsmodule (table rendering, color helpers, closed-pipe-safe output).red plugin catalog/red plugin list: aligned columns with a header row instead of tab-separated output that drifted on long ids. Bold names, cyanOfficial, green/red compatibility, dimmed host target.red --check-config: colorederror/warning, bold setting path, dimmed location and fallback; green ✓ forconfig ok.red --agent-check: dimmed labels, greenready/ rednot ready.red --runtime-files: aligned columns; files from your config dir or$RED_RUNTIMEare highlighted and the embedded majority is dimmed, so overrides stand out.red --self-check: plugin status colored by state.plugin install/update/enable/disable/remove,language trust/untrust/check-indent,--eject): green ✓ and bold subject.Error:when stderr is a terminal.red plugin enable|disable <missing>now says the plugin is not installed instead of "failed to read install record".red plugin catalog | headexits with status 141 (SIGPIPE convention) instead of panicking.linker_messageslint to silence Apple ld's__eh_frame section too largenote, which only affects unwind performance.Plain output compatibility
Color is emitted only when the stream is a terminal and
NO_COLORis unset. Styling only wraps existing words in ANSI codes and never changes the text, because release CI and the updater match--self-checkoutput verbatim (final linered self-check ok, unhealthy plugins detected via^plugin .+: (pending|disabled|...)$). The plugin tables and--runtime-filesdid change layout from tab/fixed-gap separated to aligned columns, so scripts usingcut -fon them would needawk.Testing
cargo test -p red --lib: 2577 passed;cargo test -p red --bin red,--test self_check,--test agent_checkpasscargo clippy --all-targets -p redandcargo fmt --checkcleanNO_COLOR=1output--check-configdiagnostics and a user-overridden runtime plugin with a scratchXDG_CONFIG_HOME