def zsh_slots

cli@0.2.0.0 · cli.bend:6788

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

6788def zsh_slots(slots: List<&2, Slot>) -> List<&2, String>:
6789  match slots:
6790    case Nil{}: Nil{}
6791    case Slot{k, True{}, required, many, rest, ph, comp} <> tail:
6792      zsh_slots(tail)
6793    case Slot{k, False{}, required, True{}, False{}, ph, comp} <> tail:
6794      String.concat(["*:", Zsh.esc(ph), ":", zsh_action(comp)]) <>
6795        zsh_slots(tail)
6796    case Slot{k, False{}, required, +many, rest, ph, comp} <> tail:
6797      String.concat([Bool.pick(String, many, "(-)", ""), Nat.show(k),
6798        Bool.pick(String, required, ":", "::"), Zsh.esc(ph), ":",
6799        zsh_action(comp)]) <> zsh_slots(tail)

Uses (9)

Used by (1)