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

16 lines
367 B
Python

import re
from thefuck.specific.sudo import sudo_support
from thefuck.utils import for_app
@sudo_support
@for_app('cp')
def match(command, settings):
stderr = command.stderr.lower()
return 'omitting directory' in stderr or 'is a directory' in stderr
@sudo_support
def get_new_command(command, settings):
return re.sub(r'^cp', 'cp -a', command.script)