Skip to main content

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 for multiple programming languages.

Features

  • Single-file boilerplate generation based on file extension
  • Project scaffolding using language and framework templates
  • Directory tree visualization
  • Environment diagnostics with gen doctor
  • Version information with --version / -v
  • Dry-run mode for previewing outputs

Installation

Using pip

pip install gen-cli

Using uv (Faster)

uv pip install gen-cli

Using pipx (Isolated)

pipx install gen-cli

From Source

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]

Verify Installation

gen --version

Quick Start

# Generate a Python file
gen main.py

# Generate a FastAPI project
gen new myapp --lang python --template fastapi

# Check your environment
gen doctor

# List available templates
gen list

# Show version
gen --version

Commands

gen --version / gen -v

Show the installed version of gen-cli.

gen --version
gen -v

Output: gen-cli version 0.1.7


gen --help / gen -h / gen help

Show the help message.

gen --help
gen -h
gen help

gen doctor

Check your environment and configuration for potential issues.

gen doctor

Output:

========================================
Gen CLI Doctor
========================================
Python Version: 3.14.2
Platform: macOS-15.7.3-arm64
Working Directory: /Users/user/project
PATH directories: 17
========================================
All checks passed!

gen list

List all available language templates and framework templates.

gen list

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

# Rust projects
gen new server --lang rust --template actix
gen new mylib --lang rust --template rocket

# JavaScript projects
gen new app --lang javascript --template react
gen new api --lang javascript --template node

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

Options:

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

Examples:

gen main.py --dryrun          # Preview Python file
gen app.py --overwrite        # Overwrite existing file

Supported Languages & Templates

Language Templates
Python flask, fastapi, django, lib, project
Go cli, web
Rust actix, rocket
C standard
C++ standard
Java spring, standard
JavaScript node, react, vue
HTML standard

File Extensions

Extension Language
.py Python
.go Go
.rs Rust
.c C
.cpp C++
.java Java
.js JavaScript
.html HTML

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
  • Existing files/directories → Shows appropriate message

Development

Setup

First, ensure you have installed the development dependencies:

pip install -e .[dev]

Running Tests

# Run all tests
python3 -m pytest tests -v

# Run specific test
python3 -m pytest tests/test_list.py -v

Test Coverage

Test Class Description
TestCLI Core CLI module tests
TestVersion Version command tests
TestFilenameMode Single file generation tests
TestDoctor Environment diagnostics tests
TestListCommand Template listing tests
TestTreeCommand Tree visualization tests
TestTemplateCommand Template generation tests
TestConfig Configuration tests
TestCore Core module tests
TestHelper Help command tests
TestMain Main entry point tests

Running from Source

python3 -m gen.cli <command>

Project Structure

gen-cli/
├── src/
│   └── gen/
│       ├── __init__.py
│       ├── cli.py              # Main CLI entry point
│       ├── config.py           # Configuration & extension maps
│       ├── commands/
│       │   ├── __init__.py
│       │   ├── doctor.py       # Environment diagnostics
│       │   ├── helper.py       # Help messages
│       │   ├── list_.py        # Template listing
│       │   └── template.py     # Template generation
│       ├── core/
│       │   ├── __init__.py
│       │   └── render.py       # Jinja2 template rendering
│       └── templates/          # Built-in templates
├── tests/
│   └── test_cli.py             # Comprehensive unit tests
├── pyproject.toml
└── README.md

License

MIT License


Author

Prasad Raju G

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gen_cli-1.0.0.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gen_cli-1.0.0-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file gen_cli-1.0.0.tar.gz.

File metadata

  • Download URL: gen_cli-1.0.0.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","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

Hashes for gen_cli-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a4a7753db7c24611f0bc77792c7074c6eb09dc2e925ad96bfd2844575176dfed
MD5 c9260f36a81d880de7f482c591f01059
BLAKE2b-256 f71956eeb8a8d7106e4eae0e2f6af1915465e70355ce747293e0a28a548b957e

See more details on using hashes here.

File details

Details for the file gen_cli-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: gen_cli-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","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

Hashes for gen_cli-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec0bb020e77524fce2c97ef7784a85c2228cdec67a180e2cccd591f9e41c8c1b
MD5 71ef054d5764d02529823296fee2aebb
BLAKE2b-256 869138ddfe7d7929935387b46c6108e22c9f7e12003f79471782beaf50c9e2c0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page