def arg_slots
cli@0.2.0.0 · cli.bend:6406
import cli@0.2.0.0/cli.bend as Cli
import Base
6406
6407def arg_slots(items: List<&2, Item>, +k: Nat,
6408 +lists: List<&2, List<&2, String>>) -> List<&2, Slot>:
6409 match items:
6410 case Nil{}: Nil{}
6411 case Arg{+usage, help, attrs} <> tail:
6412 +parsed = parse_usage(usage)
6413 List.append(&2, Slot, pos_slot(parsed, k, usage, attrs, lists),
6414 arg_slots(tail, Bool.pick(Nat, usage_kind(~kind_pos, parsed),
6415 (k + 1n : Nat), k), lists))
6416 case head <> tail: arg_slots(tail, k, lists)