Re: [PATCH 0/5] parseopt: add subcommand autocorrection
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 8, 2026, 20:11 UTC
- Message-ID
- <xmqqo6ky9j4l.fsf@gitster.g>
- In-Reply-To
- <SY0P300MB08019805A8304105FA805EB1CE78A@SY0P300MB0801.AUSP300.PROD.OUTLOOK.COM>
Jiamu Sun <39@barroit.sh> writes:
Show 11 quoted lines
> Git currently provides auto-correction for builtins and aliases, but > lacks this functionality for subcommands parsed via the parse-options > API. Subcommands are also commands, and typos will occur, too. Like: > > git remote add-rul > > So, this series introduces subcommand auto-correction. > > Currently, builtins with mandatory subcommands enable autocorrection by > default. However, those using PARSE_OPT_SUBCOMMAND_OPTIONAL skip it to > avoid treating valid unknown arguments as mistyped subcommands.
This is a bit confusing as it describes the behavior introduced by this series rather than the state of the codebase before these patches. Since subcommand autocorrection doesn't exist yet, it would be clearer to phrase this as describing your implementation choices. Perhaps:
By default, this implementation enables autocorrection for
builtins with mandatory subcommands. However, for those using
PARSE_OPT_SUBCOMMAND_OPTIONAL, autocorrection is skipped to
avoid misinterpreting legitimate unknown arguments as mistyped
subcommands.or something, perhaps?