def find_sub_key
import cli@0.2.0.0/cli.bend as Cliimport Base
3439# find_sub over a scope's subcommands; after a hit it only walks the rest.
3440def find_sub_key(subs: List<&2, SubKey>, +query: String,
3441 found: Maybe<&2, SubKey>) -> Maybe<&2, SubKey>:
3442 match subs found:
3443 case Nil{} hit: hit
3444 case key <> tail Some{hit}: Some{hit}
3445 case key <> tail None{}:
3446 find_sub_key(tail, query, sub_key_found(key, query))