
Codetainer.Keep it contained...
You can install Codetainer using your preferred package manager:
npm install CodetainerOr with yarn:
yarn add CodetainerOnce installed globally, you can start using Codetainer from your terminal:
ctn initThis sets up your local snippet storage. Think of it as your snippet vault.
Quickly save a snippet with a title, language, and optional tags:
ctn addYou'll be prompted to select language, add tags and paste your code in a code editor window that will open automatically.
Search your saved snippets by keyword, tag, or language:
ctn search itemThis searches tags, languages, title or and content, Use --tag or --lang for scoped filtering.
Get a list of all saved snippets :
ctn list Get your snippet directly in the console:
ctn get snippetCopy your saved snippets:
ctn copy itemNeed to tweak something? Edit snippets by ID or title:
ctn edit snippet "newcontent"This replaces the content of the snippet.
To Edit complex files more effectively, run:
ctn watch item;This opens the snippet it a code editor, and allows for linting and formating because Codetainer recognises the language.
Use --r to edit or watch remote item
Backup a file from the working directory into Codetainer:
ctn import ./my-snippet.pyAccepts local files
ctn import ./my-snippet.py -a mySnippetSaves the imported snippet with a custom title. If not provided, it uses the file name.
Bring back all saved snippets:
ctn export-allexports all snippets and saves them in the current directory, it also recognises their extensions and saves them in the correct format.
Bring back a saved snippet as a file into the working directory:
ctn export my-backupexports this snippet , it also recognises its extensions and saves it.
Remove unwanted snippets permanently:
ctn delete "my snippet title"