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
which demonstrates that this change preserves the existing "don't complete options that have already been typed" behaviour. The $assoc_args could be named bit better if this is its only purpose.
array_key_last() appears to be polyfilled by symfony/polyfill-php73 and used in symfony/console on the dev repo, but I don't see it in the stable phar. Would you prefer another dependency, or a single line of more verbose code?
We do have some tests in cli-bash-completion.feature that could be amended for this change, and a couple are already failing right now. I'm not really familiar with the completion script to provide exact guidance, I'll defer that to the others.
As for array_key_last, can this use something like key( end( $words ) ) instead? Then we wouldn't have to fiddle with the dependencies
I updated the tests to accommodate the change to the repeated option behaviour, but I don't think there are any commands in this package with an option that's a prefix of another. A command package would have to be included during testing to perform that check.
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.
Make options complete in a manner more consistent with other shell programs.
Closes #5845.
This relies on
array_key_last()
which may need to be polyfilled if it isn't already.