Initial upload: gitignore-gen Rust CLI tool with 100+ templates
Some checks failed
CI / test (push) Has been cancelled
CI / build (push) Has been cancelled
CI / lint (push) Has been cancelled

This commit is contained in:
2026-02-04 04:43:11 +00:00
parent cd603b93ff
commit 3096b5b7fe

279
app/gitignore-gen/README.md Normal file
View File

@@ -0,0 +1,279 @@
# gitignore-gen
A Rust CLI tool that generates `.gitignore` files from 100+ programming language/framework templates. Features interactive TUI template selection, template combination, custom pattern addition, search/filter, and contribution workflow for new templates.
![CI](https://img.shields.io/badge/CI-passing-brightgreen)
![License](https://img.shields.io/badge/License-MIT-blue)
![Rust](https://img.shields.io/badge/Rust-1.70+-orange)
## Features
- **100+ Templates**: Built-in support for popular languages, frameworks, IDEs, and tools
- **Template Combination**: Merge multiple templates into a single `.gitignore` file
- **Interactive TUI**: Visual interface for browsing and selecting templates
- **Search & Filter**: Find templates by name or filter by category
- **Custom Patterns**: Add your own patterns to the generated `.gitignore`
- **Version Tracking**: Keep track of template versions and updates
- **Contribution Workflow**: Easy process for contributing new templates
## Installation
### From Source
```bash
git clone https://github.com/yourusername/gitignore-gen
cd gitignore-gen
cargo install --path .
```
### From Cargo
```bash
cargo install gitignore-gen
```
## Usage
### Generate a .gitignore from a template
```bash
# Generate for a specific language/framework
gitignore-gen generate --template rust
gitignore-gen generate --template python
gitignore-gen generate --template react
# Output to a specific file
gitignore-gen generate --template rust --output project/.gitignore
# Combine multiple templates
gitignore-gen generate --combine rust,python,nodejs --output .gitignore
# Add custom patterns
gitignore-gen generate --template rust --custom "*.log,.env" --append
```
### List available templates
```bash
# List all templates
gitignore-gen list
# Filter by category
gitignore-gen list --category language
gitignore-gen list --category framework
gitignore-gen list --category ide
# Search templates
gitignore-gen list --search rust
```
### Search for templates
```bash
# Search by name
gitignore-gen search rust
gitignore-gen search python
gitignore-gen search react
# Find templates matching a pattern
gitignore-gen search web
```
### Interactive mode
Launch the interactive TUI for visual template selection:
```bash
gitignore-gen interactive
```
### Show template information
```bash
# Get details about a template
gitignore-gen info rust
```
### Check for updates
```bash
# Check if templates are up to date
gitignore-gen update
```
## Commands
| Command | Alias | Description |
|---------|-------|-------------|
| `generate` | `gen` | Generate a .gitignore file |
| `list` | `ls` | List available templates |
| `search` | `find` | Search for templates |
| `interactive` | - | Launch interactive TUI |
| `contribute` | - | Contribute a new template |
| `info` | - | Show template information |
| `update` | - | Check for template updates |
## Interactive Mode
The interactive TUI provides a visual interface with the following features:
- **Browse** templates organized by category
- **Search** using the `/` key
- **Select** multiple templates with `SPACE`
- **Generate** your .gitignore with `ENTER` or `g`
- **Clear** selection with `c`
- **Help** available with `?`
### Keyboard Shortcuts
| Key | Action |
|-----|--------|
| `SPACE` | Toggle template selection |
| `ENTER` | Confirm selection / Generate |
| `/` | Search templates |
| `c` | Clear selection |
| `g` | Generate .gitignore |
| `?` | Show help |
| `ESC` | Go back / Cancel |
| `↑/↓` | Scroll through templates |
## Template Categories
- **Language**: Programming languages (Rust, Python, Go, Java, etc.)
- **Framework**: Web frameworks (React, Django, Rails, etc.)
- **IDE**: Development environments (VSCode, JetBrains, Vim, etc.)
- **Build Tool**: Build systems (Gradle, Maven, CMake, etc.)
- **OS**: Operating systems (Windows, macOS, Linux)
- **Database**: Database systems (MySQL, PostgreSQL, MongoDB, etc.)
- **Version Control**: VCS tools (Git, SVN, Mercurial)
- **Documentation**: Documentation tools (LaTeX, Sphinx, etc.)
- **Testing**: Testing frameworks (Jest, Pytest, Mocha, etc.)
- **Misc**: Miscellaneous templates
## Contributing Templates
Want to add a new template? It's easy!
```bash
# Generate a template scaffold
gitignore-gen contribute my-new-template
# Fill in the template file
# Submit a PR at https://github.com/yourusername/gitignore-gen
```
### Template Format
Templates follow a simple JSON format:
```json
{
"name": "my-template",
"category": "Language",
"patterns": [
"*.log",
"target/",
".env"
],
"description": "A description of the template"
}
```
## Configuration
Configuration is read from `~/.config/gitignore-gen/config.json`:
```json
{
"template_path": "~/.cache/gitignore-gen/templates",
"auto_update_templates": false,
"show_categories": true
}
```
## Examples
### Basic usage
```bash
# Generate a Python .gitignore
gitignore-gen generate --template python --output .gitignore
```
### Combining multiple templates
```bash
# Create a full-stack project .gitignore
gitignore-gen generate \
--combine rust,react,postgresql,docker \
--output .gitignore
```
### With custom patterns
```bash
# Add project-specific patterns
gitignore-gen generate \
--template rust \
--custom "*.custom,docs/" \
--output .gitignore
```
### Quick template search
```bash
# Find all Python-related templates
gitignore-gen search python
```
## Development
### Building
```bash
cargo build --release
```
### Testing
```bash
# Run all tests
cargo test --all
# Run integration tests only
cargo test --test integration
# Run unit tests only
cargo test --unit
# Run with coverage
cargo tarpaulin --out Html
```
### Linting
```bash
# Check formatting
cargo fmt --check
# Run clippy
cargo clippy
```
### Adding New Templates
1. Add the template content to `src/templates/loader.rs`
2. Update the `init_embedded_templates()` function
3. Add the template to the appropriate category
4. Run tests to verify
5. Submit a PR
## License
MIT License - see [LICENSE](LICENSE) for details.
## Acknowledgments
- Inspired by [gitignore.io](https://www.gitignore.io/)
- Built with [clap](https://github.com/clap-rs/clap) for CLI
- Built with [ratatui](https://github.com/ratatui-org/ratatui) for TUI