1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-23 19:18:46 +00:00
thefuck/thefuck/rules/upper_to_lower_case.py
2022-06-20 16:39:34 +00:00

21 lines
710 B
Python

from thefuck.utils import get_all_executables, which
# this rule is activated when the typed command is
# in uppercase letters and if the command is not
# executed. However in order to activate this rule
# it is necessary the first word of the whole command
# to be valid.
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()))
# returns the same command in lowercase letters
def get_new_command(cmd):
return cmd.script.lower()
requires_output = False
priority = 100