214 lines
3.4 KiB
Markdown
214 lines
3.4 KiB
Markdown
# Auto-Gitignore CLI
|
|
|
|
A Python CLI tool that automatically generates `.gitignore` files by detecting project type, language, and framework from project files.
|
|
|
|
## Features
|
|
|
|
- **Auto-detection**: Automatically detects languages (Python, Node.js, Go, Java, etc.) and frameworks (Django, React, FastAPI, Flask, etc.)
|
|
- **Comprehensive Patterns**: Includes patterns for 19+ programming languages and 22+ frameworks
|
|
- **IDE Support**: Generates patterns for VSCode, JetBrains, PyCharm, and other IDEs
|
|
- **OS Patterns**: Includes macOS, Windows, and Linux specific ignores
|
|
- **Custom Patterns**: Support for adding custom patterns via CLI
|
|
- **Pattern Merging**: Handles monorepos and mixed projects with deduplication
|
|
|
|
## Installation
|
|
|
|
### From Source
|
|
|
|
```bash
|
|
pip install -e .
|
|
```
|
|
|
|
### Using pip
|
|
|
|
```bash
|
|
pip install auto-gitignore-cli
|
|
```
|
|
|
|
## Quick Start
|
|
|
|
Generate a `.gitignore` for your current directory:
|
|
|
|
```bash
|
|
auto-gitignore
|
|
```
|
|
|
|
Generate for a specific directory:
|
|
|
|
```bash
|
|
auto-gitignore --path /path/to/project
|
|
```
|
|
|
|
Dry-run to preview without writing:
|
|
|
|
```bash
|
|
auto-gitignore --dry-run
|
|
```
|
|
|
|
## Usage
|
|
|
|
```bash
|
|
auto-gitignore [OPTIONS]
|
|
```
|
|
|
|
## Options
|
|
|
|
| Option | Description |
|
|
|--------|-------------|
|
|
| `--path, -p` | Path to project directory (default: current directory) |
|
|
| `--language, -l` | Force specific language(s) |
|
|
| `--framework, -f` | Add framework-specific patterns |
|
|
| `--ide` | Add IDE-specific patterns |
|
|
| `--os` | Add OS-specific patterns |
|
|
| `--custom, -c` | Add custom pattern(s) |
|
|
| `--output, -o` | Custom output file path |
|
|
| `--merge/--no-merge` | Merge patterns from multiple sources (default: True) |
|
|
| `--dry-run` | Show generated content without writing |
|
|
| `--force` | Overwrite existing `.gitignore` |
|
|
| `--verbose, -v` | Show detected stack and details |
|
|
| `--help` | Show help message |
|
|
|
|
## Examples
|
|
|
|
### Detect and generate for Python project
|
|
|
|
```bash
|
|
auto-gitignore --language python
|
|
```
|
|
|
|
### Add Django and React patterns
|
|
|
|
```bash
|
|
auto-gitignore --framework django --framework react
|
|
```
|
|
|
|
### Include IDE and OS patterns
|
|
|
|
```bash
|
|
auto-gitignore --ide vscode --ide jetbrains --os macos --os windows
|
|
```
|
|
|
|
### Add custom patterns
|
|
|
|
```bash
|
|
auto-gitignore --custom "custom_dir/" --custom "*.custom"
|
|
```
|
|
|
|
### Save to custom location
|
|
|
|
```bash
|
|
auto-gitignore --output ~/.gitignore-global
|
|
```
|
|
|
|
### Verbose mode with full detection info
|
|
|
|
```bash
|
|
auto-gitignore --verbose
|
|
```
|
|
|
|
## Supported Languages
|
|
|
|
- Python
|
|
- Node.js
|
|
- Go
|
|
- Java
|
|
- Rust
|
|
- C#
|
|
- C/C++
|
|
- Ruby
|
|
- PHP
|
|
- Dart
|
|
- Swift
|
|
- Kotlin
|
|
- Scala
|
|
- Perl
|
|
- R
|
|
- Elixir
|
|
- Clojure
|
|
- Lua
|
|
- Haskell
|
|
|
|
## Supported Frameworks
|
|
|
|
### Python
|
|
- Django
|
|
- Flask
|
|
- FastAPI
|
|
|
|
### JavaScript/TypeScript
|
|
- React
|
|
- Vue
|
|
- Angular
|
|
- Express
|
|
- Next.js
|
|
- Nuxt
|
|
- Svelte
|
|
- Gatsby
|
|
- Astro
|
|
- SvelteKit
|
|
- Remix
|
|
- Vite
|
|
- NestJS
|
|
|
|
### Go
|
|
- Gin
|
|
|
|
### Java
|
|
- Spring
|
|
|
|
### Ruby
|
|
- Rails
|
|
|
|
### PHP
|
|
- Laravel
|
|
|
|
### .NET
|
|
- .NET/C#
|
|
|
|
## IDE Support
|
|
|
|
- VSCode
|
|
- JetBrains (IntelliJ, PyCharm, WebStorm, etc.)
|
|
- Eclipse
|
|
- NetBeans
|
|
- Sublime Text
|
|
- Vim
|
|
- Emacs
|
|
- Atom
|
|
- Spacemacs
|
|
|
|
## Configuration
|
|
|
|
No configuration file required. All options can be passed via CLI flags.
|
|
|
|
## Development
|
|
|
|
```bash
|
|
# Install development dependencies
|
|
pip install -e ".[dev]"
|
|
|
|
# Run tests
|
|
pytest tests/ -v
|
|
|
|
# Run with coverage
|
|
pytest tests/ --cov=src --cov-report=term-missing
|
|
|
|
# Type checking
|
|
mypy src/
|
|
|
|
# Linting
|
|
ruff check .
|
|
```
|
|
|
|
## Contributing
|
|
|
|
1. Fork the repository
|
|
2. Create a feature branch
|
|
3. Make your changes
|
|
4. Run tests: `pytest tests/ -v`
|
|
5. Submit a pull request
|
|
|
|
## License
|
|
|
|
MIT
|