-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Fix ZSH issues in brew-wrap - doesn't run brew-file #70
Conversation
Thank you for the pull request.
About "$@", as long as I checked it works same in both bash and zsh (zsh 5.2 (x86_64-apple-darwin16.0) (macOS Sierra default), and zsh 5.2 (x86_64-apple-darwin15.0.0) (homebrew version)). About another point of |
By "$@" I simply mean to put all the arguments in a single string and reply on setopt sh_word_split, the emulate fixes this since it emulates bash emulate should reset it to the defaults, I just tried this: echo $options[ksharrays]; setopt KSH_ARRAYS; echo ${options[ksharrays]}; function abc() { emulate -L zsh; echo $options[ksharrays]; setopt; }; abc; unsetopt KSH_ARRAYS; and it verified that but Id have no issues with setting ksharrays if you want, it's just you need to unset it before you go to the default zsh autocomplete functions or you'll have errors |
"$@" doesn't mean single word, but it represents separated words.
This makes "a b" file in zsh w/o ksh_arrays/emulate -L zsh/sh_word_wplit don't change "$@" function:
Maybe I'm missing something...? |
Sorry, you're right I was mistaken. I took another list and it wasn't that line which was doing it, it was the if aka I don't know why the first one works in ksh emulation (I'm looking at the options that are enabled with it set). If you know, i'd be curious |
that code is wrong, sorry. It should be:
|
That's what I thought, but it was interesting it breaks zsh. I'm curious to what exactly the un-quoted ^ is doing when it's != in zsh |
Nevermind, it's just doing file globbing |
ok, how do you want to proceed? If you can remove Otherwise, I will close this PR and will commit these update by myself. |
"$words[@]" is to do with the change to using emulate. You can revert it completely if you want (although I don't like the user of grepping the options when you can have local options). If you enable KSH_ARRAYS locally, you need to revert it before calling zsh autocomplete functions. |
As discussed above, But anyway, I just realized that in completion function these setopt values are reset to completion's default so that it doesn't need to think about user's setopt. |
Emulate should also reset the values, fyi. I was saying that above - but you can try setopt KSH_ARRAYS; emulate -L zsh; setopt |
It resets setopt, but only in a function. Try:
This is why we can use it safely in the function. |
Gotcha - you must be talking about something else. The great thing about emulate -L is the thing you just said... If you're talking about reseting to the users defaults mid-function (Which I don't think I would ever do but if you really want to) you can just wrap it in a function like you have there. |
ah, sorry, I got it. |
You looped through "$@" in the latest change which because of the fact that zsh doesn't split on spaces and bash does it causes issues and it never actually did a "brew file init" like it should have.
Used emulate with local options instead