thefuck icon indicating copy to clipboard operation
thefuck copied to clipboard

correct uppercase fuckups

Open pitommasi opened this issue 6 years ago • 4 comments

I'd like to set a custom rule so that when I accidentally type

CD MNT/C

it suggests:

cd mnt/c

is that feasible?

pitommasi avatar Apr 13 '18 07:04 pitommasi

something like this? (put in ~/.config/thefuck/rules)

nea89o avatar Jun 05 '18 12:06 nea89o

Anyone have ideas how to make this work? I been messing with the baseline @romangraef gave and also trying my own methodology and to no avail. I"m doing this for a capstone project and I'd really like to get this working. It's a super neat project and I want to contribute something to it.

RVALLER avatar Apr 12 '22 01:04 RVALLER

How about sharing your methodology? 🙂

What if match would return True when there's any character in script that can be converted to lowercase?

I can suggest code if you'd like.

scorphus avatar Apr 14 '22 08:04 scorphus

Hey @RVALLER, I posted this snippet about 5 years ago, I'd imagine there have been changes in the way rules work. I haven't been using this tool for a while, (and neither have i been using my rule in that time), therefore i wouldn't know about how to fix it either. However i don't think matching on a single uppercase character is the best way to go about it. Looking at my past code, lowercasing everything probably wasn't too smart, the least one could do would be swapping the case (lower->upper AND upper -> lower) and a bit of a more smarter approach would maybe be analyzing the users keyboard layout / mappings (however that one seems like it would be platform dependent). Im sorry i cant be of help with this anymore.

nea89o avatar Apr 14 '22 13:04 nea89o