mirror of https://github.com/docker/cli.git
Add "driver" filter for network ls
This add a new filter to 'docker network ls' to allow filtering by driver-name. Contrary to "ID" and "name" filters, this filter only supports an *exact* match. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
586ec24a48
commit
efff6c2b24
|
@ -1378,6 +1378,11 @@ _docker_network_inspect() {
|
|||
_docker_network_ls() {
|
||||
local key=$(__docker_map_key_of_current_option '--filter|-f')
|
||||
case "$key" in
|
||||
driver)
|
||||
local plugins=" $(__docker_plugins Network) "
|
||||
COMPREPLY=( $(compgen -W "$plugins" -- "${cur##*=}") )
|
||||
return
|
||||
;;
|
||||
id)
|
||||
cur="${cur##*=}"
|
||||
__docker_complete_network_ids
|
||||
|
@ -1396,7 +1401,7 @@ _docker_network_ls() {
|
|||
|
||||
case "$prev" in
|
||||
--filter|-f)
|
||||
COMPREPLY=( $( compgen -S = -W "id name type" -- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -S = -W "driver id label name type" -- "$cur" ) )
|
||||
__docker_nospace
|
||||
return
|
||||
;;
|
||||
|
|
|
@ -51,11 +51,25 @@ Multiple filter flags are combined as an `OR` filter. For example,
|
|||
|
||||
The currently supported filters are:
|
||||
|
||||
* driver
|
||||
* id (network's id)
|
||||
* label (`label=<key>` or `label=<key>=<value>`)
|
||||
* name (network's name)
|
||||
* type (custom|builtin)
|
||||
|
||||
#### Driver
|
||||
|
||||
The `driver` filter matches networks based on their driver.
|
||||
|
||||
The following example matches networks with the `bridge` driver:
|
||||
|
||||
```bash
|
||||
$ docker network ls --filter driver=bridge
|
||||
NETWORK ID NAME DRIVER
|
||||
db9db329f835 test1 bridge
|
||||
f6e212da9dfd test2 bridge
|
||||
```
|
||||
|
||||
#### ID
|
||||
|
||||
The `id` filter matches on all or part of a network's ID.
|
||||
|
@ -83,7 +97,7 @@ NETWORK ID NAME DRIVER
|
|||
|
||||
#### Label
|
||||
|
||||
The `label` filter matches containers based on the presence of a `label` alone or a `label` and a
|
||||
The `label` filter matches networks based on the presence of a `label` alone or a `label` and a
|
||||
value.
|
||||
|
||||
The following filter matches networks with the `usage` label regardless of its value.
|
||||
|
@ -95,7 +109,7 @@ db9db329f835 test1 bridge
|
|||
f6e212da9dfd test2 bridge
|
||||
```
|
||||
|
||||
The following filter matches containers with the `usage` label with the `prod` value.
|
||||
The following filter matches networks with the `usage` label with the `prod` value.
|
||||
|
||||
```bash
|
||||
$ docker network ls -f "label=usage=prod"
|
||||
|
|
|
@ -46,11 +46,25 @@ Multiple filter flags are combined as an `OR` filter. For example,
|
|||
|
||||
The currently supported filters are:
|
||||
|
||||
* driver
|
||||
* id (network's id)
|
||||
* label (`label=<key>` or `label=<key>=<value>`)
|
||||
* name (network's name)
|
||||
* type (custom|builtin)
|
||||
|
||||
#### Driver
|
||||
|
||||
The `driver` filter matches networks based on their driver.
|
||||
|
||||
The following example matches networks with the `bridge` driver:
|
||||
|
||||
```bash
|
||||
$ docker network ls --filter driver=bridge
|
||||
NETWORK ID NAME DRIVER
|
||||
db9db329f835 test1 bridge
|
||||
f6e212da9dfd test2 bridge
|
||||
```
|
||||
|
||||
#### ID
|
||||
|
||||
The `id` filter matches on all or part of a network's ID.
|
||||
|
@ -78,7 +92,7 @@ NETWORK ID NAME DRIVER
|
|||
|
||||
#### Label
|
||||
|
||||
The `label` filter matches containers based on the presence of a `label` alone or a `label` and a
|
||||
The `label` filter matches networks based on the presence of a `label` alone or a `label` and a
|
||||
value.
|
||||
|
||||
The following filter matches networks with the `usage` label regardless of its value.
|
||||
|
@ -90,7 +104,7 @@ db9db329f835 test1 bridge
|
|||
f6e212da9dfd test2 bridge
|
||||
```
|
||||
|
||||
The following filter matches containers with the `usage` label with the `prod` value.
|
||||
The following filter matches networks with the `usage` label with the `prod` value.
|
||||
|
||||
```bash
|
||||
$ docker network ls -f "label=usage=prod"
|
||||
|
|
Loading…
Reference in New Issue