Skip to content

Conversation

@NoahGorny
Copy link
Member

Dup of #188, rebased 😄

Need to use grep WITHOUT case-sensitivity. Otherwise results such as com.apple.iChat and com.apple.imagent won't be handled correctly and neither one can be completed.
Fixed another comparison that prevented "defaults read com.apple.iChat <complete>" from correctly returning the available defaults keys in that file.
@NoahGorny
Copy link
Member Author

Merging with sudo powers as this is a rebased version of #188

@NoahGorny NoahGorny merged commit e321a3d into master Aug 11, 2021
@NoahGorny NoahGorny deleted the ksuther/master branch August 11, 2021 21:35
# Both a domain and command have been specified

if [[ ${COMP_WORDS[1]} == [${cmds// /|}] ]]; then
if [[ ${COMP_WORDS[1]} =~ [${cmds// /|}] ]]; then
Copy link
Contributor

@davidpfarrell davidpfarrell Aug 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did the =~ sneak into here?

We have at least 2 other uses of the == version in this file, and I thought we discussed previously that $cmds is not a regex? I'll have to look for that discussion.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

woah, I completely missed it!
That's totally my bad...

We should opt for the solution with _bash-it-array-contains-element instead.
I have also seen other problems with this completion...
I will try to create a PR for it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It didn't sneak in. Using == makes the comparison case-sensitive, which was the whole point of #188. I've opened #1922 to restore it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants