thefuck --versionThe Fuck 3.30 using Python 3.8.2 and ZSH 5.8
macOS Catalina 10.15.4
Update the .zshrc file. When I try to do a source ~/.zshrc I get the following error:
(eval):2: defining function based on alias `fuck'
(eval):2: parse error near `()'
The error is caused by eval "$(thefuck --alias)" line in the file. Note: When I for example open a new tab in the terminal after updating the config zsh initializes normally without errors.
THEFUCK_DEBUG=trueSame as 鈽濓笍
I could not reproduce the bug. What is the output of thefuck --alias? It should be as follows:
fuck () {
TF_PYTHONIOENCODING=$PYTHONIOENCODING;
export TF_SHELL=zsh;
export TF_ALIAS=fuck;
TF_SHELL_ALIASES=$(alias);
export TF_SHELL_ALIASES;
TF_HISTORY="$(fc -ln -10)";
export TF_HISTORY;
export PYTHONIOENCODING=utf-8;
TF_CMD=$(
thefuck THEFUCK_ARGUMENT_PLACEHOLDER $@
) && eval $TF_CMD;
unset TF_HISTORY;
export PYTHONIOENCODING=$TF_PYTHONIOENCODING;
test -n "$TF_CMD" && print -s $TF_CMD
}
Yes It's exactly like that. I found what was causing the error. Below that in the config I had this alias fuck="fuck -y" And that was causing the problem 馃檮 My bad. Is there a proper way to alias fuck to fuck -y?
Glad you found the issue \o/
How about:
john@host ~ % grep fuck .zshrc
eval $(thefuck --alias __fuck)
alias fuck="__fuck -y"
john@host ~ % echoo ok
zsh: command not found: echoo
john@host ~ % fuck
echo ok
ok
john@host ~ %
Sorry, I closed the issue accidentally (cmd+shift+enter 鈥撀營 thought I was in vscode 馃お)
[edit]removed misleading replies I made[/edit]
Ah, .zshrc can only be source鈥檇 when the function is defined as __fuck and the alias uses it 鈥撀燼.k.a. my first suggestion.
@scorphus Exactly, that's what I wanted to write now. I renamed the issue to properly address the problem. And just to confirm the solution is:
eval $(thefuck --alias __fuck)
alias fuck="__fuck -y"
Thanks so much for helping out with this one!
Most helpful comment
@scorphus Exactly, that's what I wanted to write now. I renamed the issue to properly address the problem. And just to confirm the solution is:
Thanks so much for helping out with this one!