diff --git a/contrib/completion/bash/docker b/contrib/completion/bash/docker index 90c21a9ad4..03c593f600 100644 --- a/contrib/completion/bash/docker +++ b/contrib/completion/bash/docker @@ -1133,9 +1133,15 @@ _docker_network_disconnect() { } _docker_network_inspect() { + case "$prev" in + --format|-f) + return + ;; + esac + case "$cur" in -*) - COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "--format -f --help" -- "$cur" ) ) ;; *) __docker_networks diff --git a/contrib/completion/zsh/_docker b/contrib/completion/zsh/_docker index 4212d8172c..b5be7cff39 100644 --- a/contrib/completion/zsh/_docker +++ b/contrib/completion/zsh/_docker @@ -309,9 +309,10 @@ __docker_network_subcommand() { "($help)*"{-o=,--opt=}"[Set driver specific options]:key=value: " \ "($help -)1:Network Name: " && ret=0 ;; - (inspect|rm) + (inspect) _arguments $(__docker_arguments) \ $opts_help \ + "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \ "($help -)*:network:__docker_networks" && ret=0 ;; (ls) @@ -320,6 +321,11 @@ __docker_network_subcommand() { "($help)--no-trunc[Do not truncate the output]" \ "($help -q --quiet)"{-q,--quiet}"[Only display numeric IDs]" && ret=0 ;; + (rm) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -)*:network:__docker_networks" && ret=0 + ;; (help) _arguments $(__docker_arguments) ":subcommand:__docker_network_commands" && ret=0 ;; diff --git a/docs/reference/commandline/network_inspect.md b/docs/reference/commandline/network_inspect.md index e458ffff8e..0f6342f514 100644 --- a/docs/reference/commandline/network_inspect.md +++ b/docs/reference/commandline/network_inspect.md @@ -14,6 +14,7 @@ parent = "smn_cli" Displays detailed information on a network + -f, --format= Format the output using the given go template. --help=false Print usage Returns information about one or more networks. By default, this command renders all results in a JSON object. For example, if you connect two containers to a network: @@ -26,7 +27,11 @@ $ sudo docker run -itd --name=container2 busybox bda12f8922785d1f160be70736f26c1e331ab8aaf8ed8d56728508f2e2fd4727 ``` -The `network inspect` command shows the containers, by id, in its results. +The `network inspect` command shows the containers, by id, in its +results. You can specify an alternate format to execute a given +template for each result. Go's +[text/template](http://golang.org/pkg/text/template/) package describes all the +details of the format. ```bash $ sudo docker network inspect bridge diff --git a/man/docker-network-inspect.1.md b/man/docker-network-inspect.1.md index 90bd808ad6..889967ae85 100644 --- a/man/docker-network-inspect.1.md +++ b/man/docker-network-inspect.1.md @@ -6,6 +6,7 @@ docker-network-inspect - inspect a network # SYNOPSIS **docker network inspect** +[**-f**|**--format**[=*FORMAT*]] [**--help**] NETWORK [NETWORK...] @@ -21,7 +22,11 @@ $ sudo docker run -itd --name=container2 busybox bda12f8922785d1f160be70736f26c1e331ab8aaf8ed8d56728508f2e2fd4727 ``` -The `network inspect` command shows the containers, by id, in its results. +The `network inspect` command shows the containers, by id, in its +results. You can specify an alternate format to execute a given +template for each result. Go's +[text/template](http://golang.org/pkg/text/template/) package +describes all the details of the format. ```bash $ sudo docker network inspect bridge @@ -69,6 +74,8 @@ $ sudo docker network inspect bridge ``` # OPTIONS +**-f**, **--format**="" + Format the output using the given go template. **--help** Print usage statement