mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2026-09-29 08:14:42 +00:00
Fix regular expression and test
This commit is contained in:
@@ -402,7 +402,7 @@ function p9k::parseIp() {
|
|||||||
for interfaceName in $relevantInterfaces; do
|
for interfaceName in $relevantInterfaces; do
|
||||||
local interface="$(${ROOT_PREFIX}/sbin/ifconfig $interfaceName 2>/dev/null)"
|
local interface="$(${ROOT_PREFIX}/sbin/ifconfig $interfaceName 2>/dev/null)"
|
||||||
# Check if interface is UP.
|
# Check if interface is UP.
|
||||||
if [[ "${interface/${newline}/}" =~ "<UP(,)?[^>]*>(.*?)inet[ ]*([^ ]*)" ]]; then
|
if [[ "${interface/${newline}/}" =~ "<UP(,)?[^>]*>(.*)inet[ ]*([^ ]*)" ]]; then
|
||||||
echo "${match[3]}"
|
echo "${match[3]}"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -212,6 +212,8 @@ function testIpSegmentWorksOnOsxWithNoInterfaceSpecified() {
|
|||||||
function testIpSegmentWorksOnOsxWithInterfaceSpecified() {
|
function testIpSegmentWorksOnOsxWithInterfaceSpecified() {
|
||||||
fakeIfconfig "eth1"
|
fakeIfconfig "eth1"
|
||||||
|
|
||||||
|
local POWERLEVEL9K_IP_INTERFACE="eth1"
|
||||||
|
|
||||||
# Load Powerlevel9k
|
# Load Powerlevel9k
|
||||||
source powerlevel9k.zsh-theme
|
source powerlevel9k.zsh-theme
|
||||||
local OS='OSX' # Fake OSX
|
local OS='OSX' # Fake OSX
|
||||||
@@ -232,6 +234,8 @@ function testIpSegmentWorksOnLinuxWithNoInterfaceSpecified() {
|
|||||||
function testIpSegmentWorksOnLinuxWithInterfaceSpecified() {
|
function testIpSegmentWorksOnLinuxWithInterfaceSpecified() {
|
||||||
fakeIp "eth3"
|
fakeIp "eth3"
|
||||||
|
|
||||||
|
local POWERLEVEL9K_IP_INTERFACE="eth3"
|
||||||
|
|
||||||
# Load Powerlevel9k
|
# Load Powerlevel9k
|
||||||
source powerlevel9k.zsh-theme
|
source powerlevel9k.zsh-theme
|
||||||
local OS='Linux' # Fake Linux
|
local OS='Linux' # Fake Linux
|
||||||
|
|||||||
Reference in New Issue
Block a user