forked from HMaker/python-cdp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-cdp.sh
More file actions
executable file
·30 lines (25 loc) · 785 Bytes
/
update-cdp.sh
File metadata and controls
executable file
·30 lines (25 loc) · 785 Bytes
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
#!/bin/bash
BASE_URL="https://raw.githubusercontent.com/ChromeDevTools/devtools-protocol"
download_protocol_files() {
local commit_hash="$1"
if ! wget "${BASE_URL}/${commit_hash}/json/browser_protocol.json" -O pycdp/gen/browser_protocol.json; then
echo "Error: Failed to download browser_protocol"
exit 1
fi
if ! wget "${BASE_URL}/${commit_hash}/json/js_protocol.json" -O pycdp/gen/js_protocol.json; then
echo "Error: Failed to download js_protocol"
exit 1
fi
}
generate_cdp_classes() {
if ! python pycdp/gen/generate.py; then
echo "Error: Failed to execute cdpgen"
exit 1
fi
}
main() {
local commit_hash="${1:-master}"
download_protocol_files "$commit_hash"
generate_cdp_classes
}
main "$@"