saturnin._scripts.commands.site¶
Saturnin site management commands.
This module provides Typer commands for initializing and managing the Saturnin site environment, including directory creation, configuration file handling, and listing site-specific paths.
Globals¶
Enums¶
Command functions¶
- saturnin._scripts.commands.site.create_home() None[source]¶
Creates the Saturnin ‘home’ subdirectory within the active virtual environment.
This command is typically used to establish a conventional location for Saturnin’s site-specific files when
SATURNIN_HOMEis not explicitly set and the virtual environment structure is preferred.### Important:
To have the intended effect on the directory scheme used by
initialize, this command should be executed before theinitializecommand.- Return type:
None
- saturnin._scripts.commands.site.initialize(*, new_config: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x799ce45ac750>] = False, yes: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x799ce441c8d0>] = False) None[source]¶
Initializes the Saturnin environment and directory structure.
This command creates all standard directories required by Saturnin (for configuration, data, logs, etc.) and generates default configuration files (e.g.,
saturnin.conf,theme.conf).#### Important Considerations:
Before running
initialize, determine where Saturnin’s directories should reside:Central Home Directory: If you want all Saturnin directories to be
located under a specific central path, set the
SATURNIN_HOMEenvironment variable to this path before runninginitialize.Virtual Environment Home: If you prefer to keep Saturnin’s home
directory within its virtual environment, first execute the
create homecommand, then runinitialize.Platform Defaults: If neither
SATURNIN_HOMEis set norcreate home
has been used to create a venv-local home, Saturnin will use platform-specific default locations for its directories.
—
Using the
--new-configoption will cause existing configuration files to be renamed with abakextension before new default files are written.
- saturnin._scripts.commands.site.list_directories() None[source]¶
Lists the key directories used by Saturnin and indicates their existence. Emojis: :heavy_check_mark: (exists) / :heavy_multiplication_x: (does not exist)
- Return type:
None
- saturnin._scripts.commands.site.list_configs() None[source]¶
Lists Saturnin’s main configuration files and indicates their existence. Emojis: :heavy_check_mark: (exists) / :heavy_multiplication_x: (does not exist)
- Return type:
None
- saturnin._scripts.commands.site.list_datafiles() None[source]¶
Lists Saturnin’s key data files and indicates their existence. Emojis: :heavy_check_mark: (exists) / :heavy_multiplication_x: (does not exist)
- Return type:
None
- saturnin._scripts.commands.site.show_config(config_file: ~saturnin._scripts.commands.site.Annotated[~saturnin._scripts.commands.site._Configs, <typer.models.ArgumentInfo object at 0x799ce45a2710>])[source]¶
Displays the content of a specified Saturnin configuration file.
The content is shown with syntax highlighting appropriate for the file type (e.g., ‘.conf’ files are highlighted as INI/CFG).
- Parameters:
config_file (Annotated[_Configs, <typer.models.ArgumentInfo object at 0x799ce45f1090>])
- saturnin._scripts.commands.site.edit_config(config_file: ~saturnin._scripts.commands.site.Annotated[~saturnin._scripts.commands.site._Configs, <typer.models.ArgumentInfo object at 0x799ce45af490>])[source]¶
Opens the specified Saturnin configuration file in an external editor.
The editor used is determined by the
EDITORenvironment variable or Saturnin’s configured default editor. If changes are saved, the file is updated.- Parameters:
config_file (Annotated[_Configs, <typer.models.ArgumentInfo object at 0x799ce45ae810>])
- saturnin._scripts.commands.site.create_config(config_file: ~saturnin._scripts.commands.site.Annotated[~saturnin._scripts.commands.site._Configs, <typer.models.ArgumentInfo object at 0x799ce443bd50>], *, new_config: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x799ce443bed0>] = False)[source]¶
Creates a specified Saturnin configuration file with its default content.
If the file already exists, it will only be overwritten if
--new-configis used (in which case the original is backed up).
Functions¶
- saturnin._scripts.commands.site.ensure_dir(description: str, path: Path)[source]¶
Ensures a directory exists, creating it (and any parents) if necessary.
Prints a status message to the console indicating the action taken.
- saturnin._scripts.commands.site.ensure_config(path: Path, content: str, new_config: bool)[source]¶
Creates or updates a configuration file with the given content.
Prints status messages to the console. If
new_configis True and the file exists, the original is backed up with a ‘.bak’ suffix before writing.