SnipX CLI is a command-line interface tool designed for CodeSnipX to manage code snippets efficiently. It allows developers to retrieve, create, update, delete, and list code snippets directly from their terminal, enhancing their workflow and productivity.
- Retrieve Snippets: Fetch snippets by ID and save them to your local system.
- Add Snippets: Upload new snippets from your local environment or through a configuration file.
- List Snippets: Display a concise list of all available snippets.
- Update Snippets: Modify existing snippets.
- Delete Snippets: Remove unwanted snippets.
- Login: Authenticate users to enable personalized snippet management.
- Node.js (version 12 or later)
- npm (Node Package Manager)
Install SnipX CLI globally using npm:
npm install -g snipx-cli
This makes the snipx
command available globally on your system.
Authenticate with your CodeSnipX credentials.
snipx login --username <username> --password <password>
Fetches a snippet by its ID and imports it into a specified file.
snipx get <id> <filepath>
-
<id>
: The unique identifier of the snippet. -
<filepath>
: The path where the snippet should be saved.
Creates a new code snippet either through direct input or interactively.
snipx create --title "Example Title" --filePath "path/to/codefile.js" --language JavaScript --category "Web Development" --subCategory "Frontend" --description "A simple example."
-
-t, --title <title>
: Title of the snippet. -
-c, --code <code>
: Direct code input (not recommended for large code blocks). -
-f, --filePath <filePath>
: Path to the file containing the code. -
-l, --language <language>
: Programming language of the snippet. -
-C, --category <category>
: Category of the snippet. -
-s, --subCategory <subCategory>
: Subcategory of the snippet. -
-d, --description <description>
: Description of the snippet.
snipx add -i
This command will prompt you to enter details interactively.
snipx add -f path/to/config.json
-
-f, --file <filePath>
: Path to the JSON configuration file containing snippet details.
Displays a list of all available snippets, showing their ID, title, language, and category.
snipx list
Generates a JSON template file which you can fill out to create a snippet.
snipx generate --path "path/to/template.json"
-
-p, --path <path>
: (Optional) Path where the template file will be saved. Default is./snippetTemplate.json
.