snipx-cli
v0.0.2
Published
A CLI tool for managing and interacting with CodeSnipX, allowing users to handle code snippets directly from the command line.
Downloads
6
Maintainers
Readme
SnipX CLI Tool
Overview
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.
Features
- 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.
Installation
Prerequisites
- Node.js (version 12 or later)
- npm (Node Package Manager)
Installing
Install SnipX CLI globally using npm:
npm install -g snipx-cli
This makes the snipx
command available globally on your system.
Commands
Login
Authenticate with your CodeSnipX credentials.
snipx login --username <username> --password <password>
Retrieve a Snippet
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.
Create a Snippet
Creates a new code snippet either through direct input or interactively.
Direct Input
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.
Interactive Input
snipx add -i
This command will prompt you to enter details interactively.
From a Configuration File
snipx add -f path/to/config.json
-f, --file <filePath>
: Path to the JSON configuration file containing snippet details.
List Snippets
Displays a list of all available snippets, showing their ID, title, language, and category.
snipx list
Generate a Snippet Template
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
.