1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-04-15 15:20:42 +01:00
thefuck/thefuck/rules/touch.py
2016-01-29 13:09:40 +03:00

14 lines
349 B
Python

import re
from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('touch')
def match(command):
return 'No such file or directory' in command.stderr
def get_new_command(command):
path = re.findall(r"touch: cannot touch '(.+)/.+':", command.stderr)[0]
return shell.and_(u'mkdir -p {}'.format(path), command.script)