mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-21 01:59:10 +00:00
24 lines
519 B
Python
24 lines
519 B
Python
# -*- coding: utf-8 -*-
|
||
"""Suggest creating symbolic link if hard link is not allowed.
|
||
|
||
Example:
|
||
> ln barDir barLink
|
||
ln: ‘barDir’: hard link not allowed for directory
|
||
|
||
--> ln -s barDir barLink
|
||
"""
|
||
|
||
import re
|
||
from thefuck.specific.sudo import sudo_support
|
||
|
||
|
||
@sudo_support
|
||
def match(command):
|
||
return (command.stderr.endswith("hard link not allowed for directory") and
|
||
command.script.startswith("ln "))
|
||
|
||
|
||
@sudo_support
|
||
def get_new_command(command):
|
||
return re.sub(r'^ln ', 'ln -s ', command.script)
|