Skip to main content

Module ops

Module ops 

Source
Expand description

Persistence operations backed by a plain JSON file.

Settings are stored at ~/.config/gitkraft/settings.json (or the platform-appropriate config directory). Writes are atomic: content is first written to a .tmp sibling and then renamed into place, so a crash mid-write can never produce a corrupted file.

GUI settings are stored in settings.json; TUI settings are stored in tui-settings.json. The two files are independent so each UI can evolve its own preferences (theme index, session, etc.) without stomping the other.

Functions§

get_last_repo
Return the last opened repository path, if any.
get_last_tui_repo
Return the last TUI-opened repository path, if any.
get_saved_editor
Return the saved editor name, if any.
get_saved_layout
Return saved layout preferences, if any.
get_saved_theme
Return the saved theme name, if any.
load_settings
Load GUI application settings.
load_tui_settings
Load TUI application settings from tui-settings.json.
record_repo_and_save_session
Record that a repo was opened AND update the open-tab session in a single write (saves one round-trip to disk).
record_repo_opened
Record that a repository was opened (updates history + last_repo).
record_repo_opened_tui
Record that a repository was opened in the TUI.
save_editor
Persist the selected editor name.
save_editor_tui
Persist the TUI editor selection.
save_layout
Persist layout preferences.
save_session
Persist the open-tab session without modifying the recent-repos list.
save_session_tui
Persist the TUI open-tab session.
save_settings
Persist GUI application settings to settings.json using an atomic write.
save_theme
Persist the selected theme name.
save_theme_tui
Persist the TUI theme selection.
save_tui_settings
Persist TUI application settings to tui-settings.json using an atomic write.
settings_dir
Returns the settings directory (~/.config/gitkraft/ or equivalent).
settings_json_path
Full path to the GUI JSON settings file (public so frontends can open it in an editor).
tui_settings_json_path
Full path to the TUI-specific JSON settings file (public so the TUI can open it in an editor).