Module

cli.commands.new.site

Site creation command and logic.

Creates new Bengal sites with optional structure initialization.

Functions

create_site 5 None
Core logic for creating a new site. 🏗️ Create a new Bengal site with optional…
def create_site(name: str | None, theme: str, template: str, no_init: bool, init_preset: str | None) -> None

Core logic for creating a new site.

🏗️ Create a new Bengal site with optional structure initialization.

Creates a new site directory with configuration, content structure, and optional sample content. Use --template to choose a preset layout.

Parameters
Name Type Description
name str | None

Site name (or None to prompt)

theme str

Theme to use

template str

Site template name

no_init bool

Skip structure initialization wizard

init_preset str | None

Preset name if provided via flag

_prompt_for_baseurl 2 str
Prompt user for base URL or return default.
def _prompt_for_baseurl(no_init: bool, cli: CLIOutput) -> str
Parameters
Name Type Description
no_init bool
cli CLIOutput
Returns
str
_determine_template 3 tuple[str, bool, str | N…
Determine the effective template based on wizard selection.
def _determine_template(template: str, no_init: bool, init_preset: str | None) -> tuple[str, bool, str | None]
Parameters
Name Type Description
template str
no_init bool
init_preset str | None
Returns
tuple[str, bool, str | None]
_create_directory_structure 2 None
Create the site directory structure.
def _create_directory_structure(site_path: Path, site_template: SiteTemplate) -> None
Parameters
Name Type Description
site_path Path
site_template SiteTemplate
_create_template_files 2 int
Create files from template. Returns count of files created.
def _create_template_files(site_path: Path, site_template: SiteTemplate) -> int
Parameters
Name Type Description
site_path Path
site_template SiteTemplate
Returns
int
_show_post_creation_hints 6 None
Show hints and next steps after site creation.
def _show_post_creation_hints(cli: CLIOutput, wizard_selection: str | None, init_preset: str | None, is_custom: bool, site_dir_name: str, baseurl: str) -> None
Parameters
Name Type Description
cli CLIOutput
wizard_selection str | None
init_preset str | None
is_custom bool
site_dir_name str
baseurl str
site_command 5 None
Create a new Bengal site (bengal new site).
def site_command(name: str, theme: str, template: str, no_init: bool, init_preset: str) -> None
Parameters
Name Type Description
name str
theme str
template str
no_init bool
init_preset str