Skip to content

project

FreeBodyEngine.cli.project #

REGISTRY_DIR = os.path.join(os.path.expanduser('~'), 'FreeBodyEngine') module-attribute #

REGISTRY_PATH = os.path.join(REGISTRY_DIR, 'projects.json') module-attribute #

ProjectRegistry(registry_path=REGISTRY_PATH) #

Tracks every FreeBody project the CLI knows about (id, name, absolute path) in a single JSON file at registry_path. Entries whose path no longer exists on disk are dropped automatically on load.

Loads (creating if necessary) the registry file at registry_path.

projects = self._load() instance-attribute #

registry_path = registry_path instance-attribute #

add_project(path, name) #

Registers a project at path under name, assigning it a new id. A no-op if path (compared as an absolute path) is already tracked.

get_project_by_id(proj_id) #

Returns the full registry entry ({"id", "name", "path"}) for this id, or None if it doesn't exist.

get_project_config(id) #

Reads and parses the given project's fbproject.toml.

get_project_id(name) #

Returns the id of the project named name (case-insensitively), or None if none matches.

get_project_name(id) #

Returns the name of the project with this id, or None if no project has that id.

get_project_path(id) #

Returns the absolute path of the project with this id, or None if no project has that id.

list_projects() #

Returns a "<id> - <name>: "<path>"" display line for every registered project.

project_exists(id) #

True if a project with this id is registered.

remove_project_by_id(proj_id) #

Removes the project with this id from the registry and persists the change.