Skip to content

Add --copy flag to copy response body to clipboard#377

Merged
ryanfowler merged 1 commit intomainfrom
copy-to-clipboard
Jan 31, 2026
Merged

Add --copy flag to copy response body to clipboard#377
ryanfowler merged 1 commit intomainfrom
copy-to-clipboard

Conversation

@ryanfowler
Copy link
Owner

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.

@ryanfowler ryanfowler requested a review from Copilot January 31, 2026 17:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 --copy CLI flag and copy config 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.
@ryanfowler ryanfowler merged commit 1cd550a into main Jan 31, 2026
10 checks passed
@ryanfowler ryanfowler deleted the copy-to-clipboard branch January 31, 2026 19:36
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.

1 participant