MCPcopy Create free account
hub / github.com/dot-agent/nextpy / ln

Function ln

nextpy/utils/path_ops.py:84–104  ·  view source on GitHub ↗

Create a symbolic link. Args: src: The path to the file or directory. dest: The path to the destination. overwrite: Whether to overwrite the destination. Returns: Whether the link was successful.

(src: str, dest: str, overwrite: bool = False)

Source from the content-addressed store, hash-verified

82
83
84def ln(src: str, dest: str, overwrite: bool = False) -> bool:
85 """Create a symbolic link.
86
87 Args:
88 src: The path to the file or directory.
89 dest: The path to the destination.
90 overwrite: Whether to overwrite the destination.
91
92 Returns:
93 Whether the link was successful.
94 """
95 if src == dest:
96 return False
97 if not overwrite and (os.path.exists(dest) or os.path.islink(dest)):
98 return False
99 if os.path.isdir(src):
100 rm(dest)
101 os.symlink(src, dest, target_is_directory=True)
102 else:
103 os.symlink(src, dest)
104 return True
105
106
107def which(program: str) -> str | None:

Callers

nothing calls this directly

Calls 1

rmFunction · 0.85

Tested by

no test coverage detected