mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-22 12:20:07 +00:00
when ifconfig is not available, use ip; fixes #305
This commit is contained in:
parent
ff305e3d45
commit
39b2064a97
1 changed files with 23 additions and 11 deletions
|
@ -3428,7 +3428,7 @@ _p9k_preexec() {
|
||||||
|
|
||||||
function _p9k_set_iface() {
|
function _p9k_set_iface() {
|
||||||
_p9k_iface=()
|
_p9k_iface=()
|
||||||
[[ -x /sbin/ifconfig ]] || return
|
if [[ -x /sbin/ifconfig ]]; then
|
||||||
local line
|
local line
|
||||||
local iface
|
local iface
|
||||||
for line in ${(f)"$(/sbin/ifconfig 2>/dev/null)"}; do
|
for line in ${(f)"$(/sbin/ifconfig 2>/dev/null)"}; do
|
||||||
|
@ -3439,6 +3439,18 @@ function _p9k_set_iface() {
|
||||||
iface=
|
iface=
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
elif [[ -x /sbin/ip ]]; then
|
||||||
|
local line
|
||||||
|
local iface
|
||||||
|
for line in ${(f)"$(/sbin/ip -4 a show 2>/dev/null)"}; do
|
||||||
|
if [[ $line == (#b)<->:[[:space:]]##([^:]##):[[:space:]]##\<([^\>]#)\>* ]]; then
|
||||||
|
[[ ,$match[2], == *,UP,* ]] && iface=$match[1] || iface=
|
||||||
|
elif [[ -n $iface && $line == (#b)[[:space:]]##inet[[:space:]]##([0-9.]##)* ]]; then
|
||||||
|
_p9k_iface[$iface]=$match[1]
|
||||||
|
iface=
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function _p9k_build_segment() {
|
function _p9k_build_segment() {
|
||||||
|
|
Loading…
Reference in a new issue