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

English syntax/logic error in wp-cli output message(s) #5803

Open
abilicom opened this issue Jun 6, 2023 · 6 comments
Open

English syntax/logic error in wp-cli output message(s) #5803

abilicom opened this issue Jun 6, 2023 · 6 comments

Comments

@abilicom
Copy link

abilicom commented Jun 6, 2023

Hi!
This issue may seem trivial, but here it is for your consideration nonetheless.
When updating plugins, wp-cli outputs the following:
Error: Only updated x of y plugins. (Where x is the quantity of plugins updated and 'y' us the quantity of plugins marked as having an available update.)
This is improper usage of the English word "Only." The use of "only" in this scenario infers that some plugins were not updated, but is sent even though all plugins were updated. Example:
Error: Only 2 of 2 plugins updated (x = y)
This is the context in which it should be used:
All plugins updated: -> "[Error:] 2 of 2 plugins updated." ("Only" suppressed when x = y)
Some of many plugins updated -> "[Error:] Only 2 of 9 plugins updated." ("Only" only sent when not all available plugins are updated, for any reason, x < y.)
Personally, I would recommend that the use of the word 'only' just be omitted altogether (in all scenarios), it's use is implied when needed; wastes bytes.
Regards,
Brian

@wojsmol
Copy link
Contributor

wojsmol commented Jun 6, 2023

Hi
Can you provide detailing repression steps?

@abilicom
Copy link
Author

abilicom commented Jun 6, 2023

wp plugin update --all --quiet --allow-root --path=/home/user/public_html/example.com/
running from a shell script, but does it from comand line also.

@abilicom abilicom changed the title English syntax/logic error in wp-cli outpit message(s) English syntax/logic error in wp-cli output message(s) Jun 6, 2023
@janw-me janw-me self-assigned this Jun 8, 2023
@Dan-Q
Copy link
Contributor

Dan-Q commented Jun 8, 2023

I'll try to sort this at WCEU23.

@Dan-Q
Copy link
Contributor

Dan-Q commented Jun 8, 2023

There are two issues being described here, both of which are covered by this code. I'm unable to replicate the first issue, and I disagree with the suggestion in the second issue, as detailed below:

Issue 1. Should never use the word "Only" after success, e.g. "Error: Only 2 of 2 plugins updated."

The use of "only" in this scenario infers that some plugins were not updated, but is sent even though all plugins were updated.

Unable to replicate. I've managed to produce messages of the form Success: Updated 2 of 2 plugins. and of the form Error: Only updated 1 of 3 plugins (2 failed)., but I've never managed to make the word "Only" appear when the number of plugins updated is equal to the number of plugins attempted.

For speed, I also tried creating and deleting menus, which uses the same display code but executes faster than plugin updates. Here are my test cases:

wp menu create "Alpha"
wp menu create "Beta"
wp menu delete "Alpha" "Beta"

(correctly outputs Success: Deleted 2 of 2 menus.)

wp menu create "Gamma"
wp menu delete "Gamma" "Delta"

(correctly outputs Warning: Couldn't delete menu 'Delta'. and Error: Only deleted 1 of 2 menus.)

@abilicom: are you able to provide a test scenario that consistently produces output of the type "Only X of Y..." where X=Y?

Issue 2. Should never use the word "Only" at all

Personally, I would recommend that the use of the word 'only' just be omitted altogether (in all scenarios), it's use is implied when needed; wastes bytes.

I disagree. The wasted bytes (a tiny 5 extra bytes, assuming 8-bit ASCII encoding) are not significant compared to the benefits of retaining the word "Only", which include:

  • The word "only" adds clarity right at the start of the line, in the event that X<Y, especially where X and Y are visually-similar numbers, e.g. "Only 101 of 110 nouns were verbed" makes it immediately clear that some failed, whereas "101 of 110 nouns were verbed" could easily be misinterpreted.
  • Adding the word "Only" shifts the numbers over and improves the visual distinctness of the error condition, especially for users who do not see the different colors of the words "Success" and "Error" (e.g. monochrome terminal connection, colorblindness, screen-reader)
  • Changing the output unnecessarily may interfere with automated scripts which depend on the expected wording (scripts shouldn't do this, but they might!)

My recommendation: unless somebody else is able to replicate the "Only X of Y..." (where X=Y) bug, close this issue.

@Dan-Q
Copy link
Contributor

Dan-Q commented Jun 8, 2023

Tagging my WCEU23 "handler" @janw-me to decide how best to proceed with the above.

@janw-me janw-me removed their assignment Jun 8, 2023
@janw-me
Copy link
Member

janw-me commented Jun 8, 2023

Whether the word is appropriate or grammatically correct, I don't know.

But changing the output could break scripts.
And checking the text is the only way to detect the difference between a partial successful update or a total failure.

Therefore it's not unthinkable some scripts today might depend on the wording,
So I would not change the wording based on that?

@abilicom Are you able to (re)produce an output where "Only 2 of 2 plugins updated" appears?
That would be a valid bug?

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

No branches or pull requests

4 participants