brona / iproute2mac

CLI wrapper for basic network utilites on Mac OS X inspired with iproute2 on Linux systems - ip command.
MIT License
898 stars 73 forks source link

Show the interface at the end of inet #1

Closed tetherit closed 9 years ago

tetherit commented 9 years ago

Great job on this app! - Very useful!

However on linux you get output like this:

$ ip addr
1: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 6c:f0:49:56:4f:dd brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.1/24 brd 192.168.0.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet 192.168.88.1/24 brd 192.168.88.255 scope global eth0:0
       valid_lft forever preferred_lft forever

Notice the eth0 and eth0:0 at the end of the "inet" lines.

From this script the output is:

$ ip addr
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 50:e5:49:ef:45:8f 
    inet6 fe80::52e5:49ff:feef:458f/64 scopeid 0x4
    inet 192.168.0.2/24 brd 192.168.0.255

Note the inet line ends with the netmask, not with the network interface name.

Could you please change the code to match the linux style? - It makes grepping for the interface and IP a lot easier everything being on a single line!

brona commented 9 years ago

Just released v1.0.2, please test.