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
ConfigError::FileNotFoundif the file doesn’t existConfigError::UnsupportedFormatif the extension is not recognizedConfigError::YamlParseorConfigError::JsonParseif parsing fails
§Example
use dynamic_cli::config::loader::load_config;
// Load YAML configuration
let config = load_config("commands.yaml")?;