-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlink.py
More file actions
executable file
·48 lines (34 loc) · 1.15 KB
/
link.py
File metadata and controls
executable file
·48 lines (34 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
# Purpose: set up config symlinks
import os
import platform
import sys
def dotfile_dir():
return os.path.dirname(os.path.realpath(__file__))
def home():
return os.environ["HOME"]
def check_platform():
supported_systems = ["Linux_x86_64", "Darwin_x86_64", "Darwin_arm64"]
system = platform.system()
machine = platform.machine()
if f"{system}_{machine}" not in supported_systems:
print(f"Unrecognized platform, aborting: {system}_{machine}")
sys.exit(1)
def link():
print("Checking for missing config symlinks...")
links = [
(f"{dotfile_dir()}/init.lua", f"{home()}/.config/nvim/init.lua"),
(f"{dotfile_dir()}/tmux.conf", f"{home()}/.tmux.conf"),
(f"{dotfile_dir()}/ghostty.conf", f"{home()}/.config/ghostty/config"),
]
for src, dest in links:
if os.path.isfile(dest) or os.path.islink(dest):
continue
print(f"Link {dest} not found, creating {src} -> {dest}")
os.makedirs(os.path.dirname(dest), exist_ok=True)
os.symlink(src, dest)
def main():
check_platform()
link()
if __name__ == "__main__":
main()