Include any non default hook information in CompositeCommand#5921
Merged
danielbachhuber merged 10 commits intowp-cli:mainfrom Apr 27, 2024
Merged
Include any non default hook information in CompositeCommand#5921danielbachhuber merged 10 commits intowp-cli:mainfrom
danielbachhuber merged 10 commits intowp-cli:mainfrom
Conversation
This would be a first step towards addressing wp-cli#5838 and including details on when a specific command is run in the handbook documentation. I've added the output to the help command as well so there will be parody between that and the handbook.
swissspidy
reviewed
Apr 26, 2024
Co-authored-by: Pascal Birchler <pascal.birchler@gmail.com>
swissspidy
reviewed
Apr 26, 2024
| * @return string|null | ||
| */ | ||
|
|
||
| function get_hook_description( $hook ) { |
Member
There was a problem hiding this comment.
Can this just be a private method on the Help_Command class?
Member
Author
There was a problem hiding this comment.
I believe this needs to be a public util function because the handbook project doesn't use the output of wp help and needs similar code added there as well in order to have consistency. Was going to do a PR for that one next after this is added.
Member
danielbachhuber
left a comment
There was a problem hiding this comment.
Can we include some tests too? (Just some basic smoke test for it)
This string can wrap depending on settings, so hardcode various column numbers for consistency.
Member
Author
|
@danielbachhuber tests added thanks! |
swissspidy
reviewed
Apr 26, 2024
swissspidy
reviewed
Apr 26, 2024
Co-authored-by: Pascal Birchler <pascal.birchler@gmail.com>
danielbachhuber
approved these changes
Apr 27, 2024
Member
danielbachhuber
left a comment
There was a problem hiding this comment.
Thanks, @mrsdizzie ! I made a few small tweaks you might like to look through ^
Member
Author
|
@danielbachhuber looks great, thanks much! |
mrsdizzie
added a commit
to mrsdizzie/handbook
that referenced
this pull request
Apr 27, 2024
When a command specifies a non-default hook, include those details in handbook documentation for the command. Related: wp-cli/wp-cli#5921 Fixes: wp-cli/wp-cli#5838
danielbachhuber
pushed a commit
to wp-cli/handbook
that referenced
this pull request
Apr 29, 2024
When a command specifies a non-default hook, include those details in handbook documentation for the command. Related: wp-cli/wp-cli#5921 Fixes: wp-cli/wp-cli#5838
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.
This would be a first step towards addressing #5838 and including details on when a specific command is run in the handbook documentation.
I've added the output to the help command as well so there will be parity between that and the handbook.
If the parent command defines a
@whentag, that is passed down to all subcommands. If a subcommand has its own@whentag, it will take the place of the parent tag. If there is no@whentag defined for a parent or subcommand, it won't show any hook information with the existing assumption that everything runs on the default hook unless otherwise specified.So now a command like
wp help db resetwould output:Where the
after_wp_config_loadhook is inherited from the parent db command.And
wp help db sizewould show:Since it defines a different hook to run on.