Raxol.Terminal.Config (Raxol v0.4.0)

View Source

Terminal configuration system.

This module is the main entry point for terminal configuration, providing a simplified interface to the underlying configuration modules.

Summary

Functions

Applies a configuration to the terminal.

Applies a partial configuration update to the terminal.

Returns the configuration schema.

Detects terminal capabilities based on the environment.

Generates a default configuration based on terminal capabilities.

Gets the current terminal configuration.

Returns the type information for a specific configuration path.

Lists all available terminal configuration profiles.

Loads terminal configuration from the default path.

Loads terminal configuration from the specified path.

Loads a specific terminal configuration profile.

Merges configuration options into an existing configuration map.

Creates an optimized configuration based on detected capabilities.

Resets terminal configuration to default values.

Saves terminal configuration to the default path.

Saves terminal configuration to the specified path.

Saves the current configuration as a profile.

Validates a complete terminal configuration.

Validates a specific configuration value against its schema.

Functions

apply_config(config, terminal_pid \\ nil)

Applies a configuration to the terminal.

Parameters

  • config - The configuration to apply
  • terminal_pid - The PID of the terminal process (optional)

Returns

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

apply_partial_config(partial_config, terminal_pid \\ nil)

Applies a partial configuration update to the terminal.

Parameters

  • partial_config - The partial configuration to apply
  • terminal_pid - The PID of the terminal process (optional)

Returns

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

config_schema()

Returns the configuration schema.

Returns

A map defining the structure and types for all configuration options.

detect_capabilities()

Detects terminal capabilities based on the environment.

Returns

A map of detected capabilities.

generate_default_config()

Generates a default configuration based on terminal capabilities.

Returns

A map containing default configuration values for all settings.

get_current_config(terminal_pid \\ nil)

Gets the current terminal configuration.

Parameters

  • terminal_pid - The PID of the terminal process (optional)

Returns

The current terminal configuration.

get_type(path)

Returns the type information for a specific configuration path.

Parameters

  • path - A list of keys representing the path to the configuration value

Returns

A tuple with type information or nil if the path doesn't exist

list_profiles()

Lists all available terminal configuration profiles.

Returns

A list of profile names.

load_config()

Loads terminal configuration from the default path.

Returns

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

load_config(path)

Loads terminal configuration from the specified path.

Parameters

  • path - The file path to load from

Returns

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

load_profile(name)

Loads a specific terminal configuration profile.

Parameters

  • name - The name of the profile to load

Returns

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

merge_opts(config, opts)

Merges configuration options into an existing configuration map.

Delegates to Raxol.Terminal.Config.Utils.merge_opts/2.

optimized_config()

Creates an optimized configuration based on detected capabilities.

Returns

An optimized configuration for the current terminal.

reset_config(terminal_pid \\ nil, optimize \\ true)

Resets terminal configuration to default values.

Parameters

  • terminal_pid - The PID of the terminal process (optional)
  • optimize - Whether to optimize for detected capabilities (default: true)

Returns

{:ok, default_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}

save_profile(name, config)

Saves the current configuration as a profile.

Parameters

  • name - The name of the profile to save
  • config - The configuration to save

Returns

:ok or {:error, reason}

validate_config(config)

Validates a complete terminal configuration.

Parameters

  • config - The configuration to validate

Returns

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

validate_value(path, value)

Validates a specific configuration value against its schema.

Parameters

  • path - A list of keys representing the path to the configuration value
  • value - The value to validate

Returns

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