This repository has been archived by the owner on Sep 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nztunnellers.py
executable file
·51 lines (37 loc) · 1.69 KB
/
nztunnellers.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
#!/usr/bin/env python3.7
# -*- coding: utf-8 -*-
import iterm2
async def SwitchProfile(connection, session, profile_name):
print("Switching profile to: " + profile_name)
partialProfiles = await iterm2.PartialProfile.async_query(connection)
for partial in partialProfiles:
if partial.name == profile_name:
full = await partial.async_get_full_profile()
await session.async_set_profile(full)
# Main
async def main(connection):
app = await iterm2.async_get_app(connection)
window = app.current_terminal_window
if app.current_terminal_window is None:
await window.async_create_tab()
main = await window.async_create_tab()
await main.async_activate()
# Create a main terminal for interactive terminal tasks
session = main.current_session
# # Set profile to nztunnellers
await SwitchProfile(connection, session, "Main Profile")
await session.async_activate()
await session.async_send_text("..\n")
await session.async_send_text("cd nztunnellers\n")
# Start server
serverSession = await session.async_split_pane(vertical=True, before=False)
await SwitchProfile(connection, serverSession, "nztunnellers Server Profile")
await serverSession.async_send_text("..\ncd nztunnellers/\n")
await serverSession.async_send_text("make run-server\n")
# Start client
webappSession = await serverSession.async_split_pane()
await SwitchProfile(connection, webappSession, "nztunnellers WebApp Profile")
await webappSession.async_send_text("..\ncd nztunnellers/\n")
await webappSession.async_send_text("make run-client\n")
await session.async_activate(select_tab=True)
iterm2.run_until_complete(main)