1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-22 04:10:07 +00:00

IP is now customizable. By default we try to get the ip of en1 (on OSX) and eth0 on all other systems.

This commit is contained in:
Dominik Ritter 2015-08-26 19:56:49 +02:00
parent 730697893e
commit 61daa647f1

View file

@ -558,15 +558,16 @@ prompt_icons_test() {
} }
prompt_ip() { prompt_ip() {
# TODO: Specify Interface by variable! if [[ -z "$POWERLEVEL9K_IP_INTERFACE" ]]; then
if [[ "$OS" == "OSX" ]]; then if [[ "$OS" == "OSX" ]]; then
# Try to get IP addresses from common interfaces. POWERLEVEL9K_IP_INTERFACE="en1"
ip=$(ipconfig getifaddr en0 || ipconfig getifaddr en1) else
else POWERLEVEL9K_IP_INTERFACE="eth0"
# Take the first IP that `hostname -I` gives us. fi
ip=$(hostname -I | grep -o "[0-9.]*" | head -n 1)
fi fi
$1_prompt_segment "$0" "cyan" "$DEFAULT_COLOR" "$(print_icon 'NETWORK_ICON') $ip"
ip=$(ifconfig $POWERLEVEL9K_IP_INTERFACE 2> /dev/null | grep -o "inet\s[0-9.]*")
$1_prompt_segment "$0" "cyan" "$DEFAULT_COLOR" "$(print_icon 'NETWORK_ICON') ${ip#inet }"
} }
prompt_load() { prompt_load() {