mirror of
https://github.com/nvbn/thefuck.git
synced 2025-11-20 16:56:04 +00:00
mkdir -p
When adding directories using `mkdir`, intermediate directories have to
exist, unless you specify the `-p` option:
$ mkdir foo/bar/baz
mkdir: foo/bar: No such file or directory
$ fuck
mkdir -p foo/bar/baz
This commit is contained in:
9
thefuck/rules/mkdir_p.py
Normal file
9
thefuck/rules/mkdir_p.py
Normal file
@@ -0,0 +1,9 @@
|
||||
import re
|
||||
|
||||
def match(command, settings):
|
||||
return ('mkdir' in command.script
|
||||
and 'No such file or directory' in command.stderr)
|
||||
|
||||
|
||||
def get_new_command(command, settings):
|
||||
return re.sub('^mkdir (.*)', 'mkdir -p \\1', command.script)
|
||||
Reference in New Issue
Block a user