Repository navigation
mcpx: make <command> --help print the command's help - #275
Merged
Merged
Conversation
Port of dezren39/nix PR #380 (commit 32bb9ff, fixes nix#368): the pre-fix files in this repo's pkgs/mcpx copy were byte-identical to nix's, and the defect reproduced identically — mcpx call --help printed a 290-line settings dump, mcpx daemons --help ran the command. - parseFlags answers a help flag in flag position with the same text as mcpx help <cmd> (new helpText) and installs it as the flag set's usage; generated op commands keep their own usage. - Handlers() wraps hand-written commands so a leading help flag is answered even for commands that never parse flags; flag.ErrHelp becomes success in dispatch and in main. - help_test.go ported with refs re-pointed to #274. Verified: full internal/cli suite green, go vet clean, built binary: call --help is now byte-identical to help call (97 lines), daemons --help prints help instead of listing daemons.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing: 4
✨ Finishing Touches
Comment |
Pre-existing alignment that treefmt only checks on changed files; formatting only, no behaviour change.
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.
Fixes #274. Port of dezren39/nix PR #380 (commit
32bb9ff, fixed nix#368) — the pre-fix files in this repo'spkgs/mcpxcopy were verified byte-identical to nix's pre-fix versions, and the defect reproduced identically here.Problem (on main
98da85ea)mcpx call --help→Usage of call:+ 290 lines of plumbing flags, not the command's help.mcpx daemons --help→ ignored the flag and listed daemons.Fix
parseFlagsanswers a help flag in flag position with the same text asmcpx help <cmd>(new sharedhelpText), and installs that text as the flag set's usage so a parse error can't resurrect the dump. Generated op commands keep their own tailored usage.wantsHelpmirrors the parser: a help token consumed as a valued flag's value, after a positional, or after--is not a request.Handlers()wraps hand-written commands: a leading help flag is answered even for commands that never parse flags, andflag.ErrHelpbecomes success;maintreatsflag.ErrHelpthe same way.internal/cli/help_test.goported (refs re-pointed to mcpx: <command> --help prints every global flag instead of the command's help #274).Verification
internal/clisuite green;go vetclean.call --helpis now byte-identical tohelp call(97 curated lines vs 290-line dump);daemons --helpprints help instead of listing daemons.dispatch.goalignment hunk local Go 1.25 reports exists identically on unmodified main — toolchain-version artifact; this change's hunks are clean).