From: Michael Tremer Date: Fri, 21 Sep 2018 13:19:58 +0000 (+0200) Subject: Extend "network status" X-Git-Tag: 010~40 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=3a3eeb1de84ef4e133204f0777651b3242b3ed16;p=network.git Extend "network status" This now takes ports, devices and PHYs and prints the appropriate status. This is very handy and just a shortcut. Signed-off-by: Michael Tremer --- diff --git a/src/network b/src/network index ae4016d6..d759700f 100644 --- a/src/network +++ b/src/network @@ -1108,11 +1108,40 @@ cli_status() { local log_disable_stdout=${LOG_DISABLE_STDOUT} LOG_DISABLE_STDOUT="true" - local zones=$(zones_get "$@") + local arguments=( $@ ) - local zone - for zone in ${zones}; do - zone_status ${zone} + # Show all zones when no arguments are given + if ! isset arguments; then + local zone + for zone in $(zones_get_all); do + zone_status "${zone}" + done + + return ${EXIT_OK} + fi + + local arg + for arg in ${arguments[@]}; do + # Is this a zone? + if zone_exists "${arg}"; then + zone_status "${arg}" + + # Is this a port? + elif port_exists "${arg}"; then + port_status "${arg}" + + # Is this a PHY? + elif phy_exists "${arg}"; then + cli_device_status "${arg}" + + # Is this a device? + elif device_exists "${arg}"; then + cli_device_status "${arg}" + + # Unknown argument + else + error "Unknown argument: ${arg}" + fi done # Reset logging.