Usage of ccze for tail, journalctl and cless

This commit is contained in:
root 2025-01-17 18:27:51 +01:00
parent bcc80df707
commit 9a01507ab5

View File

@ -1,16 +1,25 @@
ccat(){
cat $* | sed -u "s/ERROR/$(tput setaf 1)&$(tput sgr0)/gI"|sed -u "s/WARNING/$(tput setaf 3)&$(tput sgr0)/gI"|sed -u "s/INFO/$(tput setaf 2)&$(tput sgr0)/gI"|sed -u "s/DEBUG/$(tput setaf 6)&$(tput sgr0)/gI"
TAIL_CMD=`which tail`
JOURNALCTL_CMD=`which journalctl`
tail () {
if grep -q -i "\-f" <<< "$*"
then
$TAIL_CMD $* | ccze -A
else
$TAIL_CMD $*
fi
}
cless(){
ccat $* | less -r
journalctl () {
if grep -q "\-f" <<< "$*"
then
$JOURNALCTL_CMD $* | ccze -A
else
$JOURNALCTL_CMD $*
fi
}
ctail(){
tail $* | ccat
}
cgrep(){
grep $* | ccat
cless () {
cat $1 | ccze -A | less -R
}