-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.py
More file actions
executable file
·53 lines (47 loc) · 1.12 KB
/
init.py
File metadata and controls
executable file
·53 lines (47 loc) · 1.12 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
49
50
51
52
53
#! /usr/bin/env -S uv run
# /// script
# requires-python = ">=3.13"
# dependencies = []
# ///
import os
from pathlib import Path
dots = [
{
"dir": Path("."),
"targetPrefix": Path(os.environ["HOME"]),
"paths": [
".zshenv",
".zshrc",
".bin",
],
},
{
"dir": Path(".config"),
"targetPrefix": Path(
os.getenv("XDG_CONFIG_HOME") or (Path(os.environ["HOME"]) / ".config")
),
"paths": [
"ags",
"fish",
"fuzzel",
"helix",
"niri",
"quickshell",
"swaync",
"starship.toml",
"steel-lsp",
],
},
]
def main() -> None:
for dot in dots:
for path in dot["paths"]:
p: Path = dot["targetPrefix"] / path
if p.exists():
print(f"{p} exist and skipped.")
else:
from_path: Path = (dot["dir"] / path).absolute()
p.absolute().symlink_to(from_path)
print(f"{p} created.")
if __name__ == "__main__":
main()