4392d3a923eddd4e9d0f9b17a1e995cc9aa5cc96

Author
Ben Iofel <github@iofel.me>
Committer
GitHub <noreply@github.com>
Date

Message

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

Diff

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