def args.dups

shake@0.7.0.0 · src/check.bend:60

import shake@0.7.0.0/src/check.bend as Check
import Base
import shake@0.7.0.0/src/cli.bend as C

60# each argument's name and spellings against the earlier ones', and its
61# default against its choices
62def args.dups(
63  args: List<&2, C.Arg>,
64  +path: List<&2, String>,
65  +names: List<&2, String>,
66  +shorts: List<&2, String>,
67  +longs: List<&2, String>
68) -> List<&2, SpecErr>:
69  match args:
70    case Nil{}:
71      []
72    case Con{hh, tt}:
73      C.Arg{+name, +short, +long, _k, _h, _r, C.Fallback{_e, dflt}, +cs} = hh
74      both(one(List.contains(~String, ~String.eq, names, name), SameName{path, name}),
75        both(one(spelled.seen(short, shorts), SameShort{path, C.text.of(short, "")}),
76          both(one(spelled.seen(long, longs), SameLong{path, C.text.of(long, "")}),
77            both(args.default(dflt, cs, path, name),
78              args.dups(tt, path, name <> names, spelled.add(short, shorts),
79                spelled.add(long, longs))))))

Uses (13)

Used by (1)