Module

cli.commands.new.site

Site creation command and logic.

Creates new Bengal sites with optional structure initialization.

Functions

create_site
Core logic for creating a new site. 🏗️ Create a new Bengal site with optional structure initializ…
5 None
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 5

Name Type Default 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
Prompt user for base URL or return default.
2 str
def _prompt_for_baseurl(no_init: bool, cli: CLIOutput) -> str

Prompt user for base URL or return default.

Parameters 2

Name Type Default Description
no_init bool
cli CLIOutput

Returns

str

_determine_template
Determine the effective template based on wizard selection.
3 tuple[str, bool, st…
def _determine_template(template: str, no_init: bool, init_preset: str | None) -> tuple[str, bool, str | None]

Determine the effective template based on wizard selection.

Parameters 3

Name Type Default Description
template str
no_init bool
init_preset str | None

Returns

tuple[str, bool, str | None]

Tuple of (effective_template, is_custom, wizard_selection)

_create_directory_structure
Create the site directory structure.
2 None
def _create_directory_structure(site_path: Path, site_template: SiteTemplate) -> None

Create the site directory structure.

Parameters 2

Name Type Default Description
site_path Path
site_template SiteTemplate
_create_template_files
Create files from template. Returns count of files created.
2 int
def _create_template_files(site_path: Path, site_template: SiteTemplate) -> int

Create files from template. Returns count of files created.

Parameters 2

Name Type Default Description
site_path Path
site_template SiteTemplate

Returns

int

_show_post_creation_hints
Show hints and next steps after site creation.
6 None
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

Show hints and next steps after site creation.

Parameters 6

Name Type Default Description
cli CLIOutput
wizard_selection str | None
init_preset str | None
is_custom bool
site_dir_name str
baseurl str
site_command
Create a new Bengal site (bengal new site).
5 None
def site_command(name: str, theme: str, template: str, no_init: bool, init_preset: str) -> None

Create a new Bengal site (bengal new site).

Parameters 5

Name Type Default Description
name str
theme str
template str
no_init bool
init_preset str