std/cli: optional, repeatable and pass-through arguments (first step of #124) #492
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Context
torbcannot move tostd/cli(#124) while the package cannot say what the compiler's commands say. Read offcompiler/src/main.trband the option readers it calls, three things are missing:--output <file>,--target,--templatemay be left out and have no default (today an option without default is required);torb test --filter a --filter b,torb repl --environment p --environment q,--modules;torb run [path] [...]everything behind the path is the program's ownProcess.arguments(), flags included (torb run tool.trb --emit-chands--emit-con).Source
std/cli/src/command.trb(CommandBuilder,Command.parse,Command.settle),std/cli/src/input.trbDesign (decided by the loop, internal API shape)
option<T>(name, help:, default:)keeps its meaning. NewCommandBuilder.optional<T>(name, help:): may be left out, read asinput.optional<T>("name"): T?(Noneif absent); help row(optional).CommandBuilder.repeatable<T>(name, help:): may be given any number of times (also--name=v), read asinput.repeated<T>("name"): List<T>in the order of the line, empty if absent; every value is checked like an option's.arguments(name, help:, passthrough: Bool = false): withpassthroughthe first positional argument ends option parsing, and it and everything behind it (flags too) go into the list;--help/-hare still honoured before that point only.CliError; no new case is needed (a missing value / invalid value reuseMissingValue,InvalidValue).Acceptance criteria
optional,repeatableandpassthroughas above, instd/cli/src/command.trbandinput.trb, exported fromstd/cli.std/cli/tests/cli.test.trbwith argument lists: absent / present /=form / invalid value foroptionalandrepeatable; order of repeated values; pass-through keeps--emit-c-style tokens behind the first positional,--still works,--helpin front of the path still wins.(optional),(repeatable)and the pass-through arguments; covered by a test.docs/standard-library/cli.mddocuments the three;skills/regenerated where the docs gate asks.Seed
Does not touch the seed: std source only, no syntax, no native, no driver flag, no looked-up name.
std/cliis already in the newest published seed (it landed before it), and the seed compiles std from the checkout.Size
One PR, one or two Conventional Commits (
feat(std/cli): optional, repeatable and pass-through arguments,docs(cli): ...). Tier A in forge CI only.Dependencies
None open (#123 is closed). Blocks the next step of #124.
Part of #124 (the PR says
Refs #124, notCloses).[loop:torbscript] refine: ready. The PR says
Closes #492andRefs #124(the epic stays open). Two-commit rule: not applicable, see the Seed section. Worker: sonnet/medium (std/ package).[loop:torbscript] decided by the loop: the optional/repeatable/pass-through shapes above are internal API choices that follow the existing
option/argumentsbuilder style; no owner question.next: implement
torbparses its command line withstd/cli(CLI slice 2) #124[loop:torbscript] claim implement by session:loop-torbscript-20261026 until 2026-10-26T08:00:00Z
[loop:torbscript] implement:
optional<T>/input.optional,repeatable<T>/input.repeated,arguments(..., passthrough:)in std/cli with tests instd/cli/tests/cli.test.trband docs (docs/standard-library/cli.md,skills/mirror patched by hand), PR #493 (argus review requested), next: waiting (forge CI of the PR was still queued 10 min after push, nothing ran yet)Remainder: read forge CI of PR 493 with
ci-wait.sh. Not run locally, so unverified: the new tests,torb format --checkon the touched.trbfiles, and the docs/skills gate. Likeliest failures: (1)skills/differs from a regenerated copy (torb docs skill docs skills), (2) thetorb:declarationblocks incli.mddiffer from the generated ones, (3).trbsyntax or typing in the newcommand.trb/input.trbcode (generic closure helperchecked<T>(),forloop withread<T>). On failure fix on the same branchloop/492-cli-optional-args. Worktree removed (branch pushed).[loop:torbscript] ci-fix: tier A of run 1819 (task 8843) failed on 9 lanes, all consequences of 4 errors in the new code (OptionSpec ctor missing
optional/repeatable,repeatedValues.get keyand[argumentsRow spec]not parsing,assertcapturingParsed; the compiler-tests failure was onlytypes.test.trb"every type position ... nothing is reported" tripping on them, docs check cli.md:46/94 follows from the brokenoptionbody). Fixed in0dbccaeconloop/492-cli-optional-args, PR #493. Checked with the nightly-20261025 linux-x64 binary (no local build):torb check std/clino problems,torb doc --check --no-run stdno problems,torb format --check std/cliclean (format also rewrapped 2 lines). Not run locally: nativedocs check,docs declarations --check,testlanes, compiler tests;skills/mirror unchanged by the fix (docs untouched).next: waiting on forge CI of
0dbccaec(all 4 statuses still pending/queued at last check). If red: read the log on the host (ssh host,sudo zstdcat .../actions_log/torbscript/language/<taskid%256 hex>/<taskid>.log.zst), fix on the same branch. Worktreecode/wt/torbscript-language-492-ci-fixstill exists (push:git -c http.extraHeader="Authorization: Basic base64(orion:torbdev-token)"); remove withws wt rmonce green.[loop:torbscript] claim fix by session:loop-torbscript-20261026-0724 until 2026-10-26T15:00:00Z (PR 493: tier A red on
0dbccaec)[loop:torbscript] fix: run 1839 tier A was red on one test only:
help > the command help lists subcommands and flags(native and VM lane of "std/example packages") expected the command list without the newtestandruncommands that the PR added to the test fixture; the expected help text now lists them (d946ed40). Everything else of tier A passed in that run (compiler tests, docs checks,format --check, 15575 of 15576 std tests). Branch rebased onto current main (358fb6ce, linear,tools/check-commits.shclean); locally checked with the nightly-20261025 binary:torb format --check stdclean,torb test std/cli48 passed, 0 failed. New headd946ed40490c03cf175231d52baad38629ee2942, PR #493, argus review re-requested. CI of the new head (run 1858): commit messages, change scope, runners, bootstrap, pdisc green; tier A, release-sync, same-C and playground have been queued for a runner for 30+ min, gates/pack/archives blocked behind them.next: waiting (forge CI queue, tier A not started yet; tokens used by this fix worker: ~95k)
torb check,build,runandtestparse their command line withstd/cli(step 2 of #124) #502torbparses its command line withstd/cli(CLI slice 2) #124