Function run

Source
pub fn run<P: AsRef<Path>>(
    config_path: P,
    query_path: &str,
    options: QueryOptions,
    adapter: &impl ConfigPort,
) -> Result<Option<String>>
Expand description

Queries a theme value by path.

Loads the configuration, validates it, and extracts the value at the specified path. Returns None if the path is not recognized.

§Arguments

  • config_path — Path to the configuration file
  • query_path — Dot-separated path to the value (e.g., “colors.accent”)
  • options — Query options
  • adapter — Configuration adapter for loading TOML

§Returns

  • Ok(Some(value)) — Path found, value returned as string
  • Ok(None) — Path not recognized
  • Err(FernError) — Configuration error

§Example

ⓘ
use fernctl::commands::query::{run, QueryOptions};
use fernctl::adapters::TomlConfigAdapter;

let adapter = TomlConfigAdapter::new();
let options = QueryOptions::default();

match run(&config_path, "colors.accent", options, &adapter)? {
    Some(value) => println!("{}", value),
    None => eprintln!("Unknown path"),
}