summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xisabat18
-rw-r--r--isabat.nix2
2 files changed, 19 insertions, 1 deletions
diff --git a/isabat b/isabat
index 12efd1d..6b797ee 100755
--- a/isabat
+++ b/isabat
@@ -1,12 +1,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
+ exit 1
fi
cat "$1" | isabelle2unicode | bat --file-name "$1" --theme TwoDark
diff --git a/isabat.nix b/isabat.nix
index 7fc05f2..de6ce6f 100644
--- a/isabat.nix
+++ b/isabat.nix
@@ -17,6 +17,8 @@ stdenv.mkDerivation {
cp $src isabat
substituteInPlace isabat \
--replace isabelle2unicode "${isabelle-unicode}/bin/isabelle2unicode"
+ substituteInPlace isabat \
+ --replace " bat " " ${pkgs.bat}/bin/bat "
cp isabat $out
'';
}