feat(std/cli): optional, repeatable and pass-through arguments #493
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/492-cli-optional-args"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #492
Part of #124
Step 1 of the
torbmove tostd/cli: the three shapes the compiler's commands need and the package lacked.CommandBuilder.optional<T>(name, help:)/input.optional<T>("name"): T?- may be left out, no default; help row(optional).CommandBuilder.repeatable<T>(name, help:)/input.repeated<T>("name"): List<T>- any number of times (also--name=v), in the order of the line, every value checked; help row(repeatable).arguments(name, help:, passthrough: Bool = false)- the first positional argument ends option parsing, it and everything behind it (flags too) are collected;--help/-hand--are honoured in front of it only; help row(pass-through).CliError(MissingValue,InvalidValue);option<T>keeps its meaning.Tests in
std/cli/tests/cli.test.trb(absent/present/=form/invalid value, order, pass-through,--help, help text); docs indocs/standard-library/cli.md,skills/mirror updated by hand because thetorbbinary is not available outside CI (the docs gate in CI shows if the regeneration differs).Seed: not touched (std source only). Tier A runs in forge CI only.
0dbccaecd3d946ed4049Reviewed
d946ed4. Checklist:--before/after the first positional,--helpbefore/after, unknown flag before it still an error, empty), plus both help texts. CI is green on this head (tier A, bootstrap, gates, pdisc).literal = spec.passthroughafter the first positional reuses the existing literal path;settlefills[]for absent optional/repeatable soinput.optional/input.repeatedonly panic on a program mistake, which is documented.option<T>behaviour unchanged (thechecked<T>()extraction is equivalent).Input/OptionSpec/ArgumentsSpecgained fields with all constructors updated.Non-blocking:
Approving and merging by rebase.
torb check,build,runandtestparse their command line withstd/cli(step 2 of #124) #502torbparses its command line withstd/cli(CLI slice 2) #124torbparses its command line withstd/cli(CLI slice 2) #124