Docker Subnet & container name verbose list (Bash alias)

@night-crawler | #63 Bash | hits:max hits 0:39
# Example
# docker_networks scope=swarm
# swarm:overlay   10.10.10.10/24       build-network                    
# ------------------------------------------------------------
# swarm:overlay   10.255.0.0/16        ingress                          
# ------------------------------------------------------------
# swarm:overlay   10.0.0.0/24          nginx-network                    
# ------------------------------------------------------------
# swarm:overlay   null                 portainer_portainer-net          
# ------------------------------------------------------------
function docker_networks {
    FILTERS=
    if [ ! -z $1 ] ; then
        FILTERS="--filter $1"
    fi;

    for net in $(docker network ls --quiet $FILTERS) ; do
        network_info=$(docker network inspect $net)
        name=$(jq ".[0].Name" -r <<< "$network_info")
        scope=$(jq ".[0].Scope" -r <<< "$network_info")
        driver=$(jq ".[0].Driver" -r <<< "$network_info")
        nid=$(jq ".[0].Id" -r <<< "$network_info")
        #containers_and_ips=$(echo "$network_info" | jq '.[0].Containers[] | .Name + ":" + .IPv4Address' -r | cut -d '/' -f 1 | paste -sd ', ')
        containers_and_ips=$(echo "$network_info" | jq '.[0].Containers[]?.Name' -r | paste -sd ',')

        subnet=$(jq ".[0].IPAM.Config[0].Subnet" -r <<< "$network_info")

        printf '%-15s %-20s %-32s %s' "$scope:$driver" $subnet $name $containers_and_ips
        echo
        printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
    done;
}