def finish_long

cli@0.2.0.0 · cli.bend:1336

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

1336def finish_long(found: NameScan, short: String,
1337    +repeat: Bool, +negatable: Bool) -> Usage:
1338  match found:
1339    case NameBad{col}:
1340      Invalid{col}
1341    case NameOK{+name, SNil{}, next}:
1342      Parsed{name, short, String.append("--", name),
1343        Bool.pick(UsageKind, negatable, NegatableKind{},
1344          Bool.pick(UsageKind, repeat, CountKind{}, FlagKind{}))}
1345    case NameOK{+name, SCon{Chr{32}, SCon{Chr{60}, tail}}, +next}:
1346      Bool.pick(Usage, negatable, Invalid{next},
1347        finish_required_value(scan_ph(tail, Nat.add(next, 2n), "", '>'),
1348          name, short, String.append("--", name),
1349          OptionKind{repeat}))
1350    case NameOK{+name, SCon{Chr{91}, SCon{Chr{61}, SCon{Chr{60}, tail}}}, +next}:
1351      Bool.pick(Usage, Bool.or(negatable, repeat), Invalid{next},
1352        finish_optional_value(scan_ph(tail, Nat.add(next, 3n), "", '>'),
1353          name, short, String.append("--", name)))
1354    case NameOK{name, rest, next}:
1355      Invalid{next}

Uses (16)

Used by (1)