1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-14 06:38:32 +00:00

fixed cd_mkdir.py so that it would work in powershell on windows and linux

also modified it and saved it as chdir.py to work for the chdir command on windows and linux as well.
This commit is contained in:
ICalhoun 2021-04-13 14:58:59 -04:00
parent 0192d1f3ef
commit 28aef57b75

View File

@ -8,13 +8,14 @@ from thefuck.shells import shell
@for_app('chdir')
def match(command):
return (
command.script.startswith('chdir ') and any((
command.script.startswith('chdir') and any((
'cannot find the path' in command.output.lower(),
)))
'cannot find path' in command.output.lower(),
'can\'t cd to' in command.output.lower()
)))
@sudo_support
def get_new_command(command):
repl = shell.and_('mkdir -p \\1', 'chdir \\1')
return re.sub(r'^chdir (.*)', repl, command.script)
return re.sub(r'^chdir(.*)', repl, command.script)