-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathget_hooks.py
30 lines (24 loc) · 1021 Bytes
/
get_hooks.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
#!/usr/bin/env python
import json
import sys
from slack_cli_hooks.protocol import DefaultProtocol, MessageBoundaryProtocol, Protocol, build_protocol
PROTOCOL: Protocol
# Wrap sys.executable in quotes to prevent execution failures if a white space is present in the absolute python path
EXEC = f"'{sys.executable}'" or "python3"
hooks_payload = {
"hooks": {
"get-manifest": f"{EXEC} -m slack_cli_hooks.hooks.get_manifest",
"start": f"{EXEC} -X dev -m slack_cli_hooks.hooks.start",
"check-update": f"{EXEC} -m slack_cli_hooks.hooks.check_update",
"doctor": f"{EXEC} -m slack_cli_hooks.hooks.doctor",
},
"config": {
"watch": {"filter-regex": "(^manifest\\.json$)", "paths": ["."]},
"protocol-version": [MessageBoundaryProtocol.name, DefaultProtocol.name],
"sdk-managed-connection-enabled": True,
},
"runtime": "python",
}
if __name__ == "__main__":
PROTOCOL = build_protocol(argv=sys.argv)
PROTOCOL.respond(json.dumps(hooks_payload))