There is a better error handling on each command also it shows the error of the backend commands if they got an error, see below examples
# python ip.py addr show xx
# xx not found
# python ip.py addr show xx 2>/dev/null
#
# python ip.py addr add x
Usage: ip addr show [ dev STRING ]
ip addr { add | del } PREFIX dev STRING
# python ip.py addr add 192.168.50.5 dev
dev not found
Usage: ip addr show [ dev STRING ]
ip addr { add | del } PREFIX dev STRING
# python ip.py addr add 192.168.50.5 dev eth0
Executing: /usr/bin/sudo /sbin/ifconfig eth0 add 192.168.50.5
ifconfig: interface eth0 does not exist
Usage: ip addr show [ dev STRING ]
ip addr { add | del } PREFIX dev STRING
# python ip.py addr del 192.168.50.5 dev eth0
Executing: /usr/bin/sudo /sbin/ifconfig eth0 inet 192.168.50.5 remove
ifconfig: interface eth0 does not exist
Usage: ip addr show [ dev STRING ]
ip addr { add | del } PREFIX dev STRING
# python ip.py route ls en0
Usage: ip route list
ip route get ADDRESS
ip route { add | del } ROUTE
ROUTE := PREFIX [ nexthop NH ]
There is a better error handling on each command also it shows the error of the backend commands if they got an error, see below examples