forked from Arcticons-Team/Arcticons-Linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate-all.sh
executable file
·84 lines (72 loc) · 1.95 KB
/
generate-all.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env bash
# USAGE:
# ./generate-all.sh [--regenerate]
# When --regenerate is specified the folders arcticons-dark and arcticons-light
# will be deleted and completely regenerated.
set -euo pipefail
# go to the path of the script
cd -P -- "$(dirname "$0")"
# Check if the icons folder of our parent repo exists, if not abort
if [ ! -e ../icons/white ]; then
echo "Icon folder not found!"
exit 1
fi
# Check if Inkscape and Scour are installed, if not abort
if ! type inkscape || ! type scour; then
echo "Inkscape not found!"
exit 1
fi
if ! type xmlstarlet; then
echo "xmlstarlet not found!"
exit 1
fi
# Check if ./generate-manual.sh exists, if not abort
if [ ! -e ./generate-manual.sh ]; then
echo "Script ./generate-manual.sh not found!"
exit 1
fi
# Check if yq and jq are installed, if not abort
if ! type yq >/dev/null || ! type jq >/dev/null; then
echo "error: yq and jq need to be installed for yaml parsing"
exit 1
fi
# sort the mapping.yaml file with yq
if [[ $(yq --version) == *"(https://github.com/mikefarah/yq/)"* ]]; then
yq -i -P '.[] |= sort' mapping.yaml
yq -i -P 'sort_keys(..)' mapping.yaml
else
yq -Syi '.[] |= sort' mapping.yaml
fi
# parse command line arguments
regenerate=false
while [[ $# -gt 0 ]]; do
case $1 in
--regenerate)
regenerate=true
;;
*)
echo "Unexpected option $1"
exit 1
;;
esac
shift
done
for style in black white; do
if [ $style == "black" ]; then
variant="Light"
else
variant="Dark"
fi
options=(--style "$style" --line-weight 2 --destination "./arcticons-${variant,,}")
if $regenerate; then
options+=(--remove)
fi
./generate-manual.sh "${options[@]}"
# fix up the index.theme files
index="./arcticons-${variant,,}/index.theme"
sed -i "s/Name=Arcticons/Name=Arcticons $variant/g" "$index"
sed -i "s/Comment=A Line-based icon pack\\./Comment=A Line-based icon pack. (Version for ${variant,,} themes)/g" "$index"
if [ $variant == "Dark" ]; then
sed -i 's/breeze/breeze-dark/g' "$index"
fi
done