load_config

Function load_config 

Source
pub fn load_config<P: AsRef<Path>>(path: P) -> Result<CommandsConfig>
Expand description

Load configuration from a file

Automatically detects the format (YAML or JSON) based on the file extension and parses the content accordingly.

§Supported Extensions

  • .yaml, .yml → YAML parser
  • .json → JSON parser

§Arguments

  • path - Path to the configuration file

§Returns

Parsed CommandsConfig on success

§Errors

§Example

use dynamic_cli::config::loader::load_config;

// Load YAML configuration
let config = load_config("commands.yaml")?;