Skip to main content

build_runtime_pipeline

Function build_runtime_pipeline 

Source
pub fn build_runtime_pipeline(
    defaults: ConfigLayer,
    presentation: Option<ConfigLayer>,
    paths: &RuntimeConfigPaths,
    load: RuntimeLoadOptions,
    cli: Option<ConfigLayer>,
    session: Option<ConfigLayer>,
) -> LoaderPipeline
Expand description

Assembles the runtime loader precedence stack for CLI startup.

The ordering encoded here is part of the config contract: defaults first, then optional presentation/env/file/secrets layers, then CLI/session overrides last.

This is the normal bootstrap path for hosts that want the crate’s standard platform/env/file loading semantics without manually wiring each loader.

§Examples

use osp_cli::config::{
    ResolveOptions, RuntimeConfigPaths, RuntimeDefaults, RuntimeLoadOptions,
    build_runtime_pipeline,
};

let defaults = RuntimeDefaults::from_process_env("dracula", "osp> ").to_layer();
let paths = RuntimeConfigPaths::discover();
let presentation = None;
let cli = None;
let session = None;

let resolved = build_runtime_pipeline(
    defaults,
    presentation,
    &paths,
    RuntimeLoadOptions::default(),
    cli,
    session,
)
.resolve(ResolveOptions::new().with_terminal("cli"))?;

assert_eq!(resolved.terminal(), Some("cli"));