Gen-CLI is a Python-based tool to generate boilerplate code and framework templates for multiple programming languages.
Project description
Gen-CLI
Gen-CLI is a Python-based command-line tool for generating boilerplate code and framework templates across multiple programming languages.
Features
- Generate single-file boilerplates from file extensions
- Scaffold complete projects using language and framework templates
- Visualize directory structures with the tree command
- Diagnose environment issues with the doctor command
Installation
Using pip (Recommended)
pip install gen-cli
Or with pip3:
pip3 install gen-cli
Using uv (Faster alternative)
uv pip install gen-cli
Using pipx (Isolated CLI tools)
pipx install gen-cli
From Source
git clone https://github.com/yourname/gen-cli.git
cd gen-cli
pip install -e .
Verify Installation
gen --help
Quick Start
# Generate a Python file
gen main.py
# Generate a FastAPI project
gen new myapp --lang python --template fastapi
# List available templates
gen list
# Check your environment
gen doctor
Commands
gen help
Show the help message.
gen help
gen --help
gen -h
gen list
List all available language and framework templates.
gen list
gen doctor
Check your environment and configuration for potential issues.
gen doctor
gen tree
Display a tree view of your directory structure.
gen tree # current directory
gen tree -r # recursive (all levels)
gen tree -d 3 # depth of 3 levels
gen tree path/to/dir # specific directory
gen new
Generate a new project from a language and framework template.
gen new <project_name> --lang <language> --template <template>
Options:
| Flag | Description | Required |
|---|---|---|
--lang |
Programming language | Yes |
--template |
Framework or template name | Yes |
--dryrun |
Preview without creating files | No |
Examples:
# Python projects
gen new myapp --lang python --template fastapi
gen new api --lang python --template flask
gen new web --lang python --template django
# Go projects
gen new mytool --lang go --template cli
gen new service --lang go --template web
# Other languages
gen new server --lang rust --template actix
gen new mylib --lang rust --template rocket
gen new app --lang javascript --template react
Note: Both
--langand--templateflags are required.
Single File Generation
Generate a boilerplate file directly by specifying its extension.
gen main.py # Python file
gen app.go # Go file
gen index.js # JavaScript file
gen main.rs # Rust file
gen main.c # C file
gen main.cpp # C++ file
gen main.java # Java file
gen index.html # HTML file
The tool automatically detects the appropriate template based on the file extension.
Supported Languages & Templates
| Language | Templates |
|---|---|
| Python | flask, fastapi, django |
| Go | cli, web |
| Rust | actix, rocket |
| C | standard |
| C++ | standard |
| Java | spring, standard |
| JavaScript | node, react, vue |
| HTML | standard |
Error Handling
Gen-CLI provides clear error messages for common issues:
- Invalid commands → Displays help message
- Unsupported file extensions → Lists available templates
- Invalid template combinations → Shows valid options
- Tree errors → Falls back to current directory
Project Structure
gen-cli/
├── src/
│ └── gen/
│ ├── cli.py # Main CLI entry point
│ ├── commands/
│ │ ├── doctor.py # Environment diagnostics
│ │ ├── helper.py # Help messages
│ │ ├── list_.py # Template listing
│ │ └── template.py # Template generation
│ ├── config.py # Configuration & extension maps
│ ├── core/
│ │ └── render.py # Jinja2 template rendering
│ └── templates/ # Built-in templates
├── tests/
│ └── test_cli.py # Unit tests
├── pyproject.toml
└── README.md
Development
Running Tests
python -m unittest tests.test_cli -v
Running from Source
python -m gen.cli <command>
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gen_cli-0.1.7.tar.gz.
File metadata
- Download URL: gen_cli-0.1.7.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19714367c5db53081a88e93766a05fa585910bd88680dbc2597b5d22791bf5c2
|
|
| MD5 |
f161c99e7ee470db322ee03fc87d0313
|
|
| BLAKE2b-256 |
90162d11bf0c5aeffac06c1215f7f570f6be760c8bf24f91463e3472581bc9c4
|
File details
Details for the file gen_cli-0.1.7-py3-none-any.whl.
File metadata
- Download URL: gen_cli-0.1.7-py3-none-any.whl
- Upload date:
- Size: 18.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
100abf34e9c45ad3f0b3599f8025bed79d37c73d3d6ce63fb622edac5d44231f
|
|
| MD5 |
a7c6df8ff87262fa42429d82c5a89718
|
|
| BLAKE2b-256 |
33b39a78ee8ddf02bfa1cd73f65f68aa845ed894496f98ef093c573bd03992ad
|