1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-25 03:59:08 +00:00
thefuck/thefuck/rules/cp_create_destination.py

16 lines
419 B
Python

from thefuck.shells import shell
from thefuck.utils import for_app
@for_app("cp", "mv")
def match(command):
return (
"No such file or directory" in command.output
or command.output.startswith("cp: directory")
and command.output.rstrip().endswith("does not exist")
)
def get_new_command(command):
return shell.and_(u"mkdir -p {}".format(command.script_parts[-1]), command.script)