diff options
Diffstat (limited to '')
-rwxr-xr-x | lib/container/list | 54 |
1 files changed, 48 insertions, 6 deletions
diff --git a/lib/container/list b/lib/container/list index 5ab5755..8b55e09 100755 --- a/lib/container/list +++ b/lib/container/list @@ -94,7 +94,7 @@ case "${FORMAT}" in NORMAL="$(tput sgr0)" cat << EOF -Container IPv4 Address Status +Container IPv4 Address(es) Status -------------------------------------------------------------------------------- EOF @@ -118,9 +118,9 @@ do if [ -e "${MACHINES}/${CONTAINER}/etc/network/interfaces" ] then - ADDRESS="$(awk '/address/ { print $2 }' ${MACHINES}/${CONTAINER}/etc/network/interfaces)" + ADDRESSES="$(awk '/address/ { print $2 }' ${MACHINES}/${CONTAINER}/etc/network/interfaces)" else - ADDRESS="n/a" + ADDRESSES="n/a" fi case "${STATE}" in @@ -142,7 +142,21 @@ do ;; full) - printf "%-72s %-29s %-7s\n" "${BLUE}${CONTAINER}${NORMAL}" "${YELLOW}${ADDRESS}${NORMAL}" "${STATUS}" + FIRST_LINE="true" + + for ADDRESS in ${ADDRESSES} + do + case "${FIRST_LINE}" in + true) + FIRST_LINE="false" + printf "%-69s %-29s %-7s\n" "${BLUE}${CONTAINER}${NORMAL}" "${YELLOW}${ADDRESS}${NORMAL}" " ${STATUS}" + ;; + + *) + printf "%-54s %-29s\n" "" "${ADDRESS}" + ;; + esac + done ;; esac ;; @@ -156,7 +170,21 @@ do ;; full) - printf "%-72s %-29s %-7s\n" "${BLUE}${CONTAINER}${NORMAL}" "${YELLOW}${ADDRESS}${NORMAL}" "${STATUS}" + FIRST_LINE="true" + + for ADDRESS in ${ADDRESSES} + do + case "${FIRST_LINE}" in + true) + FIRST_LINE="false" + printf "%-69s %-29s %-7s\n" "${BLUE}${CONTAINER}${NORMAL}" "${YELLOW}${ADDRESS}${NORMAL}" " ${STATUS}" + ;; + + *) + printf "%-54s %-29s\n" "" "${ADDRESS}" + ;; + esac + done ;; esac ;; @@ -175,7 +203,21 @@ do ;; full) - printf "%-72s %-29s %-7s\n" "${BLUE}${CONTAINER}${NORMAL}" "${YELLOW}${ADDRESS}${NORMAL}" "${STATUS}" + FIRST_LINE="true" + + for ADDRESS in ${ADDRESSES} + do + case "${FIRST_LINE}" in + true) + FIRST_LINE="false" + printf "%-69s %-29s %-7s\n" "${BLUE}${CONTAINER}${NORMAL}" "${YELLOW}${ADDRESS}${NORMAL}" " ${STATUS}" + ;; + + *) + printf "%-54s %-29s\n" "" "${ADDRESS}" + ;; + esac + done ;; esac ;; |