Skip to content

GDGVIT/code-snippet-cli

GDSC VIT

Code Snippet CLI

This project is a custom Command Line Interface (CLI) tool** for managing code snippets efficiently. It allows users to add, view, search, and copy snippets categorized by language, tags, or keywords. The tool supports fuzzy search and integrates with **Prisma + PostgreSQL for persistent storage. Designed for developers, it streamlines snippet reuse and organization directly from the terminal.


Join Us Discord Chat

DOCS UI

Features

  • Add & Store Snippets – Save code snippets with metadata like name, language, tags, and file path.
  • Search & Fuzzy Matching – Find snippets using exact or partial keyword, language, or tag matches.
  • Clipboard Integration – View snippets and instantly copy them to your clipboard for quick reuse.
  • Persistent Storage with Prisma + PostgreSQL – Store and retrieve snippets from a reliable database backend.

🧩 Dependencies

  • commander – for creating CLI commands
  • clipboardy – to copy snippets to the clipboard
  • fuse.js – enables fuzzy search functionality
  • inquirer – for interactive prompts
  • chalk – for colorful terminal output
  • dotenv – to manage environment variables
  • @prisma/client – Prisma’s runtime client for database access
  • prisma – Prisma CLI for DB setup and migrations (devDependency)
  • pg – PostgreSQL client for Node.js

🚀 Running the Project

🔧 Install Dependencies

npm install
npm install -D prisma
npm install pg

⚙️ Initialize Prisma

npx prisma init

Edit the .env file to point to your PostgreSQL database:

DATABASE_URL="postgresql://username:password@localhost:5432/your-db-name"

▶️ Execute CLI

Example usage:

mycli add-snippet
mycli search-snippet -l python

Contributors

Samridh Suresh

Your Name Here (Insert Your Image Link In Src

GitHub LinkedIn

Made with ❤ by GDSC-VIT

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •