-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvsp
More file actions
executable file
·50 lines (42 loc) · 1.23 KB
/
Copy pathvsp
File metadata and controls
executable file
·50 lines (42 loc) · 1.23 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
#!/usr/bin/env python3
# vi :ft=python:
import os
import re
import yaml
from sh import vagrant
from sh import which
def generate_tmuxinattor(servers):
config = {
'name': 'vagrant',
'root': os.getcwd(),
'windows': [
{
'vagrant': {
'layout': 'even-vertical',
'synchronize': 'after',
'panes': ['vagrant ssh ' + x for x in servers]
}
}
]
}
with open('.tmuxinator.yml', 'w') as stream:
stream.write(yaml.dump(config, default_flow_style=False))
def main():
"""docstring for main"""
pre_script = [
'''tell application "iTerm2"''',
'''tell current session of current window''',
'''split vertically with default profile command "bash -c \\"source ~/.zshrc && tmuxinator\\""''',
'''end tell''',
'''end tell'''
]
servers = []
for line in vagrant('status').split('\n'):
search = re.search('(\w*)\s*running \(virtualbox\)', line)
if search:
servers += [search.group(1)]
#print(search.groups())
generate_tmuxinattor(servers)
print('\n'.join(pre_script))
if __name__ == '__main__':
main()