def zsh_help_arms
cli@0.2.0.0 · cli.bend:6873
import cli@0.2.0.0/cli.bend as Cli
import Base
6873
6874
6875def zsh_help_arms(items: List<&2, Item>, +name: String,
6876 +words: List<&2, String>, +depth: Nat, +ind: String) -> List<&2, String>:
6877 match items:
6878 case Nil{}: Nil{}
6879 case Sub{+sub, about, +children} <> tail:
6880 +here = List.append(&2, String, words, [sub])
6881 +entries = sub_entries(children)
6882 List.append(&2, String,
6883 Bool.pick(List<&2, String>,
6884 Bool.or(has_hidden(children), List.is_empty(&2, Entry, entries)), [],
6885 String.concat([ind, bar_names(sub <> find_aliases(children)), ")"]) <>
6886 last_with(zsh_help_tree(entries, zsh_label(name, here),
6887 zsh_help_arms(children, name, here, (depth + 1n : Nat),
6888 String.append(ind, " ")),
6889 (depth + 1n : Nat), String.append(ind, " ")), " ;;")),
6890 zsh_help_arms(tail, name, words, depth, ind))
6891 case head <> tail: zsh_help_arms(tail, name, words, depth, ind)