176 lines
3.8 KiB
Markdown
176 lines
3.8 KiB
Markdown
# Gitignore Generator
|
|
|
|
A CLI tool that generates optimized `.gitignore` files with support for 50+ frameworks, IDE-specific templates, interactive custom builders, template management, and syntax validation. All processing is done locally with zero network dependencies.
|
|
|
|
## Features
|
|
|
|
- **50+ Language/Framework Templates** - Python, JavaScript, Java, Go, Rust, C++, C#, Ruby, PHP, TypeScript, Swift, Kotlin, Scala, Dart, and more
|
|
- **IDE-Specific Templates** - VSCode, JetBrains (IntelliJ, PyCharm), Visual Studio, Vim, Emacs
|
|
- **Interactive Mode** - Wizard-style interface for building custom .gitignore files
|
|
- **Template Management** - Add, remove, export custom templates
|
|
- **Syntax Validation** - Detects common mistakes and potential issues
|
|
- **Local-First** - All processing done locally, no network dependencies
|
|
|
|
## Installation
|
|
|
|
### From Source
|
|
|
|
```bash
|
|
pip install -e .
|
|
```
|
|
|
|
### From PyPI
|
|
|
|
```bash
|
|
pip install gitignore-generator
|
|
```
|
|
|
|
## Usage
|
|
|
|
### Generate a .gitignore from templates
|
|
|
|
```bash
|
|
gitignore generate python
|
|
gitignore generate python javascript
|
|
gitignore generate python --ide vscode
|
|
gitignore generate python -o my.gitignore
|
|
```
|
|
|
|
### List available templates
|
|
|
|
```bash
|
|
gitignore list
|
|
gitignore list --category languages
|
|
gitignore list --category ides
|
|
```
|
|
|
|
### Search for templates
|
|
|
|
```bash
|
|
gitignore search python
|
|
gitignore search java
|
|
```
|
|
|
|
### Interactive Mode
|
|
|
|
```bash
|
|
gitignore interactive
|
|
```
|
|
|
|
### Validate existing .gitignore
|
|
|
|
```bash
|
|
gitignore validate .gitignore
|
|
```
|
|
|
|
### Template Management
|
|
|
|
```bash
|
|
# Add custom template
|
|
gitignore template-add my_template template_file.gitignore
|
|
|
|
# Remove custom template
|
|
gitignore template-remove my_template
|
|
|
|
# Export template to file
|
|
gitignore template-export python exported.gitignore
|
|
|
|
# Get template info
|
|
gitignore info python
|
|
```
|
|
|
|
## Commands
|
|
|
|
| Command | Description |
|
|
|---------|-------------|
|
|
| `generate [TEMPLATES...]` | Generate .gitignore from templates |
|
|
| `list` | List available templates |
|
|
| `search QUERY` | Search for templates |
|
|
| `interactive` | Launch interactive wizard |
|
|
| `validate FILE` | Validate .gitignore syntax |
|
|
| `template-add NAME FILE` | Add custom template |
|
|
| `template-remove NAME` | Remove custom template |
|
|
| `template-export NAME FILE` | Export template to file |
|
|
| `info TEMPLATE` | Show template information |
|
|
|
|
## Templates
|
|
|
|
### Languages & Frameworks
|
|
|
|
- Python, JavaScript, Java, Go, Rust
|
|
- C++, C#, TypeScript, PHP, Ruby
|
|
- Swift, Kotlin, Scala, Dart
|
|
- Haskell, Elixir, Clojure, OCaml
|
|
- Perl, Lua, R
|
|
- .NET, Terraform, Ansible
|
|
- Docker, Kubernetes
|
|
|
|
### IDEs
|
|
|
|
- VSCode, JetBrains (IntelliJ, PyCharm, etc.)
|
|
- Visual Studio, Vim, Emacs
|
|
|
|
## Interactive Mode
|
|
|
|
The interactive mode guides you through creating a `.gitignore`:
|
|
|
|
1. Select a category (Languages, IDEs, or Custom)
|
|
2. Choose templates from the list
|
|
3. Add custom patterns
|
|
4. Preview and edit the result
|
|
5. Save to file
|
|
|
|
## Template Management
|
|
|
|
Custom templates are stored in `~/.config/gitignore-generator/templates/`.
|
|
|
|
### Environment Variables
|
|
|
|
| Variable | Description | Default |
|
|
|----------|-------------|---------|
|
|
| `GITIGNORE_DEFAULT_FILE` | Default output file | `.gitignore` |
|
|
| `TEMPLATE_DIR` | Template directory | `templates` |
|
|
|
|
## Examples
|
|
|
|
### Python project with VSCode
|
|
|
|
```bash
|
|
gitignore generate python --ide vscode
|
|
```
|
|
|
|
### Full stack project
|
|
|
|
```bash
|
|
gitignore generate python javascript --ide jetbrains
|
|
```
|
|
|
|
### With custom output
|
|
|
|
```bash
|
|
gitignore generate .gitignore - java kotlin -of
|
|
```
|
|
|
|
## Configuration
|
|
|
|
Create a `.gitignore-generator/config.yaml`:
|
|
|
|
```yaml
|
|
template_dir: templates
|
|
default_output: .gitignore
|
|
custom_templates_dir: ~/.config/gitignore-generator/templates
|
|
```
|
|
|
|
## Contributing
|
|
|
|
1. Fork the repository
|
|
2. Create a feature branch
|
|
3. Add your template to `templates/languages/` or `templates/ides/`
|
|
4. Update `templates/templates.json`
|
|
5. Run tests: `pytest tests/ -v`
|
|
6. Submit a pull request
|
|
|
|
## License
|
|
|
|
MIT
|