mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-20 09:39:01 +00:00
fixed cd_mkdir.py so it works with windows powershell and added a rule for chdir for powershell
This commit is contained in:
parent
559cd8fa8c
commit
0192d1f3ef
@ -11,7 +11,9 @@ def match(command):
|
|||||||
command.script.startswith('cd ') and any((
|
command.script.startswith('cd ') and any((
|
||||||
'no such file or directory' in command.output.lower(),
|
'no such file or directory' in command.output.lower(),
|
||||||
'cd: can\'t cd to' in command.output.lower(),
|
'cd: can\'t cd to' in command.output.lower(),
|
||||||
'does not exist' in command.output.lower()
|
'does not exist' in command.output.lower(),
|
||||||
|
'cannot find the path' in command.output.lower(),
|
||||||
|
'cannot find path' in command.output.lower()
|
||||||
)))
|
)))
|
||||||
|
|
||||||
|
|
||||||
|
20
thefuck/rules/chdir.py
Normal file
20
thefuck/rules/chdir.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import re
|
||||||
|
from thefuck.utils import for_app
|
||||||
|
from thefuck.specific.sudo import sudo_support
|
||||||
|
from thefuck.shells import shell
|
||||||
|
|
||||||
|
|
||||||
|
@sudo_support
|
||||||
|
@for_app('chdir')
|
||||||
|
def match(command):
|
||||||
|
return (
|
||||||
|
command.script.startswith('chdir ') and any((
|
||||||
|
'cannot find the path' 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)
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user