Gen-CLI is a Python-based command-line tool for generating boilerplate code and framework templates for multiple programming languages.
- 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
pip install gen-cligit 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]uv syncgen --version# 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 doctorShow the installed version of gen-cli.
gen --version
gen -vOutput: gen-cli version 1.0.0
Show the help message with all available commands and options.
gen --help
gen -hList all available language templates and framework templates.
gen listOutput:
Available Languages
-------------------
• .py
• .c
• .cpp
• .go
• .js
• .rs
• .html
• .java
Available Frameworks
--------------------
• flask
• codeforces
Check your environment and configuration for potential issues.
gen doctorOutput:
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
Display a colorful tree view of your directory structure.
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 dirTree 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
Generate a boilerplate file for a specific language.
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.htmlOptions:
| Flag | Description |
|---|---|
--dryrun |
Preview the file content without creating it |
--overwrite |
Overwrite existing file |
Examples:
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:
gen c
main.c already exists
Use --overwrite to replace: gen c --overwriteGenerate a full project from a framework template.
gen flask # prompts for project name
gen flask myapp # creates myapp/ directly
gen codeforces # prompts for project name
gen codeforces solutions # creates solutions/ directlyOptions:
| Flag | Description |
|---|---|
--dryrun |
Preview project structure without creating |
--overwrite |
Remove existing directory and regenerate |
Examples:
gen flask --dryrun # preview flask project tree
gen flask myapp --dryrun # preview tree for 'myapp'
gen flask myapp --overwrite # overwrite myapp/ if existsWhen directory already exists:
gen flask myapp
Directory 'myapp' already exists
Use --overwrite to replace: gen flask myapp --overwrite| 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 |
| Command | Description |
|---|---|
gen flask |
Flask web application |
gen codeforces |
Codeforces competitive programming setup |
Gen-CLI provides clear error messages for common issues:
# 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: nonexistentuv sync --all-extras# Run all tests
uv run pytest tests -v
# Run specific test file
uv run pytest tests/test_cli.py -vuv run gen <command>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
MIT License
Prasad Raju G