Skip to content
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

Add support for prefix option #10

Merged
merged 1 commit into from
Jan 27, 2022
Merged

Conversation

LuigiPulcini
Copy link

A new --prefix option will allow limiting the output to hooks matching the prefixes passed as a comma-separated list. For example, --prefix=my_theme,my_plugin would include my_theme_some_hook and my_plugin_some_other_hook but exclude not_my_hook from the output.

This can be useful when developers need to document the proprietary action and filter hooks introduced by their theme or plugin.

@remcotolsma remcotolsma merged commit 70f8543 into pronamic:main Jan 27, 2022
remcotolsma added a commit that referenced this pull request Jan 27, 2022
@remcotolsma
Copy link
Member

Thanks for the pull request @LuigiPulcini, i merged this, but did some changes afterwards. I'm not the biggest regular expression fan, so changed preg_match to str_starts_with. And if you want to check multiple prefixes you have to add more options.

--prefix=my_theme --prefix=my_plugin

https://github.com/pronamic/wp-documentor#--prefixprefix

@remcotolsma remcotolsma self-assigned this Jan 27, 2022
@remcotolsma remcotolsma added the enhancement New feature or request label Jan 27, 2022
@LuigiPulcini
Copy link
Author

Thanks for merging this into the main branch. I think your changes would work anyway. After all, the main use case for this new option would be returning hooks that start with the provided prefixes.

Thanks again for this great tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants