Metadata-Version: 2.4
Name: gen-cli
Version: 1.1.0
Summary: A CLI tool to generate boilerplate code and framework templates for multiple programming languages.
Author: Prasad Raju G
License: MIT License
        
        Copyright (c) 2026 Prasad Raju G
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/iamprasadraju/gen-cli
Project-URL: Repository, https://github.com/iamprasadraju/gen-cli
Project-URL: Issues, https://github.com/iamprasadraju/gen-cli/issues
Keywords: boilerplate,generator,cli,templates,scaffold
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Code Generators
Requires-Python: >=3.13
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Jinja2>=3.1.6
Provides-Extra: dev
Requires-Dist: pylint>=3.3.8; extra == "dev"
Requires-Dist: black>=25.9.0; extra == "dev"
Requires-Dist: isort>=6.1.0; extra == "dev"
Requires-Dist: pre-commit>=4.3.0; extra == "dev"
Requires-Dist: pytest>=8.4.2; extra == "dev"
Dynamic: license-file

<p align="center">
  <img src="gen-cli.svg" width="120" alt="Gen-CLI Logo">
  <br>
  <b>Gen-CLI</b> is a Python-based command-line tool for generating boilerplate code and framework templates for multiple programming languages.
</p>

<p align="center">
  <a href="https://pypi.org/project/gen-cli/"><img src="https://img.shields.io/pypi/v/gen-cli.svg" alt="PyPI Version"></a>
  <a href="https://github.com/iamprasadraju/gen-cli/actions/workflows/ci.yaml"><img src="https://github.com/iamprasadraju/gen-cli/actions/workflows/ci.yaml/badge.svg" alt="CI"></a>
  <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.13+-blue.svg" alt="Python"></a>
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License"></a>
  <a href="https://github.com/psf/black"><img src="https://img.shields.io/badge/code%20style-black-000000.svg" alt="Code style"></a>
</p>

## Features

- Single-file boilerplate generation for multiple languages
- Project scaffolding using framework templates
- Colorful directory tree visualization
- Environment diagnostics with `gen doctor`
- Dry-run mode for previewing outputs
- Overwrite support for existing files/directories

---

## Installation

### From Source

```bash
git clone https://github.com/iamprasadraju/gen-cli.git
cd gen-cli

# Install for usage
pip install -e .

# Install for development (includes tests, linting tools)
pip install -e .[dev]
```

### Using uv

```bash
uv sync
```

### Verify Installation

```bash
gen --version
```

---

## Quick Start

```bash
# Generate a C boilerplate file
gen c

# Generate a Python boilerplate file
gen py

# Generate a Flask project
gen flask

# List available languages and frameworks
gen list

# Show directory tree
gen tree

# Check your environment
gen doctor
```

---

## Commands

### `gen --version` / `gen -v`

Show the installed version of gen-cli.

```bash
gen --version
gen -v
```

Output: `gen-cli version 1.0.0`

---

### `gen --help` / `gen -h`

Show the help message with all available commands and options.

```bash
gen --help
gen -h
```

---

### `gen list`

List all available language templates and framework templates.

```bash
gen list
```

Output:
```
Available Languages
-------------------
  • .py
  • .c
  • .cpp
  • .go
  • .js
  • .rs
  • .html
  • .java

Available Frameworks
--------------------
  • flask
  • codeforces
```

---

### `gen doctor`

Check your environment and configuration for potential issues.

```bash
gen doctor
```

Output:
```
Gen CLI Doctor
----------------------------------------
✓ Python Version: 3.13.12
✓ Platform: Darwin 24.0.0
✓ Working Directory: /Users/user/project
✓ PATH directories: 17 found

All checks passed
```

---

### `gen tree`

Display a colorful tree view of your directory structure.

```bash
gen tree                    # current directory, depth 2, no hidden
gen tree -a                 # include hidden files/dirs
gen tree -3                 # depth of 3 levels
gen tree -3 src             # depth 3 of specific directory
gen tree -2 -a .            # depth 2, include hidden, current dir
```

**Tree options:**

