Compare commits

...

2 Commits

Author SHA1 Message Date
xeruf cb4b56da96 config/git/prepare-commit-msg: remove file extension 2024-07-25 12:42:47 +03:00
xeruf c5382934e1 config/bash/aliases: update status and fix prompt exit code 2024-07-25 12:39:13 +03:00
2 changed files with 23 additions and 13 deletions

View File

@ -39,24 +39,31 @@ xtrace () {
set +x
}
highlight() { echo "$1"; }
highlight() { echo; echo "$1"; }
status() {
highlight 'System'
free -h
df -h -T --exclude-type=tmpfs --exclude-type=devtmpfs --exclude-type=squashfs --exclude-type=overlay
zfs list -d 0
sudo certbot certificates
zfs list -d 0 2>/dev/null
free -h
sudo certbot certificates 2>/dev/null
highlight 'Internet'
#--color=always
ip -brief address | grep --color=none -E '^(wl|en|tun|vmbr)'
ip route
echo -n 'IPv4: ' && timeout 3s ping example.com -A -c 3 -w 3 -q -4
echo -n 'IPv6: ' && timeout 3s ping example.com -A -c 3 -w 3 -q -6
highlight 'Programs'
tmux ls
$sudo systemctl --no-pager list-units --failed || service --status-all
if type docker >/dev/null
then $sudo docker ps || $sudo systemctl status docker
tmux ls 2>/dev/null
$sudo systemctl --no-pager list-units --failed --no-legend || service --status-all
echo '== WEBSERVER'
{ sudo lsof -i :443 || sudo lsof -i :80; } | head -4
echo
if type docker &>/dev/null
then
echo '== DOCKER'
$sudo docker ps || $sudo systemctl status docker
fi
}
@ -67,6 +74,9 @@ disks() {
sudo fdisk -l
} | less
}
scandisks() {
for host in /sys/class/scsi_host/*; do echo "- - -" | sudo tee $host/scan; ls /dev/sd* ; done
}
__u="$sudo apt update && $sudo apt upgrade"
alias u="$__u"
@ -121,8 +131,8 @@ shopt -oq posix || src /etc/bash_completion
# Fancy prompt
PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]"
PS1="$PS1 \`if [ \$? = 0 ]; then echo -e '\[\033[01;32m\]:)';"
PS1="$PS1 else echo -e '\[\033[01;31m\]' \$?; fi\`\[\033[00m\]"
PS1="$PS1 \`exitcode=\${?}; if test \$exitcode = 0; then printf '\[\033[01;32m\] :)';"
PS1="$PS1 else printf '\[\033[01;31m\]%3d' \$exitcode; fi\`\[\033[00m\]"
;;
(*zsh) setopt sh_word_split;;
esac
@ -130,4 +140,4 @@ esac
src /usr/share/git/completion/git-prompt.sh && PS1="$PS1\$(__git_ps1 \" (%s)\")"
src $HOME/.config/shell/functions
PS1="$PS1 \$ "
PS1="$PS1 \`test \$UID = 0 && printf '#' || printf '$'\` "

View File

@ -27,8 +27,8 @@ if beginswith $'\n#' "$original"; then
expr substr "$common" 1 "$count" | sed 's|.local/bin/scripts|bin|') || exit 0
case "$path" in ([0-9]-*) path="${path#*-}";; esac
{
# Remove initial dot and trailing slash/dash/underscore
echo "$path" | sed 's|^\.||;s|[/_-]\?$|: |'
# Remove initial dot, file extension, trailing slash/dash/underscore
echo "$path" | sed 's|^\.||;s|\.\([a-z]*\)$||;s|[/_-]\?$|: |'
echo "$original"
} > "$COMMIT_MSG_FILE"
fi