Add `--limit` option to `docker search`

This fix tries to address the issue raised in #23055.
Currently `docker search` result caps at 25 and there is
no way to allow getting more results (if exist).

This fix adds the flag `--limit` so that it is possible
to return more results from the `docker search`.

Related documentation has been updated.

Additional tests have been added to cover the changes.

This fix fixes #23055.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang 2016-06-01 13:38:14 -07:00 committed by Tibor Vass
parent 1a22098ae2
commit 794db50fdf
2 changed files with 11 additions and 0 deletions

View File

@ -19,6 +19,7 @@ parent = "smn_cli"
- is-official=(true|false) - is-official=(true|false)
- stars=<number> - image has at least 'number' stars - stars=<number> - image has at least 'number' stars
--help Print usage --help Print usage
--limit=25 Maximum returned search results
--no-trunc Don't truncate output --no-trunc Don't truncate output
Search [Docker Hub](https://hub.docker.com) for images Search [Docker Hub](https://hub.docker.com) for images
@ -74,6 +75,12 @@ at least 3 stars and the description isn't truncated in the output:
progrium/busybox 50 [OK] progrium/busybox 50 [OK]
radial/busyboxplus Full-chain, Internet enabled, busybox made from scratch. Comes in git and cURL flavors. 8 [OK] radial/busyboxplus Full-chain, Internet enabled, busybox made from scratch. Comes in git and cURL flavors. 8 [OK]
## Limit search results (--limit)
The flag `--limit` is the maximium number of results returned by a search. This value could
be in the range between 1 and 100. The default value of `--limit` is 25.
## Filtering ## Filtering
The filtering flag (`-f` or `--filter`) format is a `key=value` pair. If there is more The filtering flag (`-f` or `--filter`) format is a `key=value` pair. If there is more

View File

@ -8,6 +8,7 @@ docker-search - Search the Docker Hub for images
**docker search** **docker search**
[**-f**|**--filter**[=*[]*]] [**-f**|**--filter**[=*[]*]]
[**--help**] [**--help**]
[**--limit**[=*LIMIT*]]
[**--no-trunc**] [**--no-trunc**]
TERM TERM
@ -30,6 +31,9 @@ of stars awarded, whether the image is official, and whether it is automated.
**--help** **--help**
Print usage statement Print usage statement
**--limit**=*LIMIT*
Maximum returned search results. The default is 25.
**--no-trunc**=*true*|*false* **--no-trunc**=*true*|*false*
Don't truncate output. The default is *false*. Don't truncate output. The default is *false*.