Add "driver" filter for network ls #22319

Merged
merged 1 commit into from Apr 30, 2016

Projects

None yet

8 participants

@thaJeztah
Member

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.

fixes #22315

@WeiZhang555
Contributor

👍
Need rebase 😄

@wenchma wenchma and 1 other commented on an outdated diff Apr 27, 2016
docs/reference/commandline/network_ls.md
* 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
@wenchma
wenchma Apr 27, 2016 Contributor

-f or --filter should be used instead.

@thaJeztah
thaJeztah Apr 27, 2016 Member

oh! thanks for catching that; I'll update when I'm at my computer (public holiday today in the Netherlands)

@vdemeester
Member

Design LGTM too 👼

@thaJeztah thaJeztah commented on the diff Apr 27, 2016
contrib/completion/bash/docker
@@ -1396,7 +1396,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" ) )
@thaJeztah
thaJeztah Apr 27, 2016 Member

ping @albers I think this is where it needs to be added for bash completion

also @sdurrheimer I couldn't find the --f / --filter option for zsh-completion. I think it may need to be added here; https://github.com/docker/docker/blob/master/contrib/completion/zsh/_docker#L422-L426

@albers
albers Apr 27, 2016 Contributor

@thaJeztah Hey, that's cool. Your're diving into the completions.
The completion is correct.
You could also add the secondary completion to https://github.com/docker/docker/blob/master/contrib/completion/bash/docker#L1380-1395, see https://github.com/docker/docker/blob/master/contrib/completion/bash/docker#L1327 for how to get the possible values.
Or just give me a ping if I should add this later.

@thaJeztah
Member

Rebased, fixed docs, and attempted to update bash completion :-)

@thaJeztah thaJeztah 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>
23e418b
@thaJeztah
Member

updated the bash completion; @albers ptal (and thanks!)

@sdurrheimer
Contributor

I will work on zsh completion as soon as possible.

@thaJeztah
Member

Thanks @sdurrheimer!

@albers
Contributor
albers commented Apr 29, 2016

bash completion LGTM, good work!

@calavera
Contributor

LGTM

@vdemeester
Member

LGTM

@vdemeester
Member

Docs too 😉

@vdemeester vdemeester merged commit 7a56581 into docker:master Apr 30, 2016

8 checks passed

docker/dco-signed All commits signed
Details
documentation success
Details
experimental Jenkins build Docker-PRs-experimental 18139 has succeeded
Details
gccgo Jenkins build Docker-PRs-gccgo 4970 has succeeded
Details
janky Jenkins build Docker-PRs 26970 has succeeded
Details
userns Jenkins build Docker-PRs-userns 9166 has succeeded
Details
win2lin Jenkins build Docker-PRs-Win2Lin 25453 has succeeded
Details
windowsTP5 Jenkins build Docker-PRs-WoW-TP5 1228 has succeeded
Details
@thaJeztah thaJeztah added this to the 1.12.0 milestone Apr 30, 2016
@thaJeztah thaJeztah deleted the thaJeztah:network-driver-filter branch Apr 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment