Skip to content

Add stdout output and quiet mode support #163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

williamjameshandley
Copy link
Contributor

@williamjameshandley williamjameshandley commented Jun 16, 2025

Summary

This PR addresses issue #115 by implementing UNIX-style stdout output and quiet mode functionality:

  • Stdout output: Use - as the output filename to write to stdout following UNIX conventions
  • Quiet mode: Add --quiet/-q flag to suppress progress and success messages
  • Smart clipboard behavior: Automatically disable clipboard when outputting to stdout (unless explicitly enabled)

Changes Made

  • Added --quiet/-q CLI flag to suppress progress messages
  • Modified write_to_file() function to support stdout output when filename is "-"
  • Updated spinner and message display logic to respect quiet mode
  • Automatically disable clipboard copying when writing to stdout

Test Plan

  • Verify --quiet flag appears in help output
  • Test stdout output with -O - (writes to stdout, no clipboard)
  • Test quiet mode suppresses progress messages
  • Test normal file output still works with success messages
  • Test quiet mode with file output (suppresses file write message)
  • Verify clipboard behavior is disabled when outputting to stdout

Examples

# Output to stdout with quiet mode (ideal for vim workflows)
code2prompt /path/to/code --quiet --output-file -

# Output to stdout with progress messages
code2prompt /path/to/code --output-file -

# Quiet mode with file output
code2prompt /path/to/code --quiet --output-file output.txt

Fixes #115

🤖 Generated with Claude Code

- Add support for '-' as output filename to write to stdout (UNIX convention)
- Add --quiet/-q flag to suppress progress and success messages
- Automatically disable clipboard when outputting to stdout
- Update write_to_file function to handle stdout and quiet mode

Fixes mufeedvh#115

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

Co-Authored-By: Claude <noreply@anthropic.com>
@ODAncona ODAncona self-assigned this Jul 17, 2025
@ODAncona ODAncona added the enhancement New feature or request label Jul 17, 2025
@ODAncona ODAncona merged commit 22506a5 into mufeedvh:main Jul 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Output to stdout
2 participants