Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Nov 30, 2025

Summary

This PR implements the .quiet() method on ProcessRunner, providing functionality similar to zx's quiet() method. This allows users to suppress console output while still capturing command results programmatically.

Changes

Core Implementation

  • Added .quiet() method to ProcessRunner class in src/$.mjs:4140-4144
    • Sets options.mirror = false to disable console output
    • Returns this for method chaining
    • Works seamlessly with existing await, pipe, and event patterns

Testing

  • Created comprehensive test suite in tests/quiet-method.test.mjs
    • Tests output suppression for stdout and stderr
    • Verifies method chaining capabilities
    • Confirms result capture still works
    • Validates compatibility with normal (non-quiet) mode

Examples

  • Added demonstration script in examples/quiet-method-demo.mjs
    • Shows usage comparison with and without .quiet()
    • Demonstrates the use case from the issue
    • Includes practical examples with JSON processing

Use Case (from Issue #136)

// Before (would fail with: .quiet is not a function)
await $`gh api gists/${gistId} --jq '{owner: .owner.login, files: .files, history: .history}'`.quiet();

// After (works perfectly!)
await $`gh api gists/${gistId} --jq '{owner: .owner.login, files: .files, history: .history}'`.quiet();

Test Results

All tests pass successfully:

  • ✅ 617 passing tests
  • ✅ 5 skipped tests (expected)
  • ⚠️ 2 pre-existing failures (unrelated to this change)
  • ✅ New .quiet() tests: 6/6 passing

Breaking Changes

None. This is a purely additive feature that doesn't modify any existing functionality.

Related

Fixes #136


🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #136
@konard konard self-assigned this Nov 30, 2025
This commit implements the .quiet() method on ProcessRunner, similar
to zx's quiet() functionality. When called, it disables console output
(mirroring) while still capturing stdout/stderr for programmatic use.

Implementation details:
- Added quiet() method that sets options.mirror = false
- Returns this for method chaining
- Works with both stdout and stderr suppression
- Compatible with existing pipeline and await patterns

Testing:
- Created comprehensive test suite in tests/quiet-method.test.mjs
- Added usage example in examples/quiet-method-demo.mjs
- All existing tests pass (617 pass, 5 skip, 2 pre-existing fails)

This enables the use case from issue #136:
await $\`gh api gists/\${gistId} --jq '...'\`.quiet();

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Support .quite() function like in zx. Add .quiet() method to suppress console output Nov 30, 2025
@konard konard marked this pull request as ready for review November 30, 2025 18:26
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.

Support .quite() function like in zx.

2 participants