Alaja.Config (Alaja v1.0.0)

Copy Markdown View Source

Configuration management for Alaja CLI applications.

Values are read from ~/.config/alaja/alaja.conf on first access and kept in the Application environment for the lifetime of the process. set/2 writes through to both the in-memory store and the conf file.

Usage

Alaja.Config.get(:color_depth, :truecolor)
Alaja.Config.set(:color_depth, :xterm256)
Alaja.Config.all()

Summary

Functions

Returns all configuration values (merged defaults + env + file).

Returns the path to the config file.

Gets a configuration value with fallback.

Returns available theme names.

Loads a theme by name.

Sets a configuration value.

Functions

all()

@spec all() :: keyword()

Returns all configuration values (merged defaults + env + file).

config_file_path()

@spec config_file_path() :: String.t()

Returns the path to the config file.

get(key, default \\ nil)

@spec get(atom(), any()) :: any()

Gets a configuration value with fallback.

list_themes()

@spec list_themes() :: [String.t()]

Returns available theme names.

load_theme(name)

@spec load_theme(String.t()) :: {:ok, map()} | {:error, term()}

Loads a theme by name.

set(key, value)

@spec set(atom(), any()) :: :ok

Sets a configuration value.

If the key is in the list of persistent keys it is also written to ~/.config/alaja/alaja.conf. Always updates the in-memory store.