Cli.descendant: def of cli@0.2.0.0 Import: import cli@0.2.0.0/cli.bend as Cli Lines 5925-5935 of cli@0.2.0.0/cli.bend: https://jend.leeeet.dev/read.txt?path=cli@0.2.0.0/cli.bend&start_line=5925&end_line=5935 import Base # T2: the first subcommand in pre-order whose args take the long. def descendant(items: List<&2, Item>, +prefix: String, +long: String, found: Maybe<&2, String>) -> Maybe<&2, String>: match items found: case _ Some{path}: Some{path} case Nil{} None{}: None{} case Sub{name, about, +children} <> tail None{}: +path = String.concat([prefix, " ", name]) descendant(tail, prefix, long, descendant(children, path, long, owned(find_option(children, long), path))) case head <> tail None{}: descendant(tail, prefix, long, None{}) Uses (7): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.concat 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=find_option https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=owned