Changes to how cat works mainly

Cat is now a function rather than an alias. It will tie in with grc if
possible and add syntax highlighting to the file

if not, will fall back do using bat
This commit is contained in:
Jonathan Hodgson 2020-09-15 17:13:32 +01:00
parent 5d263147b1
commit 5b77ceb763
2 changed files with 24 additions and 3 deletions

View file

@ -306,3 +306,16 @@ function debugToggle(){
fi
}
function cat(){
local grcConfigs="$HOME/.config/grc/"
if [ -f "$1" ]; then
local ext="${1##*.}"
if [ -f "${grcConfigs}conf.${ext}" ]; then
/usr/bin/cat "$1" | /usr/bin/grcat "${grcConfigs}conf.${ext}" | /usr/bin/bat --file-name "$1"
else
/usr/bin/bat "$@"
fi
else
/usr/bin/bat "$@"
fi
}