UNPKG

codetainer

Version:

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

157 lines (97 loc) โ€ข 2.73 kB
![npm version](https://img.shields.io/npm/v/codetainer) ![license](https://img.shields.io/github/license/YOUR_USERNAME/codetainer) ![issues](https://img.shields.io/github/issues/YOUR_USERNAME/codetainer) ## ๐Ÿ“ฆ Codetainer A clean and simple CLI to manage and store your favorite code snippets like a dev wizard ๐Ÿง™โ€โ™‚๏ธ. Save, tag, search, export, and edit snippets with blazing speed from your terminal. --- ### ๐Ÿš€ Installation ```bash npm install -g codetainer ``` > Make sure your `package.json` has: > > ```json > "bin": { > "ctn": "./bin/index.js" > } > ``` --- ### ๐Ÿ“˜ Usage ```bash ctn [command] [...options] ``` --- ### โœจ Commands #### `ctn add` Create a new snippet interactively. #### `ctn list` List all saved snippets. #### `ctn get <name>` Show snippet content. #### `ctn search <query>` Search snippets by name, tag, or code content. #### `ctn copy <name>` Copy snippet code to clipboard. #### `ctn delete <name>` Delete a snippet. #### `ctn tag <name> [tags...]` Add one or more tags to a snippet. #### `ctn edit <name> [options]` Edit a snippet. Options: - `-c, --code` Edit code in an editor - `-l, --language <language>` Change language - `-t, --tags <tags...>` Replace tags #### `ctn rename <oldName> <newName>` Rename a snippet. #### `ctn export <name>` Export a snippet as a code file. #### `ctn export-all [--language <lang>]` Export all snippets to files. Filter by language if needed. #### `ctn import-file <file> [--name <name>] [--tags <tags>]` Import a file as a snippet. #### `ctn watch <name>` Edit and live-save a snippet in your default editor (like VS Code). --- ### ๐Ÿง  Examples ```bash ctn add ctn tag my-snippet utils express ctn search express ctn edit my-snippet -c ctn export my-snippet ctn import-file ./cool.js -n my-cool-snippet -t js,api ``` --- ### ๐Ÿ—ƒ๏ธ Snippet Format Snippets are stored as JSON like: ```json { "my-snippet": { "code": "console.log('Hello')", "language": "javascript", "tags": ["console", "log"] } } ``` Stored at: `~/.codetainer/snippets.json` --- ### ๐Ÿ›  Dev Setup To develop locally: ```bash git clone https://github.com/yourusername/codetainer cd codetainer npm install npm link # so you can run `ctn` globally ``` --- ### ๐Ÿงช TODO Ideas - [ ] Fuzzy search with better CLI UI - [ ] GitHub Gist import/export - [ ] Snippet sharing - [ ] Categorize by project or language --- [![View Full Documentations Here](https://img.shields.io/badge/docs-view-blue)](./docs/USAGE.md) --- ### ๐Ÿ“„ License MIT ยฉ Joseph Agbonifo