def key_go

cli@0.2.0.0 · cli.bend:4832

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

4832# The first subcommand named by each word of text, from items down, is a
4833# command.
4834def key_go(items: List<&2, Item>, +text: String, step: KeyStep) -> Bool:
4835  match items step:
4836    case Nil{} _: False{}
4837    case head <> +tail KeyMiss{}: key_go(tail, text, key_step(tail, text))
4838    case head <> tail KeyStop{}: False{}
4839    case head <> tail KeyEnd{}: True{}
4840    case Sub{name, about, +children} <> tail KeyNext{+rest}:
4841      key_go(children, rest, key_step(children, rest))
4842    case _ _: False{}

Uses (6)

Used by (1)