Skip to content

Commit a455edb

Browse files
authored
docs(fs_utils): add the documentation for create_symlink (#768)
1 parent 810ab3a commit a455edb

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

kiauh/utils/fs_utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,16 @@ def check_file_exist(file_path: Path, sudo=False) -> bool:
4747

4848

4949
def create_symlink(source: Path, target: Path, sudo=False) -> None:
50+
"""
51+
Helper function to create a symlink from source to target
52+
If the target file exists, it will be overwritten. |
53+
:param source: the source file/directory
54+
:param target: the target file/directory
55+
:param sudo: use sudo if required
56+
:return: None
57+
"""
5058
try:
59+
# -f forcibly creates/overwrites the symlink
5160
cmd = ["ln", "-sf", source.as_posix(), target.as_posix()]
5261
if sudo:
5362
cmd.insert(0, "sudo")

0 commit comments

Comments
 (0)