anvil-editor: init at 0.4
[NixPkgs.git] / pkgs / misc / documentation-highlighter / update.sh
blob8d44e9ddd9a15f8973dd236f6068820098af9d66
1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p curl -p unzip
4 set -eu
5 set -o pipefail
7 root=$(pwd)
9 if [ ! -f "./update.sh" ]; then
10 echo "Please run this script from within pkgs/misc/documentation-highlighter/!"
11 exit 1
14 scratch=$(mktemp -d -t tmp.XXXXXXXXXX)
15 function finish {
16 rm -rf "$scratch"
18 trap finish EXIT
21 mkdir $scratch/src
22 cd $scratch/src
24 curl \
25 -X POST \
26 -H 'Content-Type: application/json' \
27 --data-raw '{
28 "api": 2,
29 "languages": ["bash", "nix", "shell"]
30 }' \
31 https://highlightjs.org/api/download > $scratch/out.zip
34 unzip "$scratch/out.zip"
35 out="$root/"
36 mkdir -p "$out"
37 cp ./highlight.min.js "$out/highlight.pack.js"
38 cp ./{LICENSE,styles/mono-blue.css} "$out"
41 echo "This file was generated with pkgs/misc/documentation-highlighter/update.sh"
42 echo ""
43 cat README.md
44 ) > "$out/README.md"