#N/A: Add a new rule to create directory on cp or mv

This commit is contained in:
Caplinja
2020-03-01 00:07:54 -06:00
committed by Pablo Aguiar
parent 444908ce1c
commit 88db57b4b1
3 changed files with 46 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
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)