-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·68 lines (51 loc) · 1.73 KB
/
install
File metadata and controls
executable file
·68 lines (51 loc) · 1.73 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env python3
# encoding: utf-8
from os import environ, listdir
from os.path import dirname, exists, expanduser, join, realpath
from subprocess import call
from time import sleep
def ask_yn(question):
question += ' (y/n) '
answer = None
while answer not in ['yes', 'y', 'no', 'n']:
answer = input(question).lower()
return answer.startswith('y')
def run(command):
return call(command, shell=True)
def _main():
# get dotfiles directory
dotfiles_dir = dirname(realpath(__file__))
# run installer
installer_path = join(dotfiles_dir, 'installer/installer.py')
run('python3 ' + installer_path)
# "install" git submodules
print('\n\n"installing" git submodules...', flush=True)
sleep(2)
run(' && '.join(['cd ' + dotfiles_dir,
'git submodule init',
'git submodule update']))
# install homebrew stuff
print('\n')
if ask_yn('install homebrew stuff?'):
run('brew bundle')
run('open -a hammerspoon')
# create tags for vim documentation
print('\n\ncreating tags for vim documentation...', end='', flush=True)
sleep(2)
run('mvim -c "Helptags | quit"; sleep 1; open -a ghostty')
print('done')
# source macOS
cmd = 'source "%s/macOS"' % dotfiles_dir
print('\n')
if ask_yn(cmd + '?'):
run(cmd)
# show tips
print('\n\ntips:')
print(' - modify ~/.gitfiles/template/hooks -- it\'s an absolute symlink')
print(' to /Users/narf/.gitfiles/hooks (sorry)')
# tell how to switch to zsh
shell = environ.get('SHELL')
if not shell or not shell.endswith('zsh'):
print(' - run "chsh -s /bin/zsh" to switch to zsh')
if __name__ == '__main__':
_main()