Closed ghost closed 9 years ago
The problem seems to be with the history class, as on commenting out the following in the get_command function the issue disappears
#if script == 'fuck' or script == history.last_script:
# script = history.last_fixed_script or history.last_script
Strange. It works just fine for me, I couldn't reproduce:
This seems to be a more general issue, as same bug appears if you repeat any wrong command - for example
changing
if script == 'fuck' or script == history.last_script:
script = history.last_fixed_script or history.last_script
to
if script == 'fuck' or script == history.last_script:
script = history.last_script or history.last_fixed_script
fixes the issue
It seems to be a problem with Bash. It works nice with Fish:
@pranav15197 The fix worked on my system too. Thanks.
What shell are you using? What version of TheFuck? It works for me in Bash too:
I cloned the repo today and installed it for development, the version = 1.32 on the setup.py file
Same as @pranav15197 . thefuck - Installed today, version 1.32 GNU Bash - version 4.2.42, default with linux 12.04
Yep, repeats for me with:
➜ cd dummy
autoenv_cd:cd:2: no such file or directory: dummy
➜ fuck
mkdir -p dummy && cd dummy [enter/ctrl+c]
➜ cd ..
➜ rm -rf dummy
➜ cd dummy
autoenv_cd:cd:2: no such file or directory: dummy
➜ fuck
No fuck given
Oh! It works for me:
»»»» cd dummy
cd: The directory 'dummy' does not exist
»»»» fuck
mkdir -p dummy && cd dummy
»»»» cd ..
»»»» rm -rf dummy
»»»» cd dummy
cd: The directory 'dummy' does not exist
»»»» fuck
mkdir -p dummy && cd dummy
»»»» pip freeze | grep thefuck
thefuck==1.32
»»»» fish --version
fish, version 2.1.2
It also works with bash:
bash-4.3$ ls
bash-4.3$ cd dummy
bash: cd: dummy: No such file or directory
bash-4.3$ fuck
mkdir -p dummy && cd dummy
bash-4.3$ cd ..
bash-4.3$ rm -rf dummy
bash-4.3$ cd dummy
bash: cd: dummy: No such file or directory
bash-4.3$ fuck
mkdir -p dummy && cd dummy
bash-4.3$ pip freeze | grep thefuck
thefuck==1.32
bash-4.3$ bash --version
GNU bash, version 4.3.33(1)-release (x86_64-apple-darwin14.1.0)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
@scorphus it repeats only in version from git.
And I almost know how to fix it =)
Oh, my bad. Sorry, I thought I was helping. I now confirm this issue.
Probably fixed in 1.35+
I confirm it is fixed in Fish and Bash. Thanks @nvbn!
Thanks @nvbn :)
As seen from the above picture, 'rmdir' causes fuck to behave funny.
After deleting a directory created using fuck if I try to recreate it, it does recreate it but gives the output on the console as 'No fuck given'.
This happens repeatedly everytime the same set of statements is executed.
(PS: I am a novice student so please bear with me if I make a few noob mistakes.)