| Flag | Description |
|------|-------------|
| `-N` | Set depth (e.g., `-2`, `-3`) |
| `-a`, `--all` | Include hidden files/dirs |

**Colors:**

- **Bold blue** — directories
- **Green** — regular files
- **Dim/gray** — hidden files and connectors

---

### Language Generation

Generate a boilerplate file for a specific language.

```bash
gen c           # creates main.c
gen py          # creates main.py
gen js          # creates main.js
gen go          # creates main.go
gen rs          # creates main.rs
gen cpp         # creates main.cpp
gen java        # creates main.java
gen html        # creates main.html
```

**Options:**

| Flag | Description |
|------|-------------|
| `--dryrun` | Preview the file content without creating it |
| `--overwrite` | Overwrite existing file |

**Examples:**

```bash
gen c --dryrun              # preview main.c content
gen py --overwrite          # overwrite main.py if exists
gen js --dryrun --overwrite # dry run (overwrite ignored)
```

**When file already exists:**

```bash
gen c
main.c already exists
Use --overwrite to replace: gen c --overwrite
```

---

### Framework Generation

Generate a full project from a framework template.

```bash
gen flask                   # prompts for project name
gen flask myapp             # creates myapp/ directly
gen codeforces              # prompts for project name
gen codeforces solutions    # creates solutions/ directly
```

**Options:**

| Flag | Description |
|------|-------------|
| `--dryrun` | Preview project structure without creating |
| `--overwrite` | Remove existing directory and regenerate |

**Examples:**

```bash
gen flask --dryrun          # preview flask project tree
gen flask myapp --dryrun    # preview tree for 'myapp'
gen flask myapp --overwrite # overwrite myapp/ if exists
```

**When directory already exists:**

```bash
gen flask myapp
Directory 'myapp' already exists
Use --overwrite to replace: gen flask myapp --overwrite
```

---

## Supported Languages

| Command | Output File |
|---------|-------------|
| `gen c` | `main.c` |
| `gen py` | `main.py` |
| `gen js` | `main.js` |
| `gen go` | `main.go` |
| `gen rs` | `main.rs` |
| `gen cpp` | `main.cpp` |
| `gen java` | `main.java` |
| `gen html` | `main.html` |

## Supported Frameworks

| Command | Description |
|---------|-------------|
| `gen flask` | Flask web application |
| `gen codeforces` | Codeforces competitive programming setup |

---

## Error Handling

Gen-CLI provides clear error messages for common issues:

```bash
# Unknown command
gen xyz
→ Unknown command: xyz
  Usage: gen [list|doctor|tree|<lang>|<framework>] [-v|--version] [-h|--help]

# Unknown flag
gen c --invalid
→ Unknown flag: --invalid
  Usage: gen [list|doctor|<lang>|<framework>] [-v|--version] [-h|--help]

# Invalid tree depth format
gen tree 3
→ Invalid depth format: '3'
  Use '-' prefix for depth, e.g., 'gen tree -3' or 'gen tree -3 src'

# Path not found
gen tree nonexistent
→ Path not found: nonexistent
```

---

## Development

### Setup

```bash
uv sync --all-extras
```

### Running Tests

```bash
# Run all tests
uv run pytest tests -v

# Run specific test file
uv run pytest tests/test_cli.py -v
```

### Running from Source

```bash
uv run gen <command>
```

---

## Project Structure

```
gen-cli/
├── src/
│   └── gen/
│       ├── __init__.py
│       ├── cli.py              # Main CLI entry point
│       ├── paths.py            # Template path resolution
│       ├── commands/
│       │   ├── __init__.py
│       │   ├── doctor.py       # Environment diagnostics
│       │   ├── helper.py       # Help messages
│       │   ├── list_.py        # Template listing & tree view
│       │   └── template.py     # Template generation helpers
│       ├── core/
│       │   ├── __init__.py
│       │   └── render.py       # Jinja2 template rendering
│       └── templates/          # Built-in templates
│           ├── lang/           # Language boilerplate files
│           └── frameworks/     # Framework project templates
├── tests/
│   └── test_*.py               # Unit tests
├── pyproject.toml
└── README.md
```

---

## License

MIT License

---

## Author

Prasad Raju G
