def heading_titles

cli@0.2.0.0 · cli.bend:5464

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

5464# Headings of visible args, in order of first use.
5465def heading_titles(items: List<&2, Item>, +seen: List<&2, String>) ->
5466    List<&2, String>:
5467  match items:
5468    case Nil{}: seen
5469    case Arg{usage, help, +attrs} <> tail:
5470      +title = find_heading(attrs)
5471      heading_titles(tail, Bool.pick(List<&2, String>,
5472        Bool.or(String.is_empty(title), Bool.or(has_hidden(attrs),
5473          List.contains(~String, ~String.eq, seen, title))),
5474        seen, List.append(&2, String, seen, [title])))
5475    case head <> tail: heading_titles(tail, seen)

Uses (11)

Used by (2)