summaryrefslogtreecommitdiff
path: root/isabat
blob: 6b797eeb5aed0dd4c2a4c3a8322c847113ef1a71 (plain)
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
#!/usr/bin/env bash
set -euo pipefail

if ! type bat > /dev/null
then
    echo "Error: \$PATH appears to lack bat. Please install it to use isabat."
    exit 1
fi

if [ $( bat --list-languages | grep Isabelle | wc -l) -eq 0 ]
then
    echo "Error: your installation of \`bat\` lacks a syntax highlighter for Isabelle."
    echo ""
    echo "Please place the isabelle.sublime-syntax file in $( bat --config-dir)/syntaxes,"
    echo "then run \`bat cache --build\` to make it available to bat."
    exit 1
fi


if [ $# -eq 0 ]
then
    echo "isabat: pretty-print isabelle theories on a terminal using bat."
    echo ""
    echo "please provide a .thy file to display."
    exit 1
fi

cat "$1" | isabelle2unicode | bat --file-name "$1" --theme TwoDark