From 4392d3a923eddd4e9d0f9b17a1e995cc9aa5cc96 Mon Sep 17 00:00:00 2001
From: Ben Iofel <github@iofel.me>
Date: Tue, 15 Nov 2022 18:29:48 +0000
Subject: [PATCH] feat(systemadmin): color `ip` if shell is interactive
 (#11107)

---
 plugins/systemadmin/systemadmin.plugin.zsh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/plugins/systemadmin/systemadmin.plugin.zsh b/plugins/systemadmin/systemadmin.plugin.zsh
index 8e5e0af71..9b5159ff1 100644
--- a/plugins/systemadmin/systemadmin.plugin.zsh
+++ b/plugins/systemadmin/systemadmin.plugin.zsh
@@ -33,6 +33,14 @@ alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr | head
 # top10 of the history
 alias hist10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10'
 
+function ip() {
+    if [ -t 1 ]; then
+        command ip -color "$@"
+    else
+        command ip "$@"
+    fi
+}
+
 # directory LS
 function dls() {
     print -l *(/)