Add --copy flag to copy response body to clipboard#377
Merged
ryanfowler merged 1 commit intomainfrom Jan 31, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a --copy flag that copies HTTP response bodies to the system clipboard while maintaining normal stdout output. The implementation includes configuration file support, platform-specific clipboard command detection, streaming response handling, and buffer size limits.
Changes:
- Adds
--copyCLI flag andcopyconfig file option with boolean parsing - Implements clipboard copying with platform detection (pbcopy/clip.exe/wl-copy/xclip/xsel)
- Adds streaming detection to skip SSE/NDJSON responses with warnings
- Implements 16MB buffer limit for clipboard operations
- Adds integration tests covering stdout preservation, file output compatibility, HEAD requests, and silent mode
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| main.go | Integrates Copy field from config into Request struct |
| internal/fetch/fetch.go | Adds Copy field to Request and integrates clipboard copier lifecycle |
| internal/fetch/clipboard.go | Implements clipboard copying logic with platform detection and streaming checks |
| internal/config/config.go | Adds Copy config field with merge logic and boolean parsing |
| internal/cli/app.go | Adds --copy CLI flag definition |
| integration/integration_test.go | Adds integration tests for copy functionality |
| docs/configuration.md | Documents copy config option |
| docs/cli-reference.md | Documents --copy CLI flag with platform requirements |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add a new --copy flag that copies the raw response body to the system clipboard while still printing output to stdout normally. Supports pbcopy (macOS), clip.exe (Windows), and wl-copy/xclip/xsel (Linux). Includes config file support (copy = true), streaming response detection (warns and skips for SSE/NDJSON), a 16MB buffer limit, and integration tests.
ed15fa1 to
a8fbf64
Compare
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.
Add a new --copy flag that copies the raw response body to the system clipboard while still printing output to stdout normally. Supports pbcopy (macOS), clip.exe (Windows), and wl-copy/xclip/xsel (Linux).
Includes config file support (copy = true), streaming response detection (warns and skips for SSE/NDJSON), a 16MB buffer limit, and integration tests.