def pos.order
shake@0.7.0.0 · src/check.bend:81
import shake@0.7.0.0/src/check.bend as Check
import Base
import shake@0.7.0.0/src/cli.bend as C
81
82
83def pos.order(
84 pos: List<&2, C.Arg>,
85 +path: List<&2, String>,
86 +opt_seen: Bool
87) -> List<&2, SpecErr>:
88 match pos:
89 case Nil{}:
90 []
91 case Con{hh, +tt}:
92 C.Arg{+name, _s, _l, kind, _h, +req, _d, _c} = hh
93 both(one(Bool.and(C.rest.is.kind(kind), Bool.not(List.is_empty(&2, C.Arg, tt))),
94 RestNotLast{path, name}),
95 both(one(Bool.and(req, opt_seen), RequiredAfterOptional{path, name}),
96 pos.order(tt, path, Bool.or(opt_seen, Bool.not(req)))))