You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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 @when tag, that is passed down to all subcommands. If a subcommand has its own @when tag, it will take the place of the parent tag. If there is no @when tag 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 reset would output:
NAME
wp db reset
DESCRIPTION
Removes all tables from the database.
This command runs when the 'after_wp_config_load' hook is called, after wp-config.php has been loaded into scope.
SYNOPSIS
wp db reset [--dbuser=<value>] [--dbpass=<value>] [--yes] [--defaults]
Runs `DROP_DATABASE` and `CREATE_DATABASE` SQL statements using
`DB_HOST`, `DB_NAME`, `DB_USER` and `DB_PASSWORD` database credentials
specified in wp-config.php.
Where the after_wp_config_load hook is inherited from the parent db command.
And wp help db size would show:
NAME
wp db size
DESCRIPTION
Displays the database name and size.
This command runs when the 'after_wp_load' hook is called, just after the WP load process has completed.
SYNOPSIS
wp db size [--size_format=<format>] [--tables] [--human-readable] [--format=<format>] [--scope=<scope>] [--network] [--decimals=<decimals>] [--all-tables-with-prefix] [--all-tables] [--order=<order>] [--orderby=<orderby>]
Display the database name and size for `DB_NAME` specified in wp-config.php.
The size defaults to a human-readable number.
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.
The reason will be displayed to describe this comment to others. Learn more.
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.
When a command specifies a non-default hook, include those details in
handbook documentation for the command.
Related: wp-cli/wp-cli#5921Fixes: wp-cli/wp-cli#5838
When a command specifies a non-default hook, include those details in
handbook documentation for the command.
Related: wp-cli/wp-cli#5921Fixes: wp-cli/wp-cli#5838
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
@when
tag, that is passed down to all subcommands. If a subcommand has its own@when
tag, it will take the place of the parent tag. If there is no@when
tag 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 reset
would output:Where the
after_wp_config_load
hook is inherited from the parent db command.And
wp help db size
would show:Since it defines a different hook to run on.