-
Notifications
You must be signed in to change notification settings - Fork 7
/
gen_icons.sh
executable file
·49 lines (41 loc) · 1.18 KB
/
gen_icons.sh
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
#!/bin/bash
set -e
SRC_URL="https://raw.githubusercontent.com/nvim-tree/nvim-web-devicons/master/lua/nvim-web-devicons/icons-default.lua"
echo "Updating from ${SRC_URL}..."
curl -o icons-default.lua -s ${SRC_URL}
cat <<EOF | lua > icons.py
local function p(name, d)
print(name .. ' = {')
local keys = {}
for k in pairs(d) do table.insert(keys, k) end
table.sort(keys)
for _, k in ipairs(keys) do
local v = d[k]
print(" '" .. k .. "': '" .. v.icon .. "',")
end
print('}')
end
local d = loadfile('icons-default.lua')()
print('# vim: set fileencoding=utf-8')
print('# autogenerated with gen_icons.sh')
print('')
p('file_node_extensions', d.icons_by_file_extension)
p('file_node_exact_matches', d.icons_by_filename)
print([[
file_node_pattern_matches = {
'.*jquery.*.js$' : '',
'.*angular.*.js$' : '',
'.*backbone.*.js$' : '',
'.*require.*.js$' : '',
'.*materialize.*.js$' : '',
'.*materialize.*.css$' : '',
'.*mootools.*.js$' : '',
'.*vimrc.*' : '',
'Vagrantfile$' : ''
}
]])
EOF
rm -f icons-default.lua
echo "Testing updated icons.py"
python icons.py
echo "Success!"