Add proper exit code

This commit is contained in:
Miguel Morales
2015-05-12 15:57:39 -05:00
parent 0bdcf196aa
commit af2f0304cb

View File

@@ -1,21 +1,21 @@
cite about-plugin cite about-plugin
about-plugin 'pygmentize instead of cat to terminal if possible' about-plugin 'pygmentize instead of cat to terminal if possible'
if [ -z $(which pygmentize) ] if [ -z $(which pygmentize) ]
then then
echo "Pygments is required to use this pluging" echo "Pygments is required to use this pluging"
echo "Install it by doing 'pip install Pygments' as the superuser" echo "Install it by doing 'pip install Pygments' as the superuser"
exit exit 1
fi fi
# get the actual cat binary # get the actual cat binary
CAT_BIN=$(which cat) CAT_BIN=$(which cat)
# replace the cat binary for a pygmentize if possible # replace the cat binary for a pygmentize if possible
cat() cat()
{ {
for var; for var;
do do
pygmentize "$var" 2>/dev/null || "$CAT_BIN" "$var"; pygmentize "$var" 2>/dev/null || "$CAT_BIN" "$var";
done done
} }