#snippets #command-line-tool #code #language-model #search #cli

bin+lib snippy

A command-line tool for that makes using LLMs for code generation a breeze

4 releases

0.1.3 Oct 9, 2024
0.1.2 Oct 6, 2024
0.1.1 Sep 24, 2024
0.1.0 Sep 3, 2024

#1714 in Command line utilities

Download history 122/week @ 2024-09-02 26/week @ 2024-09-16 199/week @ 2024-09-23 101/week @ 2024-09-30 295/week @ 2024-10-07 15/week @ 2024-10-14

611 downloads per month

Custom license

51KB
1K SLoC

πŸ“Ž Snippy

🌟 Overview

Snippy is a command-line tool for copying code snippets to the clipboard with optional formatting features. It's designed to make sharing code easier and more efficient, with special features for working with Large Language Models. ✨Here's a quick demo of Snippy in action:

https://github.com/user-attachments/assets/64d4ac13-8e3b-4923-8c74-95ad37a92e20

πŸš€ Features

  • πŸ“‹ Copy multiple files to clipboard
  • πŸ–ŒοΈ Optional markdown code block formatting
  • πŸ”’ Customizable line numbering
  • πŸ‘€ Clipboard watching mode for real-time processing
  • πŸ€– Seamless integration with LLM outputs
  • πŸ–₯️ Cross-platform support (Windows, macOS, Linux)
  • πŸ“„ XML Output Formatting

πŸ’» Installation

To install snippy, you need to have Rust installed. Then you can install it using cargo:

cargo install snippy  

πŸ› οΈ Usage

snippy [OPTIONS] [FILES]...  

πŸ“š Examples

  1. Copy files to clipboard with default settings:

    snippy copy file1.rs file2.py  
    
  2. Copy files without markdown ticks:

    snippy copy --no-markdown file1.rs file2.py  
    
  3. Add line numbers with a custom prefix:

    snippy copy --line-number 3 --prefix ">> " file1.rs file2.py  
    
  4. Copy files formatted as XML:

    snippy copy --xml file1.rs file2.py  
    
  5. Watch clipboard for changes and process new content:

    snippy watch  
    

πŸ” Clipboard Watching for LLM Integration

The watch command (watch) is particularly powerful when working with LLMs:

snippy watch  

This mode continuously monitors your clipboard. When you copy output from an LLM, snippy automatically processes and applies the code to your workspace. πŸͺ„

To use this feature effectively:

  1. Use prompts that generate code in a format Snippy can recognize.
  2. Check the prompts/ directory for example prompts that work well with Snippy.
  3. Ensure your LLM output includes clear file paths and properly formatted code blocks.

Example of a Snippy-friendly code format:

### src/main.rs  
```rust  
fn main() {  
    println!("Hello, Snippy!");  
}  
```  

πŸ“œ License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. πŸ‘

πŸ’¬ Support

If you encounter any problems or have any questions, please open an issue on the GitHub repository. We're here to help! πŸ†˜


Happy coding with Snippy! πŸŽ‰

Dependencies

~23–37MB
~434K SLoC