commit 7d40230479b88ac12ce7eb9e51d27ce49f4e5975
parent 9a5b89f9a3f7d86e0e0614aba90741568e910148
Author: Jan Pobrislo <ccx@webprojekty.cz>
Date: Tue, 26 Jul 2022 17:10:05 +0200
Fancy colorful unicode issue-gen
Diffstat:
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/command/issue-gen b/command/issue-gen
@@ -1,14 +1,15 @@
#!/bin/zsh
setopt no_unset extended_glob
exec >/etc/.new.issue.$$
-printf '%s\n' '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
-ip a | awk '
+printf '%s\n' '───┬───────────────────────────────────────────────────────────────────────'
+ip a | awk -v CSI=$'\033[' -v l=$'\033[0m│' '
/^[0-9]/ { iface = $2; sub(/:$/, "", iface) }
-/link\/ether/ { printf "MAC %s (%s)\n", $2, iface }
-/ scope global/ { gsub(/^ */,"NET "); print }
+/link\/ether/ { printf "%s (%s)\n", CSI "33m" $2 l, iface }
+/ scope global/ { gsub(/^ */,CSI"36mNET"l); print }
'
for f in /etc/ssh/ssh_host_*_key.pub(N); do
- printf 'SSH '
+ printf '\033[32mSSH\033[0m│'
ssh-keygen -l -f $f
done
+printf '%s\n' '───┘'
mv /etc/.new.issue.$$ /etc/issue