The Rust Snippet Manager is a command-line application designed to help developers store, search, manage, and organize code snippets efficiently. This tool supports features like advanced search, editing, tagging, history tracking, and importing/exporting snippets—all wrapped in a user-friendly interface built with Rust.
- Add Snippets: Store your favorite Rust snippets with tags for easy retrieval.
- Search Snippets: Search by title, code content, or tags using advanced fuzzy matching.
- Edit & Delete: Modify existing snippets or remove outdated ones with ease.
- Tag Management: Organize snippets using tags for quick categorization.
- History Tracking: View recent actions performed on your snippet library.
- Export & Import: Easily back up your snippets to a file or restore them.
- TUI Support: Enjoy a clean, terminal-based interface for better usability.
- Rust (v1.65 or higher)
- Cargo (Rust package manager)
# Clone the repository
git clone https://github.com/piter231/snippet_manager.git
# Navigate to the project directory
cd snippet_manager
# Build the application
cargo build --release
# Run the application
cargo run
- Add a Snippet: Save a new code snippet with tags.
- List All Snippets: View all saved snippets and their tags.
- Search Snippets: Search for snippets by keywords in the title, code, or tags.
- Edit a Snippet: Modify a snippet's code or tags.
- Delete a Snippet: Remove a snippet permanently.
- List by Tag: Filter snippets by specific tags.
- Export Snippets: Save your snippets to a JSON file for backup.
- Import Snippets: Restore snippets from a JSON file.
- View Action History: See a log of your recent actions.
- Exit: Save your data and quit the program.
Enter a title for the snippet: My First Snippet
Enter the Rust code for the snippet: println!("Hello, world!");
Enter tags (comma-separated): beginner, hello_world
✅ Snippet added successfully!
Enter the file name to export snippets: snippets_backup.json
✅ Snippets exported successfully.
snippets.json
: Stores all your saved snippets persistently.history.log
: Tracks recent actions for easy reference.
The project uses the following crates:
- serde: For serialization and deserialization of JSON data.
- crossterm: For enhanced terminal user interface and styling.
Add them to your Cargo.toml
:
[dependencies]
serde = { version = "1.0", features = ["derive"] }
crossterm = "0.24"
This project is licensed under the MIT License.
- Syntax highlighting for code snippets using
syntect
. - Cloud sync to save snippets remotely.
- Advanced fuzzy search with custom scoring algorithms.
Contributions are welcome! Feel free to submit a pull request or file an issue on GitHub.
Thanks to the Rust community for their incredible resources and guidance!