Add no hard link support for ln
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
"""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.utils import for_app
|
||||
from thefuck.specific.sudo import sudo_support
|
||||
|
||||
|
||||
@sudo_support
|
||||
@for_app('ln')
|
||||
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)
|
||||
Reference in New Issue
Block a user