aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xfunctions/utilities.zsh2
-rwxr-xr-xtest/segments/ip.spec4
2 files changed, 5 insertions, 1 deletions
diff --git a/functions/utilities.zsh b/functions/utilities.zsh
index 9a72eab8..5532eef6 100755
--- a/functions/utilities.zsh
+++ b/functions/utilities.zsh
@@ -402,7 +402,7 @@ function p9k::parseIp() {
for interfaceName in $relevantInterfaces; do
local interface="$(${ROOT_PREFIX}/sbin/ifconfig $interfaceName 2>/dev/null)"
# Check if interface is UP.
- if [[ "${interface/${newline}/}" =~ "<UP(,)?[^>]*>(.*?)inet[ ]*([^ ]*)" ]]; then
+ if [[ "${interface/${newline}/}" =~ "<UP(,)?[^>]*>(.*)inet[ ]*([^ ]*)" ]]; then
echo "${match[3]}"
return 0
fi
diff --git a/test/segments/ip.spec b/test/segments/ip.spec
index 9fb0bddb..2dce55f7 100755
--- a/test/segments/ip.spec
+++ b/test/segments/ip.spec
@@ -212,6 +212,8 @@ function testIpSegmentWorksOnOsxWithNoInterfaceSpecified() {
function testIpSegmentWorksOnOsxWithInterfaceSpecified() {
fakeIfconfig "eth1"
+ local POWERLEVEL9K_IP_INTERFACE="eth1"
+
# Load Powerlevel9k
source powerlevel9k.zsh-theme
local OS='OSX' # Fake OSX
@@ -232,6 +234,8 @@ function testIpSegmentWorksOnLinuxWithNoInterfaceSpecified() {
function testIpSegmentWorksOnLinuxWithInterfaceSpecified() {
fakeIp "eth3"
+ local POWERLEVEL9K_IP_INTERFACE="eth3"
+
# Load Powerlevel9k
source powerlevel9k.zsh-theme
local OS='Linux' # Fake Linux