-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Never call preSubcommand
hooks on help command
#1956
Conversation
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:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
preSubcommand
hooks being called before help for just one particular kind of subcommands?ChangeLog
Fixed
(or maybe Changed?)
preSubcommand
hooks when displaying help for an executable subcommand