slugcopy
v2.1.0
Published
Slugify strings and copy to clipboard
Maintainers
Readme
slugcopy
Slugify strings and copy them directly to your clipboard.
slugcopy is a lightweight command-line utility that converts any string into a URL-friendly slug and automatically copies the result to your system clipboard. It is built on top of the robust @sindresorhus/slugify library.
Features
- 🚀 Instant Copy: Automatically puts the result in your clipboard.
- 🛠 Customizable: Choose your separator, handle camelCase, and more.
- 📦 Modern: Built with modern Node.js standards.
- 🌐 International: Handles special characters (e.g.,
Déjà Vu!->deja-vu). - ✅ Comprehensive: Handles edge cases like parentheses, brackets, quotes, newlines, and more.
Install
Requires Node.js 18 or higher.
npm install --global slugcopyUsage
$ slugcopy <string>Options
| Option | Description | Default |
| :------------------------------ | :--------------------------------- | :------------------- |
| --separator=<string> | Character to separate words | - |
| --no-lowercase | Preserve original casing | true (lowercases) |
| --no-decamelize | Preserve camelCase as single words | true (decamelizes) |
| --preserve-leading-underscore | Keep leading underscores | false |
| --no-copy | Do not copy result to clipboard | false (copies) |
Examples
Basic Usage
$ slugcopy "Déjà Vu!"
# Output: deja-vu
# Clipboard: deja-vuCustom Separator & Case Preservation
$ slugcopy "Like a Boss" --no-lowercase --separator='_'
# Output: Like_a_Boss
# Clipboard: Like_a_BossSkipping Clipboard Copy
$ slugcopy "Just Print This" --no-copy
# Output: just-print-this
# Clipboard: (unchanged)Important Notes
Shell Special Characters: When using shell special characters (parentheses, brackets, quotes, etc.), always wrap your input in quotes:
# ✅ Correct - wrapped in quotes
$ slugcopy "Text with (parentheses) and [brackets]"
# ❌ Incorrect - will cause shell parsing errors
$ slugcopy Text with (parentheses) and [brackets]Related
- slugify-cli - The original inspiration for this project.
License
MIT © Imran Pollob
