Skip to main content

load_layers

Function load_layers 

Source
pub fn load_layers<P: AsRef<Path>>(
    paths: &[P],
    input_format: Option<Format>,
) -> Result<(Vec<Value>, Vec<Format>)>
Expand description

Reads and parses every positional into the merge IR, keeping the format each input was read as.

A path equal to STDIN reads standard input and therefore requires an explicit input_format; otherwise the format is inferred from the extension unless input_format overrides it. JSON and TOML may be mixed.

The formats are returned because a caller may have a decision to make before the fold, and they are the input to it: knf-cli resolves the output format here. A missing -f is a mistake in argv alone, and reporting it must not wait behind a merge conflict the user would otherwise fix first, only to learn about the flag on the next run.