/
make_links.py
executable file
·86 lines (67 loc) · 2.59 KB
/
make_links.py
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/local/bin/python3
import os
import subprocess
def neovim():
print("setup neovim")
subprocess.run("ln -sf ~/dotfiles/config/nvim ~/.config/", shell=True)
subprocess.run("ln -sf ~/dotfiles/config/nvim ~/.config/", shell=True)
def fish():
print("setup fish")
dotfiles_path = os.path.join(os.environ["HOME"], "dotfiles/config/fish")
config_path = os.path.join(os.environ["HOME"], ".config/fish")
if not os.path.exists(config_path):
os.mkdir(config_path)
for root, dirs, files in os.walk(dotfiles_path):
for d in dirs:
config_dir_path = os.path.join(config_path, d)
if not os.path.exists(config_dir_path):
os.mkdir(config_dir_path)
for f in files:
dotfiles_file_path = os.path.join(root, f)
dir_name = root.replace(dotfiles_path, "")
if dir_name.split("/")[0] == "":
dir_name = "/".join(dir_name.split("/")[1:])
config_file_path = os.path.join(config_path, dir_name, f)
subprocess.run(["ln", "-sf", dotfiles_file_path, config_file_path])
def zsh():
print("setup zsh")
subprocess.run("ln -sf ~/dotfiles/config/zsh/.zshrc ~/.zshrc", shell=True)
subprocess.run("ln -sf ~/dotfiles/config/zsh/.zshenv ~/.zshenv", shell=True)
def tmux():
print("setup tmux")
subprocess.run("ln -sf ~/dotfiles/config/tmux/.tmux.conf ~/.tmux.conf", shell=True)
def ideavim():
print("setup ideavim")
subprocess.run(
"ln -sf ~/dotfiles/config/ideavim/.ideavimrc ~/.ideavimrc", shell=True
)
def aws():
print("setup aws")
os.makedirs(os.path.join(os.environ["HOME"], ".aws", "cli"), exist_ok=True)
subprocess.run(
"ln -sf ~/dotfiles/config/aws/cli/alias ~/.aws/cli/alias", shell=True
)
def git():
print("setup git")
os.makedirs(os.path.join(os.environ["HOME"], ".config", "git"), exist_ok=True)
subprocess.run("ln -sf ~/dotfiles/config/git/ignore ~/.config/git/ignore", shell=True)
subprocess.run("ln -sf ~/dotfiles/config/git/config ~/.config/git/config", shell=True)
def starship():
print("setup starship")
subprocess.run("ln -sf ~/dotfiles/config/starship/starship.toml ~/.config/starship.toml", shell=True)
def asdf():
print("setup asdf")
subprocess.run("ln -sf ~/dotfiles/config/asdf/.asdfrc ~/.asdfrc", shell=True)
if __name__ == "__main__":
config_dir_path = os.path.join(os.environ["HOME"], ".config")
if not os.path.exists(config_dir_path):
os.mkdir(config_dir_path)
neovim()
fish()
zsh()
tmux()
ideavim()
aws()
git()
starship()
asdf()