Compare commits

..

3 Commits

Author SHA1 Message Date
Heavy@Hetzner
03f804f1f3 Removed dpkg check, check is already done on installation. 2023-01-27 09:38:17 +00:00
Heavy@Hetzner
13caedb7b1 Added debian check, to provide functions only on debian systems. 2023-01-27 09:33:10 +00:00
Heavy@Hetzner
1c00eadb7b Added fdfind and tldr++ check. 2023-01-27 09:27:44 +00:00
2 changed files with 34 additions and 14 deletions

View File

@ -69,6 +69,15 @@ alias sol-dark='set-scheme.sh solarized.dark'
alias quota='quota -gls'
{{ end -}}
# if tldr++ is installed, use it the static way
if tldr --version &> /dev/null
then
tldrVersion="$(tldr --version 2>&1)"
if [[ $tldrVersion =~ tldr\+\+.* ]]; then
alias tldr='tldr --static'
fi
fi
# Depending on availability
if [ -x /usr/bin/batcat ]; then
alias cat='batcat'
@ -76,3 +85,8 @@ fi
if [ -x /usr/bin/bat ] || [ -x bat ]; then
alias cat='bat'
fi
# 'fd' on Debian is 'fdfind'
if [ -x /usr/bin/fdfind ]; then
alias fd='fdfind'
fi

View File

@ -113,28 +113,34 @@ list-ssh-keys() {
done
}
{{ if eq .chezmoi.os "linux" }}
{{ if eq .chezmoi.osRelease.id "debian" }}
# Show version of a Debian package
debversion() {
if [ -x dpkg ]; then
local pkgname="${1:?packagename required}"
dpkg -s $pkgname | grep Version
else
echo "not a Debian based system!"
return 42
fi
}
# Show files of a Debian package
deblist() {
if [ -x dpkg ]; then
local pkgname="${1:?packagenamme required}"
dpkg-query -L $pkgname
else
echo "not a Debian based system!"
return 42
fi
}
# Show apt installation history
debhistory() {
zcat /var/log/apt/history.log.*.gz | \
/usr/bin/cat - /var/log/apt/history.log | \
grep -Po '^Commandline:(?= apt)(?=.* install ) \K.*|^Start-Date: \K.*' | \
grep -B1 "^apt" | \
grep -v -- "^--" | \
paste -d " " - - | \
sort
}
{{ end }}
{{ end }}
# Run 'top' by a list of processes matching name.
topby() {
local name=${1:?name required}