| Crates.io | cpm2 |
| lib.rs | cpm2 |
| version | 1.0.4 |
| created_at | 2025-12-20 19:25:35.923149+00 |
| updated_at | 2025-12-20 19:25:35.923149+00 |
| description | A command-line utility written in Rust that copies file paths to the clipboard with various formatting options and sends notifications via Growl. |
| homepage | https://github.com/cumulus13/cpm2 |
| repository | https://github.com/cumulus13/cpm2 |
| max_upload_size | |
| id | 1996877 |
| size | 80,454 |
A command-line utility written in Rust that copies file paths to the clipboard with various formatting options and sends notifications via Growl.
cargo install cpm2
# Without the + sign
cpm ✅ Copy current dir
cpm gntp ✅ Copy C:\PROJECTS\gntp
cpm gntp\build.bat ✅ Copy C:\PROJECTS\gntp\build.bat
cpm gntp\build.bat test ✅ Copy C:\PROJECTS\gntp\build.bat\test
cpm data test file.txt ✅ Copy C:\PROJECTS\data\test\file.txt
# With + sign (optional)
cpm + gntp ✅ Copy C:\PROJECTS\gntp
cpm + gntp\build.bat ✅ Copy C:\PROJECTS\gntp\build.bat
cpm + gntp build.bat ✅ Copy C:\PROJECTS\gntp\build.bat
# With options
cpm gntp -l ✅ Linux style
cpm + gntp -u ✅ URL style
cpm -l gntp build.bat ✅ Flexible order
cpm gntp build.bat -u ✅ Options at the back
# Copy current directory path
cpm
# Copy relative file path (current directory + file)
cpm test.txt
# Output: C:\current\directory\test.txt
# Copy relative path with subdirectory
cpm data\test.txt
# Output: C:\current\directory\data\test.txt
# Copy absolute path
cpm C:\TEST\test.txt
# Output: C:\TEST\test.txt
Use -l or --linux flag to convert backslashes to forward slashes:
cpm test.txt -l
# Output: C:/current/directory/test.txt
cpm data\test.txt -l
# Output: C:/current/directory/data/test.txt
Use -u or --url flag to convert to file URL format:
cpm test.txt -u
# Output: file:///C:/current/directory/test.txt
cpm data\test.txt -u
# Output: file:///C:/current/directory/data/test.txt
Arguments can be placed before or after the path:
cpm test.txt -u
cpm -u test.txt
cpm -l data\test.txt
cpm data\test.txt -l
# Show help
cpm -h
cpm --help
# Show version
cpm -V
cpm --version
When a path is copied, cpm automatically sends a notification to Growl (if running).
cpm config\app.json
# Copies: C:\projects\myapp\config\app.json
cpm index.html -u
# Copies: file:///C:/projects/website/index.html
# Can be pasted directly into browser address bar
cpm src\main.rs -l
# Copies: C:/projects/myapp/src/main.rs
# Compatible with Unix-style tools
cpm "D:\Documents\Important File.txt"
# Copies: D:\Documents\Important File.txt
If clipboard operations fail, ensure:
If notifications don't appear:
Use quotes for paths containing spaces:
cpm "My Documents\test.txt"
This project is open source and available under the MIT License.
Contributions are welcome! Please feel free to submit a Pull Request.