def forest
import shake@0.7.0.0/src/check.bend as Checkimport Base
import shake@0.7.0.0/src/cli.bend as C
126# every subcommand's reports, each under its own path, depth first. The path
127# is carried reversed, innermost name first, and read the right way round
128# once per command
129def forest(subs: List<&2, C.Sub>, +back: List<&2, String>) -> List<&2, SpecErr>:
130 match subs:
131 case Nil{}:
132 []
133 case Con{hh, tt}:
134 C.Sub{+name, _a, +args, +kids} = hh
135 +here = pushed(name, back)
136 both(cmd(List.reverse(&2, String, here), args, kids),
137 both(forest(kids, here), forest(tt, back)))