cli
repo_scaffold.cli ¶
Repository scaffolding CLI tool.
This module provides a command-line interface for creating new projects from templates. It serves as the main entry point for the repo-scaffold tool.
Example
To use this module as a CLI tool:
# List available templates
$ repo-scaffold list
# Create a new project
$ repo-scaffold create python
To use this module in your code:
cli ¶
Modern project scaffolding tool.
Provides multiple project templates for quick project initialization.
Use repo-scaffold list
to view available templates,
or repo-scaffold create <template>
to create a new project.
Source code in repo_scaffold/cli.py
create ¶
Create a new project from a template.
Creates a new project based on the specified template. If no template is specified, displays a list of available templates. The project generation process is interactive and will prompt for necessary configuration values.
PARAMETER | DESCRIPTION |
---|---|
template
|
Template name or title (e.g., 'template-python' or 'python')
TYPE:
|
output_dir
|
Target directory where the project will be created
TYPE:
|
Example
Create a Python project:
Specify output directory:
View available templates:
Source code in repo_scaffold/cli.py
get_package_path ¶
Get absolute path to a resource in the package.
PARAMETER | DESCRIPTION |
---|---|
relative_path
|
Path relative to the package root
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
Absolute path to the resource
TYPE:
|
Source code in repo_scaffold/cli.py
list ¶
List all available project templates.
Displays the title and description of each template to help users choose the appropriate template for their needs.
Example
Source code in repo_scaffold/cli.py
load_templates ¶
Load available project templates configuration.
Reads template configurations from the cookiecutter.json file in the templates directory. Each template contains information about its name, path, title, and description.
RETURNS | DESCRIPTION |
---|---|
Dict[str, Any]
|
Dict[str, Any]: Template configuration dictionary where keys are template names and values are template information: { "template-name": { "path": "relative/path", "title": "Template Title", "description": "Template description" } } |
RAISES | DESCRIPTION |
---|---|
FileNotFoundError
|
If the configuration file doesn't exist |
JSONDecodeError
|
If the configuration file is not valid JSON |