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

Make use of report_batch_operation_results() for install commands #63

Merged
merged 9 commits into from Nov 30, 2018

Conversation

@ocean90
Copy link
Contributor

ocean90 commented Oct 4, 2018

Fixes #61.

Example output:

➜  ~ wpd language theme install twentytwelve fo_Ba de_DE
Warning: Language 'fo_Ba' not found.
Warning: Could not create directory. "/srv/www/wordpress-develop/shared/public_html/develop-languages/"
Error: No languages installed (2 failed).

➜ ~ wpd language theme install twentytwelve fo_Ba de_DE
Warning: Language 'fo_Ba' not found.
Language 'de_DE' already installed.
Error: No languages installed (1 failed, 1 skipped).

➜ ~ wpd language theme install twentytwelve fo_Ba th
Warning: Language 'fo_Ba' not found.
Downloading translation from https://downloads.wordpress.org/translation/theme/twentytwelve/2.5/th.zip...
Unpacking the update...
Installing the latest version...
Translation updated successfully.
Language installed.
Error: Only installed 1 of 2 languages (1 failed).

➜ ~ wpd language theme install twentytwelve fo_Ba
Warning: Language 'fo_Ba' not found.
Error: No languages installed (1 failed).

➜ ~ wpd language theme install twentytwelve th
Language 'th' already installed.
Success: Installed 0 of 1 languages (1 skipped).

➜ ~ wpd language theme install twentytwelve es_MX
Downloading translation from https://downloads.wordpress.org/translation/theme/twentytwelve/2.5/es_MX.zip...
Unpacking the update...
Installing the latest version...
Translation updated successfully.
Language installed.
Success: Installed 1 of 1 languages.
$available = $this->get_installed_languages( $plugin );
foreach ( $language_codes as $language_code ) {
if ( in_array( $language_code, $available, true ) ) {
\WP_CLI::warning( "Language '{$language_code}' already installed." );
\WP_CLI::log( "Language '{$language_code}' already installed." );

This comment has been minimized.

@ocean90

ocean90 Oct 4, 2018

Contributor

Is this a skip or a success? Looks like media would treat it as a success.

https://github.com/wp-cli/media-command/blob/337459d/src/Media_Command.php#L590-L600

This comment has been minimized.

@ocean90

ocean90 Oct 4, 2018

Contributor

Looking at the success message, I think we can leave it as is.

Success: Installed 0 of 1 languages (1 skipped).

This comment has been minimized.

@schlessera

schlessera Oct 4, 2018

Member

Yes, makes sense to me.

@ocean90 ocean90 changed the title [WIP] Make use of report_batch_operation_results() for install commands Make use of report_batch_operation_results() for install commands Oct 4, 2018

@grappler

This comment has been minimized.

Copy link

grappler commented Nov 20, 2018

@schlessera Is there anything stopping this from being merged?

@ocean90

This comment has been minimized.

Copy link
Contributor

ocean90 commented Nov 20, 2018

We may want to consider using a table for the output here too, see #64 (comment).

@swissspidy

This comment has been minimized.

Copy link
Contributor

swissspidy commented Nov 30, 2018

I think we can optimize the output in follow-up PRs.

@swissspidy swissspidy merged commit 11f989c into wp-cli:master Nov 30, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@swissspidy swissspidy added this to the 2.0.2 milestone Nov 30, 2018

@ocean90 ocean90 deleted the ocean90:report-batch-operation-results branch Dec 1, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment