
Thefuck – Corrects your previous console command - BerislavLopac
https://github.com/nvbn/thefuck
======
Detry322
Just hopping on this thread post for a shameless plug:

[https://github.com/Detry322/git-psuh](https://github.com/Detry322/git-psuh)

Why make errors do the thing you want, when you can make them do things you
don't want? ¯\\_(ツ)_/¯

Carpenters have "measure twice, cut once", since there's risk involved with a
mistake. Let's make mistakes risky.

~~~
fokov
"I've cut the board 3 times and it is still too short!"

~~~
Yetanfou
I built a bathroom with a heated floor last year. For that floor I needed 42 m
of heating cable. This cable is poured into the flooring screed and as such
can not be spliced, it has to be in one piece.

Ir ordered 42 m and got a parcel with 18 m in the mail, apparently the person
who processed the order mistook the order sequence number - 18 - for the
ordered amount. I notified the supplier about this mistake, added some photo's
of the cable - which is helpfully marked in meter-increments - and told them
to send a new cable as I ordered 42 m.

The supplier sent 24 m of cable.

------
foxhop
What about `fc` (fix command)? It's been in unix forever.

    
    
      $ echoo "hi"
      -bash: echoo: command not found
    
      $ fc # this will open your editor to fix the command.
      echo "hi"
      hi

------
django-boy
This is cool but I'd rather not have any magic happening when running commands

~~~
amlozano
You have to explicitly turn on a setting to have it run the corrected command
without confirmation.

------
ISL
Previous discussion (from four years ago -- many commits since then):
[https://news.ycombinator.com/item?id=9396116](https://news.ycombinator.com/item?id=9396116)

~~~
excalibur
And another (from a year and a half ago, probably the one that prompted me to
install it):
[https://news.ycombinator.com/item?id=14133647](https://news.ycombinator.com/item?id=14133647)

------
jcahill84
I'm surprised at how serious people are being in the comments... This is
amazing. My team and I had a good laugh. Great work.

------
JesseAldridge
I had this sitting in my .bash_profile for a while. I removed it after I
realized it was adding like 2 seconds of lag before my terminal finished
loading.

------
Yetanfou
Whether it is this `fuck` command, an earlier `dwim` command or any of the
helpful shells or missing command tools which provide me with suggestions, for
some reason it still seems to be faster to do it the way I've been doing it
for years:

    
    
       some_long_commnd^C
       some_long_command --wthi^C
       some_long_command --with these --optoin^C
       some_long_command --with these --options
    

It might be that I just type fast - I do - or it might be that the cognitive
load imposed by using 'helpful' tools like these is higher than the simple act
of machine-gun-typing out a corrected version of the command.

Repeatedly typing out a command also has a bit of a satisfying "now you listen
to _me_ you frickin' pile of silicon" to it, maybe that plays a role as well.
On the other side it could be viewed as a form of self-flagellation, doing
penance for the sin of not typing out the correct version in the first place.
Whatever its virtues, it seems to work for me.

------
charlesism
This is the umpteenth app with "Fuck" in its name to hit the front page here.
I should try harder to be constructive, but these titles turn me off. Not that
I understand the attraction of using an obscenity as a project title, but
surely there are more creative obscenities that would suffice.

------
vanous
I run a discord bot for wot blitz and the close to 70 commands are available
under about 180 names, based on observed typos people make. Autocorrect on
mobile cannot be used (it puts an extra space before the word) and it's
sometimes super hilarious to see what people come up with...

Example:

?clantopplayers

aliases=["clanplayerscharts","clanplayers","calntopplayers","calnplayerscharts","calnplayers",
"clantoplayers"]

------
dang
Big previous discussions:

[https://news.ycombinator.com/item?id=14133647](https://news.ycombinator.com/item?id=14133647)

[https://news.ycombinator.com/item?id=9396116](https://news.ycombinator.com/item?id=9396116)

------
duckqlz
This is pretty cool I usually do the following

    
    
        >aptget install oops
    
        ERROR!!
    
        >^t^t-
    
        >apt-get install oops
    
        WIN
    
    

but thefuck saves me 2 precious keystrokes (even more when I change the
command from "fuck" to "f!").

~~~
mario0b1
The part where it gets insane is when you realize that you don't have to type
apt-get and apt only is enough, because you are not a script and (probably)
don't care about different output formats.

That blew my mind and cut a lot of mistakes!

------
inetsee
This sounds a lot like "Do What I Mean" (aka DWIM), which dates back to BBN
Lisp, around 1966. See
[https://en.wikipedia.org/wiki/DWIM](https://en.wikipedia.org/wiki/DWIM)

------
xte
Nice, not really useful for me (I can correct by hand, probably at the same or
higher speed and with more predictable results) however nice and scenic.

Perhaps it work better inside zsh/fish autocorrection, extended it to another
level :-)

------
Symmetry
Seems really cool in general but I wish it corrected _gitp ush_ to _git push_
instead of _git ush_. That sort of thing is a fairly common typo for me :\
Still, I expect I'll find it very useful.

~~~
AgalmicVentures
It's possible to configure git so that git ush becomes git push; for example,
this .gitconfig correct many common misspellings:
[https://github.com/AgalmicVentures/Environment/blob/master/c...](https://github.com/AgalmicVentures/Environment/blob/master/configs/.gitconfig)

Obviously such corrections should be used judiciously.

------
kentt
I used this for a while, but it added a lot of time to start each shell. Might
not be an issue for you, but might save you some time if you are wondering why
it takes a full second to open a new shell.

------
another-cuppa
Training yourself to be tolerant of mistakes on the command line seems like a
very bad idea. Carpenters have a rule: measure twice, cut once. Train yourself
to do the same.

~~~
copperx
It's almost like typing commands isn't the friendliest human-computer
interface. But because we have been utterly incapable of taking the Unix
paradigm to the graphical world, we have settled for the error-prone, zero-
discoverability atrocity of a command line.

Don't get me wrong, I love the command line because there isn't a more
powerful interface, but I'm appalled to see that there aren't any attempts to
make it better. 70 years isn't enough to come up with something better?

~~~
noobermin
CLI is like speech. Therefore, I don't get for why people think it isn't a
friendly human computer interface since it is so close to the original human-
human interface. And just like with speech, things can be ambiguous and easily
mistook. The way we've dealt with speaking is just learning to speak clearer,
not by turning everything we say into a movie.

~~~
copperx
> CLI is like speech.

You must be kidding here. CLI is like speech only if imagine you are in a
completely dark room full of people, and you can't talk to anyone unless you
know their name and their job description, and although you can get a list of
names, you need to figure out the job descriptions yourself.

On top of all that, everyone speaks a slightly different dialects, the
adjectives and verbs are slightly out of order. And although that's not hard
to memorize, you have to speak flawlessly in order to be understood.

~~~
noobermin
Hmm? Apart from the "dark room" bit, how is it not analogous? "Get the bag of
chips." Who? Which bag of chips? What is the context?

If there is a special context say, there is only one person and one bag of
chips, which is similar to there being one file and one program to open it
with certain options say, and you do it often enough, an apt shell user would
bake that into either an alias or a short shell script. It's rare that I use
more than 4 options on a command before baking it into a script. That's very
analogous to language: things like slang, contractions, and sayings that make
sense in certain contexts form naturally between people or even in some
situations, are decided explicitly.

Of course, come times of ambiguity, then you have to explain yourself, just
like when a script you usually use as a shortcut doesn't match a certain need,
and you crack open the original call, which man helps with, and may be you
write another script if need be.

------
khacking
Use this daily. Have it aliased to ‘ff’ though. Favourite use is pushing a new
branch

~~~
webdevatlurk
I used thefuck for a little while, but have removed it since I found this gist
[https://gist.github.com/robmiller/6018582](https://gist.github.com/robmiller/6018582)

The `git publish` alias eliminated the vast majority of my thefuck usage.

