Codevault is a simple and powerful CLI tool designed to manage your code snippets, helping you stay organized and productive. Whether you're a seasoned developer or just starting out, Codevault streamlines your code snippet management by offering features such as:
- Capture and Store Snippets: Capture code from the terminal, saving it alongside descriptions, tags, and the language for syntax highlighting by using
capturecommand. - Organize Snippets with Tags: Apply tags to categorize snippets, making them easily searchable later.
- Search and Retrieve Snippets: Effortlessly find snippets by using a combination of IDs, tags, keywords, and language filters, using
viewcommand. - Copy Snippets: Copy the code view only the code for quick and easy copy pasting , by using
copycommand. - Edit and Update Snippets: Modify descriptions, tags, and code of existing snippets with
editcommand. - Export Snippets: Export individual or multiple snippets various language-specific, formats or .txt fomat for unsupported languages with the help of
exportcommand. - View Supported Languages: Get a comprehensive list of languages that Codevault supports for syntax highlighting.
Why CodeVault?
- Simplify Code Snippet Management: Forget juggling various files or trying to remember where reuse the code. Codevault provides a central repository for all your code fragments.
- Enhance Code Reusability: Quickly find and reuse existing code snippets instead of rewriting the same logic again and again.
- Boost Productivity: Minimize distractions and maximize coding time by having all your snippets readily accessible in an organized manner.
.
├── Cargo.lock
├── Cargo.toml
├── data
│ └── codevault.json
├── README.md
└── src
├── main.rs
└── models.rs
codevault.json contains all the snippets, which make easier to copy and backup to use on multiple pc.
the repo contains codevault.json with 100 snippets to test the application, you are can delete it and starting saving yours. code snippets.
1. Install Rust:
Prerequisites:
You'll need Rust and Cargo installed on your system. - Check Rust's presence: rustc --version
Install Rust: Install using the official installer: https://www.rust-lang.org/tools/install OR Curl command(Linux/Mac):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
2. Clone CodeVault:
git clone https://github.com/quiflern/codevault.git
cd codevault
3. Build CodeVault:
cargo build
4. Run CodeVault:
target/debug/codevault
or
cargo run
The capture command save your code and add it to snippet collection.
Usage:
target/debug/codevault capture --description <DESCRIPTION> --language <LANGUAGE> --tag <TAG>
Options:
- -d, --description
<description>: Add a descriptive label for your snippet. eg:-d sample description|--description "sample description". - -l, --language
<language>: Specify the programming language for accurate syntax highlighting. eg:-l Rust|--language"Rust". - -t, --tag
<tag>: Assign relevant tags to organize your snippet (e.g., "algorithm," "api," "data"). Multiple tags are supported it should be,comma separated. eg:-t algorithm,api|--tag "algorithm".
Example: To save new snippet execute:
target/debug/codevault capture --description "Demonstrate rust's ownership and borrowing principles, including immutable and mutable references, and how they affect memory management." --tag "rust, ownership, borrowing" --language "Rust"
Demo:
capture-command-demo.webm
The copy command displays the code stored in snippet, and shows only the code of the snippet.
Usage:
target/debug/codevault copy --id <id>
Options:
- -i, --id
<id>: Unique ID automatically assigned for identification of the snippets. eg:-i 1|--id 1.
Examples:
-
To view the code of ID "20", execute:
target/debug/codevault copy --id 20 -
To view the code of ID "25", execute:
target/debug/codevault copy --id 20
Demo:
copy-command.-demo.webm
The delete command remove snippets from your snippet collection.
Usage:
target/debug/codevault delete --id <id>
Options:
- -i, --id
<id>: Allows deleting with ID. eg:-i 1|--id 1.
Example: To delete the snippet with ID "1", execute:
target/debug/codevault delete --id 100
Demo:
delete-command.-demo.webm
The edit command allows you edit existing snippets.
Usage:
target/debug/codevault edit [options]
Options:
- -i, --id
<id>: Allows editing with a specified ID. - -t, --tag
<tag>: Allows editing with a specified tag.
Examples:
-
Edit snippet with tags:
target/debug/codevault edit -t RustDemo:
edit-command-tags-demo.webm
-
Edit snippet with ID 100:
target/debug/codevault edit -i 100Demo:
edit-command-with-id.webm
The export command exports saved snippets in language-specific format from your collection to default export_snippets directory, if path is not specified .
Usage:
target/debug/codevault export [options]
Options:
- -i, --id
<id>: Exports specified ID. eg. - -t, --tag
<tag>: Exports with a specified tag. - -l, --language
<language>: Export all snippets that matches specified language. - -p, --path
<language>: Export snippets specified path.
Examples:
-
Exporting all the snippets to default
export_snippetsdirectory :target/debug/codevault exportDemo:
export-allfiles-command-demo.webm
-
Exporting an snippet using id ;
target/debug/codevault export --id 99Demo:
export-id-command-demo.webm
-
Export an snippet using tags only ;
target/debug/codevault export --tag RustDemo:
export-tag-command-demo.webm
-
Export an snippet using languages only ;
target/debug/codevault export --language ErlangDemo:
export-language-command-demo.webm
-
Advanced Exporting Options:
-
Multiple tags;
target/debug/codevault export --tag recursion,functionDemo:
export-multiple-tags-command-demo.webm
-
Multiple Languages;
target/debug/codevault export --language Rust,C++Demo:
export-multiple-language-command-demo.webm
-
Mutiple tags & Languages;
target/debug/codevault export --tag rust,recursion --language rust,go --path "multiexport"Demo:
export-multi-tags-language-command-demo.webm
-
-
Path examples: If the path is not specified it export to
snippet_exportsdirectory, which will created on the root directory (i.e location where the program is opened).target/debug/codevault export --language Rust --path "codes/rust"Demo : Refer to above examples on how to use path.
The view command allows you to list all snippets.
Usage:
target/debug/codevault view [options]
Options:
- -i, --id
<id>: View information for the snippet with a specific ID. - -k, --keyword
<keyword>: Search for snippets containing the specified keyword. - -t, --tag
<tag>: View snippets with the specified tag. - -l, --language
<language>: View snippets written in a specific language. - -s, --summary: Show only
id, tags, timestamp & descriptionof the snippet.
Examples:
-
Viewing all the snippets :
target/debug/codevault view -
Viewing an snippet using id:
target/debug/codevault view --id 1 -
Viewing an snippet using tags only:
target/debug/codevault view --tags Rust -
Viewing an snippet using languages only :
target/debug/codevault view --language Rust -
Advanced Viewing Options :
- Multiple tags;
target/debug/codevault view --tag data,html - Multiple Languages;
target/debug/codevault view --language Rust,C++
- Multiple tags;
Demo :
view-command-demo.webm
Embrace a Smoother, More Productive Coding Experience with Codevault. Start capturing, organizing, and reusing your code snippets to level up your development experience.


