Browse Source

feat(systemadmin): color `ip` if shell is interactive (#11107)

Ben Iofel 1 year ago
parent
commit
4392d3a923
1 changed files with 8 additions and 0 deletions
  1. 8 0
      plugins/systemadmin/systemadmin.plugin.zsh

+ 8 - 0
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 *(/)