Skip to content

Commit 7c38c85

Browse files
cli-s1ncocool97
authored andcommitted
feat(models): add update_models.sh script
1 parent 054b043 commit 7c38c85

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

update_models.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
3+
# Script downloading the latest Apple devices and outputting an appledb-compatible JSON
4+
5+
DEVICES_URL="https://gist.githubusercontent.com/adamawolf/3048717/raw/Apple_mobile_device_types.txt"
6+
7+
REMOVE_KEYS="i386 x86_64 arm64"
8+
9+
curl -s "$DEVICES_URL" \
10+
| jq -Rn --arg remove_keys "$REMOVE_KEYS" '
11+
reduce inputs as $line ({};
12+
if ($line | test(":")) then
13+
. + {
14+
($line | split(":")[0] | gsub("^\\s+|\\s+$"; "")):
15+
($line | split(":")[1] | gsub("^\\s+|\\s+$"; ""))
16+
}
17+
else
18+
.
19+
end
20+
)
21+
| ( $remove_keys | split(" ") ) as $keys
22+
| reduce $keys[] as $k (.;
23+
del(.[$k])
24+
)
25+
'

0 commit comments

Comments
 (0)