Raxol.Terminal.Config.Persistence (Raxol v0.2.0)

View Source

Handles loading and saving terminal configuration.

Provides functions for persisting configuration to disk and loading it back.

Summary

Functions

Loads terminal configuration from the default path.

Loads terminal configuration from the specified path.

Parses configuration from JSON string.

Saves terminal configuration to the default path.

Saves terminal configuration to the specified path.

Functions

load_config()

Loads terminal configuration from the default path.

If the configuration file doesn't exist, returns the default configuration.

Returns

{:ok, config} or {:error, reason}

load_config(path)

Loads terminal configuration from the specified path.

If the configuration file doesn't exist, returns the default configuration.

Parameters

  • path - The file path to load from

Returns

{:ok, config} or {:error, reason}

parse_config(json)

Parses configuration from JSON string.

Parameters

  • json - The JSON string to parse

Returns

{:ok, config} or {:error, reason}

save_config(config)

Saves terminal configuration to the default path.

Parameters

  • config - The configuration to save

Returns

:ok or {:error, reason}

save_config(config, path)

Saves terminal configuration to the specified path.

Parameters

  • config - The configuration to save
  • path - The file path to save to

Returns

:ok or {:error, reason}