Skip to content

Commit

Permalink
Merge pull request #11 from hwixley/mac-ip-support
Browse files Browse the repository at this point in the history
Mac IP support
  • Loading branch information
hwixley committed May 23, 2023
2 parents 91d73b9 + 2363ce4 commit 55db360
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
8 changes: 8 additions & 0 deletions functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,12 @@ arm() {

openfile() {
xdg-open "file:///$1"
}

mac() {
if [[ "$OSTYPE" == "darwin"* ]]; then
return 0
else
return 1
fi
}
12 changes: 10 additions & 2 deletions wix-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,11 @@ elif [ "$1" = "copy" ]; then
elif [ "$1" = "ip" ]; then
echo ""
info_text "Local IPs:"
hostname -I
if mac; then
ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}'
else
hostname -I
fi
echo ""
info_text "Public IP:"
public_ip=$(curl ifconfig.co/json)
Expand All @@ -770,7 +774,11 @@ elif [ "$1" = "ip" ]; then

echo ""
info_text "Eth0 MAC Address:"
cat "/sys/class/net/$(ip route show default | awk '/default/ {print $5}')/address"
if mac; then
ifconfig en1 | awk '/ether/{print $2}'
else
cat "/sys/class/net/$(ip route show default | awk '/default/ {print $5}')/address"
fi
echo ""

elif [ "$1" = "wifi" ]; then
Expand Down

0 comments on commit 55db360

Please sign in to comment.