parse_config

Function parse_config 

Source
pub fn parse_config(
    engine: &mut Engine,
    script: &str,
) -> Result<NuScriptConfig, Error>
Expand description

Parse a script into a NuScriptConfig struct.

This function parses a Nushell script, loads its defined modules, and extracts the run closure and the full configuration value.

The process involves:

  1. A first pass evaluation of the script to extract modules definitions.
  2. Loading these modules into the provided engine.
  3. A second pass evaluation (of the main script block) to obtain the run closure (which can now reference the loaded modules) and the script’s full output Value.