Merged
Conversation
swissspidy
reviewed
Jul 26, 2018
src/MakePotCommand.php
Outdated
| } | ||
|
|
||
| if ( isset( $assoc_args['headers'] ) ) { | ||
| $this->headers = json_decode( $assoc_args['headers'], true ); |
Member
There was a problem hiding this comment.
WP-CLI has a nice little utility method for this so you don't need isset() and json_decode().
Example:
$array_arguments = array( 'headers' );
$assoc_args = \WP_CLI\Utils\parse_shell_arrays( $assoc_args, $array_arguments );
swissspidy
reviewed
Jul 26, 2018
| When I run `wp i18n make-pot wp-content/plugins/hello-world wp-content/plugins/hello-world/languages/hello-world.pot --headers='{"Report-Msgid-Bugs-To":"https://github.com/hello-world/hello-world/"}'` | ||
| And the wp-content/plugins/hello-world/languages/hello-world.pot file should contain: | ||
| """ | ||
| "Report-Msgid-Bugs-To: https://github.com/hello-world/hello-world/\n" |
Member
There was a problem hiding this comment.
I would add another test like
And the wp-content/plugins/hello-world/languages/hello-world.pot file should not contain:
"""
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/hello-world\n"
"""to prove that the heaader is indeed being replaced and not added.
swissspidy
reviewed
Jul 26, 2018
src/MakePotCommand.php
Outdated
| $this->skip_js = Utils\get_flag_value( $assoc_args, 'skip-js', $this->skip_js ); | ||
| $this->source = realpath( $args[0] ); | ||
| $this->slug = Utils\get_flag_value( $assoc_args, 'slug', Utils\basename( $this->source ) ); | ||
| $this->skip_js = Utils\get_flag_value( $assoc_args, 'skip-js', $this->skip_js ); |
Member
There was a problem hiding this comment.
Unintended whitespace changes I guess? :-)
Member
|
Thanks @greatislander! This is coming along nicely. |
- Use WP-CLI utility functions where possible - Fix inadvertent whitespace changes - Revert accidental composer.json changes
Author
|
@swissspidy Updated based on your feedback -- let me know if there's any other changes you'd like! |
schlessera
approved these changes
Jul 31, 2018
Member
|
Thanks for the pull-request, @greatislander ! |
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 PR resolves #47 by adding a
--headersparameter which accepts a JSON-formatted array of custom header values which are added to the POT file. If custom headers are passed which correspond to defaults, the default values will be replaced.