def sub_paths

cli@0.2.0.0 · cli.bend:4939

import cli@0.2.0.0/cli.bend as Cli
import Base

4939# The paths below prefix that can complete, in pre-order, without built-ins.
4940def sub_paths(items: List<&2, Item>, +prefix: List<&2, String>) ->
4941    List<&2, List<&2, String>>:
4942  match items:
4943    case Nil{}: Nil{}
4944    case Sub{name, about, +children} <> tail:
4945      +path = List.append(&2, String, prefix, [name])
4946      List.concat(&2, List<&2, String>, [
4947        Bool.pick(List<&2, List<&2, String>>,
4948          Bool.or(has_builtin(children), needs_sub(children)), [], [path]),
4949        sub_paths(children, path),
4950        sub_paths(tail, prefix),
4951      ])
4952    case head <> tail: sub_paths(tail, prefix)

Uses (9)

Used by (1)