UNPKG

codetainer

Version:

A clean and simple CLI to manage and store code snippets with ease.

178 lines (108 loc) β€’ 2.81 kB
# πŸ“š Codetainer Usage Guide Welcome to the **Codetainer** full documentation. This guide covers everything from installation to advanced usage. Codetainer is your terminal-based code snippet managerβ€”blazing fast, powerful, and developer-friendly. --- ## πŸš€ Installation Install globally with your preferred package manager: ```bash npm install -g codetainer ``` or ```bash yarn global add codetainer ``` --- ## βš™οΈ Getting Started After installation, initialize your snippet storage: ```bash ctn init ``` This sets up your local vault at `~/.codetainer/snippets.json`. --- ## ✍️ Add a Snippet ```bash ctn add ``` - You'll be prompted to: - Select a language - Add optional tags - Enter your code in a code editor window --- ## πŸ”Ž Search Snippets ```bash ctn search <query> ``` - Searches **title**, **content**, **tags**, and **language** - Use filters: - `--tag` to filter by tag - `--lang` to filter by language --- ## πŸ“‹ List Snippets ```bash ctn list ``` - Lists all saved snippets with metadata (name, language, tags). --- ## πŸ“‚ Get Snippet Content ```bash ctn get <name> ``` - Prints the code of the specified snippet directly to the terminal. --- ## πŸ“‹ Copy Snippet to Clipboard ```bash ctn copy <name> ``` - Instantly copies the snippet code to your clipboard. --- ## ✏️ Edit Snippet ```bash ctn edit <name> "new content" ``` - Updates the snippet content inline. **OR** open in your default editor for richer editing: ```bash ctn watch <name> ``` - Supports syntax highlighting, linting, and formatting. - Recognizes snippet language. Use `--r` to edit or watch a **remote** snippet. --- ## πŸ“₯ Import Snippets ```bash ctn import ./my-snippet.py ``` - Imports a file from your local directory. Optional: ```bash ctn import ./my-snippet.py -a mySnippet ``` - Assigns a custom name to the imported snippet. --- ## πŸ“€ Export Snippets ### Export one: ```bash ctn export <name> ``` - Saves the snippet in the current directory with proper file extension. ### Export all: ```bash ctn export-all ``` - Saves **all** snippets to the current directory. - Files are named and typed correctly. --- ## ❌ Delete a Snippet ```bash ctn delete "my snippet title" ``` - Permanently removes the snippet from storage. --- ## 🧠 Pro Tips - Use tags to organize snippets into themes or frameworks - Use `ctn list` regularly to maintain your vault - Export before reformatting or migrating machines --- ## 🀝 Contributions We welcome improvements! See `CONTRIBUTING.md` for how to help. --- Happy hacking with Codetainer πŸ§™β€β™‚οΈ