| Crates.io | quot |
| lib.rs | quot |
| version | 0.1.7 |
| created_at | 2025-06-30 13:04:02.822361+00 |
| updated_at | 2025-06-30 13:04:02.822361+00 |
| description | A fast and flexible command-line tool that converts text input into escaped string literals |
| homepage | https://github.com/samwisely75/quot |
| repository | https://github.com/samwisely75/quot |
| max_upload_size | |
| id | 1731812 |
| size | 75,375 |
A fast and flexible Rust command-line tool that converts text input into escaped string literals with support for multiple quote styles. Perfect for developers who need to quickly escape text for use in code.
-c/--clipboard flag# install
brew tap samwisely75/tap
brew install quot
# update to latest version
brew upgrade quot
# Debian/Ubuntu:
sudo dpkg -i quot_VERSION_amd64.deb
# RHEL/CentOS/Fedora (.rpm package):**
sudo rpm -ivh quot-VERSION-1.x86_64.rpm
# Using Cargo (if Rust is installed)
cargo install quot
# Or download the pre-built binary from GitHub Releases:
# 1. Go to https://github.com/samwisely75/quot/releases
# 2. Download quot-windows-x64.exe
# 3. Place in a directory in your PATH or run directly
# Interactive mode
quot
# Read from file
quot -f input.txt
# Read from piped input
cat file.txt | quot
# Read from system clipboard
quot -c
quot -f input.txt
# Output: "Hello \"world\"\nLine 2"
quot -m single -f input.txt
# Output: 'Hello "world"\nLine 2'
quot -m raw -f input.txt
# Output: r#"Hello "world"
# Line 2"#
| Style | Flag | Escapes | Use Case |
|---|---|---|---|
| Double | -m double (default) |
\", \\, \n, \r, \t |
General purpose, most languages |
| Single | -m single |
\', \\, \n, \r, \t |
Languages that prefer single quotes |
| Raw | -m raw |
None (raw strings) | Rust code, regex patterns, paths |
When you run quot without arguments and input isn't piped, you enter interactive mode:
1> Hello world
2> This is line 2
3> Special chars: "quotes" and \backslashes
4>
"Hello world\nThis is line 2\nSpecial chars: \"quotes\" and \\backslashes\n"
The --clipboard (or -c) flag allows you to process text directly from your system clipboard:
# Copy some text to clipboard first, then:
quot --clipboard # Double quotes (default)
quot -c -m single # Single quotes
quot -c -m raw # Raw strings
# Example workflow:
# 1. Copy this multi-line text to clipboard:
# Hello "world"
# Line with tab: here
# Backslash: \test
# 2. Run: quot --clipboard
# 3. Output: "Hello \"world\"\nLine with tab:\there\nBackslash: \\test"
The clipboard feature works on all supported platforms (Windows, macOS, Linux) and handles multi-line content seamlessly.
Input file (code.js):
function greet(name) {
console.log("Hello, " + name + "!");
}
Command:
quot -f code.js
Output:
"function greet(name) {\n console.log(\"Hello, \" + name + \"!\");\n}"
One of Quot's standout features is its intelligent clipboard paste handling in interactive mode:
# Copy this multi-line text to your clipboard:
# function example() {
# console.log("Hello world!");
# return true;
# }
# Then run quot and paste with Ctrl+V
quot
# 1> [Paste your code here]
# 2> function example() {
# 3> console.log("Hello world!");
# 4> return true;
# 5> }
# 6>
# Output: "function example() {\n console.log(\"Hello world!\");\n return true;\n}"
Quot fills a specific niche for developers who frequently need to escape text for use in code:
" entity that developers know wellThis project is licensed under the Elastic License 2.0 - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.