Automatically monitor clipboard for cURL commands and replace host addresses based on configuration.
- ✅ Automatic clipboard monitoring
- ✅ Automatic host replacement in cURL commands based on config
- ✅ Support for multiple replacement rules
- ✅ System notification on successful replacement
- ✅ Cross-platform support: Windows, macOS, Linux
- ✅ Auto-generate sample config on first run
Linux/macOS:
curl -fsSL https://raw.githubusercontent.com/fagao-ai/curl-transformer/main/scripts/install.sh | sudo shWindows (PowerShell):
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/fagao-ai/curl-transformer/main/scripts/install.ps1" -OutFile "install.ps1"
.\install.ps1Download the binary for your system from GitHub Releases.
- Linux:
ct-linux-amd64 - macOS Intel:
ct-darwin-amd64 - macOS Apple Silicon:
ct-darwin-arm64 - Windows:
ct-windows-amd64.exe
Rename to ct (or ct.exe on Windows) and move to a directory in your PATH.
# Install Rust (if not already installed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Clone and build
git clone https://github.com/fagao-ai/curl-transformer.git
cd curl-transformer
cargo build --release
sudo cp target/release/ct /usr/local/bin/On first run, the program will automatically create a config file:
ctConfig file location:
- macOS / Linux:
~/.ct/config.toml - Windows:
%USERPROFILE%\.ct\config.toml
Open the config file with your favorite editor:
# macOS/Linux
vim ~/.ct/config.toml
# Windows
notepad %USERPROFILE%\.ct\config.tomlConfig file format:
[[replacements]]
source_host = "https://api.example.com"
dest_host = "http://localhost:3000"
[[replacements]]
source_host = "https://another-api.example.com"
dest_host = "http://localhost:8080"ctThe program will display all configured replacement rules and start monitoring the clipboard:
--------------------------------------------------
cURL Link Replacement Service Started
Monitoring clipboard...
Configured replacement rules:
1. 'https://api.example.com' -> 'http://localhost:3000'
2. 'https://another-api.example.com' -> 'http://localhost:8080'
--------------------------------------------------
- Program runs and continuously monitors the clipboard
- When you copy a cURL command containing a
source_host - The program automatically replaces it with the corresponding
dest_host - The replaced command is updated back to the clipboard
- A system notification pops up indicating successful replacement
Config:
[[replacements]]
source_host = "https://api.production.com"
dest_host = "http://localhost:3000"Copied command:
curl 'https://api.production.com/users' -H 'Authorization: Bearer xxx'Automatically replaced with:
curl 'http://localhost:3000/users' -H 'Authorization: Bearer xxx'Config:
[[replacements]]
source_host = "https://api.prod.com"
dest_host = "http://localhost:3000"
[[replacements]]
source_host = "https://cdn.prod.com"
dest_host = "http://localhost:8080"
[[replacements]]
source_host = "https://auth.prod.com"
dest_host = "http://localhost:9000"Rules are matched in configuration order. The first matching rule will be applied.
curl-transformer/
├── src/
│ ├── main.rs # Main program logic
│ └── config.rs # Config file handling
├── Cargo.toml
└── README.md
- The program runs continuously and monitors the clipboard. Use
Ctrl+Cto stop - Config file uses TOML format. Ensure the format is correct
- Each replacement rule must include
source_hostanddest_hostfields - Rules are matched in configuration order; the first matching rule is applied
arboard- Clipboard operationsregex- Regular expression matchingserde&toml- Config file parsingdirs- Cross-platform config directorynotify-rust- System notifications
MIT