| Crates.io | c2f |
| lib.rs | c2f |
| version | 0.1.0 |
| created_at | 2025-09-10 07:08:00.751727+00 |
| updated_at | 2025-09-10 09:29:43.09525+00 |
| description | CLI to write clipboard contents to a file |
| homepage | https://github.com/balintb/c2f |
| repository | https://github.com/balintb/c2f |
| max_upload_size | |
| id | 1832169 |
| size | 106,913 |
c2f - Clipboard to fileSimple CLI tool to write clipboard contents to a file with content format detection.
c2f is a lightweight cross-platform command-line utility that saves or appends your clipboard contents to a file. It can automatically detect content types and add an appropriate file extension.
brew install balintb/tap/c2f
cargo install c2f
Requires Rust 1.60+
git clone https://github.com/balintb/c2f
cd c2f
cargo install --path .
Download the latest release from the releases page.
# write clipboard with auto-detected extension
c2f
# creates clipboard.json / clipboard.py / clipboard.md / etc.
# write clipboard to specific file
c2f myfile.txt
# append to file
c2f -a existing.txt
# quiet mode (no output)
c2f -q
# override content detection
c2f --detect=false # always use .txt extension
c2f --detect=true # force detection even if disabled in config
-a, --append - Append to file instead of overwriting-q, --quiet - Suppress all output-e, --append-ext - Add detected extension to specified filename--detect=<bool> - Override content detection (true/false)-h, --help - Print help-V, --version - Print versionc2f supports a configuration file at ~/.config/c2f/config.toml:
ask_confirmation = false # Ask for confirmation before writing (default: false)
quiet = false # Suppress all output (default: false)
detect_type = true # Enable content type detection (default: true)
Command-line flags override config file settings.
# copy JSON and save with autodetected extension
echo '{"name": "test"}' | pbcopy # macOS
c2f # creates clipboard.json
# copy Python and save
echo 'import sys' | pbcopy
c2f # creates clipboard.py
# copy MD and save
echo '# Title' | pbcopy
c2f # creates clipboard.md
# save to specific file
c2f output.txt
# append to existing file
c2f -a notes.log
# quiet mode (no output)
c2f -q data.json
# disable detection (always use .txt)
c2f --detect=false
# force detection even if disabled in config
c2f --detect=true
# append detected extension to specified filename
echo '{"data": true}' | pbcopy
c2f -e myfile # creates myfile.json
c2f --append-ext output # creates output.json
# quietly append JSON to log file with explicit detection
echo '{"timestamp": "2025-01-10", "event": "test"}' | pbcopy
c2f -qa --detect=true events.log
# save code snippet with auto-extension in quiet mode
echo 'def hello(): print("world")' | pbcopy
c2f -qe snippet # creates snippet.py silently
# override config to force detection and append extension
c2f --detect=true --append-ext report # creates report.{ext} based on content
# copy SQL query and append to daily log
c2f -a ~/logs/queries-$(date +%Y%m%d).sql
# copy code from browser/IDE, then:
c2f -qe ~/snippets/solution # auto-detects language, adds extension
# append API responses to a file
c2f -qa api-responses.jsonl # append mode for JSON Lines format
# note-taking: save formatted content with proper extensions
c2f -e ~/notes/$(date +%Y%m%d)-meeting # creates dated .md file
c2f can automatically detect and assign appropriate extensions for:
Data Formats: JSON (.json), XML (.xml), YAML (.yaml), TOML (.toml), CSV (.csv), SQL (.sql)
Programming Languages:
.rs), Python (.py), JavaScript (.js), TypeScript (.ts).go), Java (.java), C# (.cs), C++ (.cpp), C (.c).sh), PowerShell (.ps1), Ruby (.rb), PHP (.php).swift), Kotlin (.kt)Markup & Style: HTML (.html), Markdown (.md), LaTeX (.tex), CSS (.css), SCSS (.scss)
Config Files: Dockerfile, .gitignore, Makefile, .env, INI (.ini)
Images: PNG images from clipboard
Fallback: Plain text (.txt) for unrecognized content
c2f is cross-platform:
MIT License - see LICENSE for details.
Copyright 2025 balintb