Skip to content

feat(progress): add ProgressOutput::Quiet variant#80

Merged
jdx merged 1 commit intojdx:mainfrom
nkakouros:feat/progress-quiet-variant
Apr 16, 2026
Merged

feat(progress): add ProgressOutput::Quiet variant#80
jdx merged 1 commit intojdx:mainfrom
nkakouros:feat/progress-quiet-variant

Conversation

@nkakouros
Copy link
Copy Markdown
Contributor

Summary

  • Add ProgressOutput::Quiet variant to suppress all progress output (spinners, status lines, text-mode updates)
  • Early return in update(), println(), refresh_once() when Quiet
  • Prevent refresh loop from spawning in Quiet mode (alongside existing Text guard)

This enables consumers like hk and mise to fully suppress progress output for --quiet/--silent flags, rather than
falling back to ProgressOutput::Text which still prints text-mode status lines.

Test plan

  • cargo test — all 7 tests pass
  • cargo clippy -D warnings — clean
  • cargo fmt --check — clean
  • Verified in hk: hk install --quiet and hk check --quiet produce no progress output

🤖 Generated with Claude Code

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Mar 29, 2026

Greptile Summary

Adds ProgressOutput::Quiet to fully suppress all progress output (spinners, text-mode lines, println writes) for --quiet/--silent CLI use cases. The implementation is complete and consistent: early-return guards are placed in update(), println(), refresh_once(), and the background thread's start() function, and output() correctly gives Quiet precedence over the CLX_TEXT_MODE environment variable.

Confidence Score: 5/5

  • This PR is safe to merge; the changes are minimal, focused, and all code paths that produce output are correctly guarded.
  • No P0 or P1 issues found. All four output-producing paths (update, println, refresh_once, background thread start) are correctly guarded. The output() function's precedence logic is sound and matches the documented intent. The #[non_exhaustive] attribute is a deliberate, appropriate design choice. Only P2 observations remain (no behavior test for Quiet mode).
  • No files require special attention.

Important Files Changed

Filename Overview
src/progress/output.rs Adds Quiet variant to ProgressOutput, adds #[non_exhaustive], and updates output() to give Quiet precedence over env vars. Logic is correct and well-documented.
src/progress/job.rs Adds Quiet early-return in update() and println(). Both guards are placed correctly before any side effects.
src/progress/render.rs Adds output() import and Quiet guard in refresh_once(). The render_frame() local variable named output shadows the imported function within that scope but is harmless since output() is not called inside render_frame().
src/progress/state.rs Extends the start() guard to include Quiet via matches!. Clean and idiomatic change that prevents the background refresh thread from spawning in Quiet mode.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["output() called"] --> B["Read OUTPUT mutex copy"]
    B --> C{stored == Quiet?}
    C -- Yes --> D["return Quiet\nenv vars cannot override"]
    C -- No --> E{CLX_TEXT_MODE=1?}
    E -- Yes --> F["return Text"]
    E -- No --> G["return stored"]

    H["update() called"] --> I{is_disabled OR STOPPING\nOR output==Quiet?}
    I -- Yes --> J["return early"]
    I -- No --> K{output==Text?}
    K -- Yes --> L["render_text_mode()"]
    K -- No --> M["notify() triggers start()"]

    M --> N{started OR disabled\nOR Text OR Quiet\nOR stopping?}
    N -- Yes --> O["return, no thread spawned"]
    N -- No --> P["spawn background refresh thread"]

    R["refresh_once() called"] --> S{is_disabled OR output==Quiet?}
    S -- Yes --> T["return Ok immediately"]
    S -- No --> U["render + write frame to terminal"]
Loading

Reviews (6): Last reviewed commit: "feat(progress): add ProgressOutput::Quie..." | Re-trigger Greptile

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new Quiet output mode to the progress system, allowing for the suppression of all progress-related output. The changes include adding the Quiet variant to the ProgressOutput enum and updating the job rendering, line printing, and state management logic to return early when this mode is active. A review comment suggests combining the early return conditions in src/progress/job.rs into a single statement to improve code readability.

Comment thread src/progress/job.rs Outdated
@nkakouros nkakouros force-pushed the feat/progress-quiet-variant branch 3 times, most recently from 9aeac4e to 129eaef Compare March 29, 2026 11:47
@nkakouros nkakouros marked this pull request as draft March 29, 2026 11:49
@nkakouros nkakouros force-pushed the feat/progress-quiet-variant branch from 129eaef to facd2ef Compare March 29, 2026 12:13
@nkakouros nkakouros marked this pull request as ready for review March 29, 2026 12:17
@nkakouros nkakouros force-pushed the feat/progress-quiet-variant branch from facd2ef to 551e1c4 Compare March 29, 2026 12:29
@nkakouros
Copy link
Copy Markdown
Contributor Author

nkakouros commented Mar 29, 2026

One concern: ProgressOutput is a public enum in a 1.x crate without #[non_exhaustive]; adding a new variant is technically a semver-breaking change for downstream users who exhaustively match on it

Addressed. I don't know if a major version bump is mandated here.

jdx/hk#782 uses this. If this approach is ok, I will follow up with a similar approach for mise.

…gress output

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nkakouros nkakouros force-pushed the feat/progress-quiet-variant branch from 551e1c4 to 36781c5 Compare April 14, 2026 10:36
@jdx jdx merged commit d60ab64 into jdx:main Apr 16, 2026
8 checks passed
@jdx jdx mentioned this pull request Apr 13, 2026
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.

3 participants