Files
thefuck/thefuck/rules/touch.py
T
2019-12-16 21:56:12 +01:00

15 lines
364 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.output
def get_new_command(command):
path = re.findall(
r"touch: (?:cannot touch ')?(.+)/.+'?:", command.output)[0]
return shell.and_(u'mkdir -p {}'.format(path), command.script)