Never call preSubcommand hooks on help command#1956
Never call preSubcommand hooks on help command#1956aweebit wants to merge 6 commits intotj:developfrom
preSubcommand hooks on help command#1956Conversation
preSubcommand hooks on help command
|
Posted too early by accident, the description is now complete. |
|
I haven't put a lot of thought into this yet, but my first reaction is I am more interested in making it consistent by calling the hook in both cases. Do you want to have a go at that as well? I am imagining a few lines to add the hook before the direct call to the subcommand in I think some people might try using the |
I don't really like this idea for two reasons:
|
shadowspawn
left a comment
There was a problem hiding this comment.
This has got 5 extra commits, some of which have landed.
Unless you are keen on cherry pick and rebase, I suggest perhaps redo the small relevant commit on the release 12.x branch (I have merged develop into release 12.x today).
|
I was thinking about this again today, and leaning towards triggering the hook again! |
|
Interesting comparison with a "real" help command. I had not considered that model. I think of the built-in (This is pretty obscure behaviour, no one may ever notice!) |
This PR builds upon the already approved #1930.
Diff only for the change introduced by this PR:
aweebit/commander.js@feature/fixes...feature/help-command-no-preSubcommand
Problem
Currently, there is an inconsistency between how
._dispatchHelpCommand()deals with regular options and those with an executable handler, which seems to have been missed in #1864.Solution
Call
._executeSubCommand()directly in._dispatchHelpCommand().This is technically a breaking change, but hey, are we really going to assume someone relied on
preSubcommandhooks being called before help for just one particular kind of subcommands?ChangeLog
Fixed
(or maybe Changed?)
preSubcommandhooks when displaying help for an executable subcommand