Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 34 lines (28 sloc) 722 Bytes
#!/usr/bin/env sh
#
# Blaze allows language-agnostic literate-style programming
# Copyright (c) 2017 Tristram Oaten <tristram@oaten.name>
# License: MIT <https://opensource.org/licenses/MIT>
# Site: blaze.oat.sh
#
args=$1
script=$2
if [ "$1" = "--upgrade" ]
then
sudo wget blaze.oat.sh/blaze -q -O $(readlink -f $0)
sudo chmod +x $(readlink -f $0)
echo "Blaze upgraded to latest"
exit 0
fi
file_extension=$(echo $script |awk -F . '{if (NF>1) {print $NF}}')
if [ "$file_extension" = "md" ]
then
awk '{ if (/^```/) { i++; next } if ( i % 2 == 1) { print } }'< $script > $script.out
$args $script.out
exit_code=$?
rm $script.out
else
$args $script
exit_code=$?
fi
exit $exit_code
You can’t perform that action at this time.