Skip to main content

Module dispatch

Module dispatch 

Source
Expand description

Top-level command dispatch: routing argv to built-ins vs. manifest entries, resolving the three command kinds (run / path / preset). Pure command-graph dispatch.

walk_commands is the outer walker: it chases an arbitrarily nested commands: graph starting from a top-level name + tail, and returns a WalkOutcome describing what the caller should do (run a script, spawn an entry, print help, error out, …). The walker performs no IO of its own: no process spawning, no stdout writes, no cwd reads.

classify_path_step is the inner classifier used by walk_commands for the Path arm: loads the child fdl.yml and inspects the tail to decide whether to descend, render help, refresh the schema cache, or forward to the entry.

Keeping all impure actions (printing, spawning) in the caller makes both functions straight-line and unit-testable against tempdir fixtures.

Enums§

PathOutcome
What a single Path-kind step resolved to. Every variant holds the loaded child config when applicable, so the caller doesn’t re-load.
WalkOutcome
What the outer walker resolved a user invocation to. The caller owns every impure action (spawning, printing, exit code); the walker just returns the terminal state.

Functions§

classify_path_step
Classify a Path-kind step. Pure: loads the child config, inspects the tail, and returns the matching PathOutcome. The caller owns every side effect (printing, spawning).
walk_commands
Walk the command graph from a top-level name and produce a WalkOutcome. Every transition is pure: the walker never spawns a process, prints to stdout, or reads the process cwd. Inputs carry all the context needed.