def parse_short_tail

cli@0.2.0.0 · cli.bend:1371

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

1371def parse_short_tail(tail: String, +short: String, +repeat: Bool) -> Usage:
1372  match tail:
1373    case SNil{}:
1374      Parsed{String.drop(short, 1n), short, "",
1375        Bool.pick(UsageKind, repeat, CountKind{}, FlagKind{})}
1376    case SCon{Chr{44}, SCon{Chr{32}, long_rest}}:
1377      parse_long_prefixed(long_rest, short, repeat, 4n)
1378    case SCon{Chr{32}, SCon{Chr{60}, ph_rest}}:
1379      finish_required_value(scan_ph(ph_rest, 4n, "", '>'),
1380        String.drop(short, 1n), short, "",
1381        OptionKind{repeat})
1382    case SCon{Chr{91}, SCon{Chr{61}, SCon{Chr{60}, ph_rest}}}:
1383      finish_optional_value(scan_ph(ph_rest, 5n, "", '>'),
1384        String.drop(short, 1n), short, "")
1385    case _:
1386      Invalid{2n}

Uses (14)

Used by (1)