Repository navigation
refactor(cli): move argv parsing, help and groups onto @cutils/cli 0.9.0 - #36
Merged
Merged
Conversation
The 0.6.0 help work kept a local sectioned renderer, an argparse-style REMAINDER pre-split and hand-rolled dispatch for the group verbs because @cutils/cli 0.8.1 could not express them. 0.9.0 adds ArgSpec.remainder, the sectioned help renderer and unknown-command suggestions, so all three local seams are gone: - enqueue and run use library remainder args; src/remainder.ts is deleted and dash-leading commands need no --. - lease, agent, cap, dead and service become nested commands: trees; the ~430 lines of hand-rolled sub-verb parsing collapse into per-sub-verb nodes with their own options and help screens. - daemon joins the tree so --help answers without touching the live daemon; src/help.ts and src/cli-spec.ts are deleted, the library renderer is the only one. - numeric options are declared as strings and parsed in the handlers, because the library seeds an absent int() option to 0 and 0 is a meaningful filter value for events --job. - the unknown-option wording and the --help exit-0 behavior change, so the surface tests and docs follow.
Deploying coordinated with
|
| Latest commit: |
bb8e933
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c4780353.coordinated.pages.dev |
| Branch Preview URL: | https://feat-cli-help-dx-090.coordinated.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The 0.6.0 help work kept three local seams because @cutils/cli 0.8.1 could not express them: a sectioned help renderer, an argparse-style REMAINDER pre-split, and hand-rolled dispatch for the group verbs. @cutils/cli 0.9.0 adds
ArgSpec.remainder, the sectioned help renderer and unknown-command suggestions, so all three are gone.enqueueandrunuse library remainder args. A dash-leading command no longer needs--, andsrc/remainder.tsis deleted.lease,agent,cap,deadandserviceare nestedcommands:trees. Each sub-verb is a node with its own args, options, help screen and handler, so ~430 lines of hand-rolled sub-verb parsing collapse into per-sub-verb nodes.daemonjoins the tree, sodaemon --helpanswers without touching the running daemon.src/help.tsandsrc/cli-spec.tsare deleted. The library renderer is the only one.str()and parsed in the handlers withoptInt/optCount. The library seeds an absentint()option to0, and0is a meaningful filter value forevents --job, so seeding it would silently filter every row out.runandenqueuehandlers now return their promises. Avoidhandler drops the promise, so the async work never ran.Behavior changes
error: unknown option '--x'.coordinate statupoints atstatusandstats).<verb> --helpexits 0 and prints the library's sectioned screen.Verification
pnpm exec tsc --noEmitclean.pnpm test: 276 pass, 1 fail. The failure isbudget-lanes: default when no config, which is pre-existing and environmental: it leaks the host~/.config/coordinate/config.toml[lanes]section into a test that does not setCOORDINATE_CONFIG. It fails the same way on pristineorigin/main.pnpm lint: 0 errors, warnings only.Release
Minor bump to 0.7.0, changeset included.