Skip to main content

Your intelligent code snippet manager for developers

Project description

Spark CLI

🔥 Your intelligent code snippet manager for developers

Spark helps you save, organize, and quickly access your frequently used commands and code snippets. Never forget that perfect command again!

PyPI version Python 3.8+

Available on PyPI: pip install spark-cli

Features

  • 💾 Save snippets with optional tags for organization
  • 🔍 Smart search - Find snippets by command or tag content
  • 📋 Quick copy - Copy snippets to clipboard with one command
  • 🏷️ Tag system - Organize snippets with comma-separated tags
  • 🗑️ Flexible deletion - Delete by ID or by text content (with preview)
  • 🎨 Beautiful output - Colorful, table-based display using Rich
  • ⚠️ Duplicate detection - Warns if you try to save a duplicate command
  • 🔄 Auto-migration - Database schema updates automatically

Installation

From PyPI (Recommended)

pip install spark-cli

After installation, the spark command is available globally.

From source

git clone https://github.com/zeroequalsone/spark-cli.git
cd spark-cli
pip install -e .

Quick Start

After installation, Spark is ready to use. No configuration needed! The database is automatically created in ~/.spark/snippets.db on first use.

# Save your first snippet
spark save "docker-compose up -d"

# Save with tags
spark save "git log --oneline -10" --tags "git,log,history"

# Find snippets
spark find docker

# List all snippets
spark list

# List snippets by tag
spark list --tag docker

# Copy to clipboard
spark copy 1

# Delete a snippet
spark delete 1

# Delete by text content
spark delete "docker"

Commands

spark save <command> [--tags]

Save a new code snippet.

spark save "npm install" --tags "npm,node,install"

Features:

  • Duplicate detection: If a command already exists, Spark will warn you and ask for confirmation
  • Tags are optional: You can save snippets with or without tags
  • Tags are comma-separated: --tags "tag1,tag2,tag3"

spark find <search-term>

Search for snippets containing the search term in either the command or tags.

spark find docker
spark find git

spark list [--tag <tag>]

List all snippets, optionally filtered by tag.

spark list
spark list --tag docker

spark copy <id>

Copy a snippet to your clipboard by ID.

spark copy 1

spark delete <id|text>

Delete a snippet by ID or by text content. When deleting by text, Spark shows all matching snippets and asks for confirmation.

# Delete by ID (immediate)
spark delete 1

# Delete by text (shows preview table and asks for confirmation)
spark delete "docker"

Note: When deleting by text, all snippets containing that text will be shown. You can confirm or cancel the deletion.

spark clear

Delete all snippets and reset the database. This also resets the ID counter back to 1.

spark clear

Warning: This action cannot be undone!

Examples

Organizing Docker Commands

spark save "docker-compose up -d" --tags "docker,compose,dev"
spark save "docker ps -a" --tags "docker,ps,containers"
spark save "docker logs <container>" --tags "docker,logs,debug"

# Find all docker commands
spark list --tag docker

Git Workflow Snippets

spark save "git log --oneline -10" --tags "git,log,history"
spark save "git checkout -b feature/new-feature" --tags "git,branch,workflow"
spark save "git push origin HEAD" --tags "git,push,remote"

# Search for git commands
spark find git

Python Development

spark save "python -m pytest tests/" --tags "python,test,pytest"
spark save "python -m black ." --tags "python,format,black"
spark save "python -m pip install -e ." --tags "python,install,dev"

# List all Python-related snippets
spark list --tag python

Data Storage

Spark stores all snippets in a local SQLite database located at:

  • Linux/macOS: ~/.spark/snippets.db
  • Windows: %USERPROFILE%\.spark\snippets.db

Your data stays local and private.

Requirements

  • Python 3.8+
  • typer
  • rich
  • pyperclip

Version

Current version: 0.1.0 (Initial release)

Check for updates:

pip install --upgrade spark-cli

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

Ideas for contributions:

  • Import from bash history
  • Export/backup functionality
  • Statistics and usage tracking
  • Shell completion scripts
  • VS Code extension

License

MIT License - see LICENSE file for details.

Acknowledgments

Inspired by tools like pet and cheat.sh, but designed to be more personal and intelligent.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spark_cli-0.3.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spark_cli-0.3.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file spark_cli-0.3.0.tar.gz.

File metadata

  • Download URL: spark_cli-0.3.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for spark_cli-0.3.0.tar.gz
Algorithm Hash digest
SHA256 caf297f02f5009d6bac0c4acf5a9f517c883298ba540755fb4aa1160c2f52a5f
MD5 28c12f7bd66259c97c9429d51cba6789
BLAKE2b-256 89d8a566aa95d3d357f35d751bab4302019aedc0f18272c2d2e27f84b07b2de5

See more details on using hashes here.

File details

Details for the file spark_cli-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: spark_cli-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for spark_cli-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 718f3aff50107b15b5fe1867d4adaf7d6a0c63df7a148bddce9ae44b8a352a29
MD5 e8632c99e9a9fb565fd45ca8cb490081
BLAKE2b-256 82b8bcc1ad533a62ecdcf0e2e56054341f0fa6953ccf178d08048f2a2aa0d09d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page