Skip to content

Fix --help in nested subcommands with default subcommands#866

Merged
natecook1000 merged 3 commits intoapple:mainfrom
stackotter:stackotter/fix_865
Mar 20, 2026
Merged

Fix --help in nested subcommands with default subcommands#866
natecook1000 merged 3 commits intoapple:mainfrom
stackotter:stackotter/fix_865

Conversation

@stackotter
Copy link
Contributor

@stackotter stackotter commented Feb 13, 2026

This fixes the issue discussed in #865. I updated the implementation of checkForBuiltInFlags's requireSoloArgument parameter to explicitly check for a single input argument rather than a single parsed argument, as some input arguments get parsed into multiple synthetic arguments, for example -help -> [-help, -h, -e, -l, -p]. #612 was trying to do this but did it in a bit of a hacky way that introduced #865. I have added a unit test that fails without these changes and succeeds with them.

Checklist

  • I've added at least one test that validates that my change is working, if appropriate
  • I've followed the code style of the rest of the project
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary

@natecook1000 natecook1000 merged commit 4453aa9 into apple:main Mar 20, 2026
35 checks passed
@stackotter stackotter deleted the stackotter/fix_865 branch March 20, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants