Cli.sub_paths: def of cli@0.2.0.0 Import: import cli@0.2.0.0/cli.bend as Cli Lines 4939-4952 of cli@0.2.0.0/cli.bend: https://jend.leeeet.dev/read.txt?path=cli@0.2.0.0/cli.bend&start_line=4939&end_line=4952 import Base # The paths below prefix that can complete, in pre-order, without built-ins. def sub_paths(items: List<&2, Item>, +prefix: List<&2, String>) -> List<&2, List<&2, String>>: match items: case Nil{}: Nil{} case Sub{name, about, +children} <> tail: +path = List.append(&2, String, prefix, [name]) List.concat(&2, List<&2, String>, [ Bool.pick(List<&2, List<&2, String>>, Bool.or(has_builtin(children), needs_sub(children)), [], [path]), sub_paths(children, path), sub_paths(tail, prefix), ]) case head <> tail: sub_paths(tail, prefix) Uses (9): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.or https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.pick https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List.append https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List.concat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=Item https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=has_builtin https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=needs_sub