-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathget_hooks.py
More file actions
38 lines (32 loc) · 1.14 KB
/
get_hooks.py
File metadata and controls
38 lines (32 loc) · 1.14 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
#!/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": {
"protocol-version": [MessageBoundaryProtocol.name, DefaultProtocol.name],
"sdk-managed-connection-enabled": True,
"watch": {
"app": {
"filter-regex": "\\.py$",
"paths": ["."],
},
"manifest": {
"paths": ["manifest.json"],
},
},
},
"runtime": "python",
}
if __name__ == "__main__":
PROTOCOL = build_protocol(argv=sys.argv)
PROTOCOL.respond(json.dumps(hooks_payload))