thefuck
thefuck copied to clipboard
Upper to lower case
This rule convert the upper case letters of the command to lower case, only if all the letters of the command are uppercase (which is the most common mistake with upper and lower case letters).
For example, if I type
$ LS
an error will occur. So I will type
$ fuck
ls [enter/↑/↓/ctrl+c]
This one is a nice idea, but what about LS _A
?
And, a watching point : env vars are upper case, and comes before the command :
FLASK_APP=app python -m flask run
(I don't know, if either of this points are relevant, just thinking :thinking: )
Yes you are right, I will try to fix those too. I'm open to suggestions. Thanks!
@scorphus I converted this pull request to a draft, so I can improve it as @Rom1deTroyes mentioned. I have already write some code. Do you think is a good idea?
I have a much simpler implementation as part of my local rules, which seems to catch most of my issues, and doesnt try to do too much:
from thefuck.utils import get_all_executables, which
def match(command):
return (command.script.isupper()
and not which(command.script_parts[0])
and ('not found' in command.output
or 'is not recognized as' in command.output)
and (command.script_parts[0].lower() in get_all_executables()))
def get_new_command(cmd):
return cmd.script.lower()
requires_output = False
priority = 100
Thank you very much for reviewing! I followed your instructions.