Merge pull request #6559 from thaJeztah/fix_filteropts_default
opts: FilterOpt: show empty string if no values are set
This commit is contained in:
@ -8,7 +8,7 @@ Remove build cache
|
||||
| Name | Type | Default | Description |
|
||||
|:-----------------|:---------|:--------|:------------------------------------------------------|
|
||||
| `-a`, `--all` | `bool` | | Remove all unused build cache, not just dangling ones |
|
||||
| `--filter` | `filter` | `{}` | Provide filter values (e.g. `until=24h`) |
|
||||
| `--filter` | `filter` | | Provide filter values (e.g. `until=24h`) |
|
||||
| `-f`, `--force` | `bool` | | Do not prompt for confirmation |
|
||||
| `--keep-storage` | `bytes` | `0` | Amount of disk space to keep for cache |
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ List configs
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|:---------------------------------------|:---------|:--------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | `{}` | Filter output based on conditions provided |
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | | Filter output based on conditions provided |
|
||||
| [`--format`](#format) | `string` | | Format output using a custom template:<br>'table': Print output in table format with column headers (default)<br>'table TEMPLATE': Print output in table format using the given Go template<br>'json': Print in JSON format<br>'TEMPLATE': Print output using the given Go template.<br>Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates |
|
||||
| `-q`, `--quiet` | `bool` | | Only display IDs |
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ List containers
|
||||
| Name | Type | Default | Description |
|
||||
|:---------------------------------------|:---------|:--------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| [`-a`](#all), [`--all`](#all) | `bool` | | Show all containers (default shows just running) |
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | `{}` | Filter output based on conditions provided |
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | | Filter output based on conditions provided |
|
||||
| [`--format`](#format) | `string` | | Format output using a custom template:<br>'table': Print output in table format with column headers (default)<br>'table TEMPLATE': Print output in table format using the given Go template<br>'json': Print in JSON format<br>'TEMPLATE': Print output using the given Go template.<br>Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates |
|
||||
| `-n`, `--last` | `int` | `-1` | Show n last created containers (includes all states) |
|
||||
| `-l`, `--latest` | `bool` | | Show the latest created container (includes all states) |
|
||||
|
||||
@ -7,7 +7,7 @@ Remove all stopped containers
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|:----------------------|:---------|:--------|:-------------------------------------------------|
|
||||
| [`--filter`](#filter) | `filter` | `{}` | Provide filter values (e.g. `until=<timestamp>`) |
|
||||
| [`--filter`](#filter) | `filter` | | Provide filter values (e.g. `until=<timestamp>`) |
|
||||
| `-f`, `--force` | `bool` | | Do not prompt for confirmation |
|
||||
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ Get real time events from the server
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|:-----------------|:---------|:--------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `-f`, `--filter` | `filter` | `{}` | Filter output based on conditions provided |
|
||||
| `-f`, `--filter` | `filter` | | Filter output based on conditions provided |
|
||||
| `--format` | `string` | | Format output using a custom template:<br>'json': Print in JSON format<br>'TEMPLATE': Print output using the given Go template.<br>Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates |
|
||||
| `--since` | `string` | | Show all events created since timestamp |
|
||||
| `--until` | `string` | | Stream events until this timestamp |
|
||||
|
||||
@ -13,7 +13,7 @@ List images
|
||||
|:---------------------------------------|:---------|:--------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `-a`, `--all` | `bool` | | Show all images (default hides intermediate images) |
|
||||
| [`--digests`](#digests) | `bool` | | Show digests |
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | `{}` | Filter output based on conditions provided |
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | | Filter output based on conditions provided |
|
||||
| [`--format`](#format) | `string` | | Format output using a custom template:<br>'table': Print output in table format with column headers (default)<br>'table TEMPLATE': Print output in table format using the given Go template<br>'json': Print in JSON format<br>'TEMPLATE': Print output using the given Go template.<br>Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates |
|
||||
| [`--no-trunc`](#no-trunc) | `bool` | | Don't truncate output |
|
||||
| `-q`, `--quiet` | `bool` | | Only show image IDs |
|
||||
|
||||
@ -8,7 +8,7 @@ Remove unused images
|
||||
| Name | Type | Default | Description |
|
||||
|:----------------------|:---------|:--------|:-------------------------------------------------|
|
||||
| `-a`, `--all` | `bool` | | Remove all unused images, not just dangling ones |
|
||||
| [`--filter`](#filter) | `filter` | `{}` | Provide filter values (e.g. `until=<timestamp>`) |
|
||||
| [`--filter`](#filter) | `filter` | | Provide filter values (e.g. `until=<timestamp>`) |
|
||||
| `-f`, `--force` | `bool` | | Do not prompt for confirmation |
|
||||
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ List images
|
||||
|:-----------------|:---------|:--------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `-a`, `--all` | `bool` | | Show all images (default hides intermediate images) |
|
||||
| `--digests` | `bool` | | Show digests |
|
||||
| `-f`, `--filter` | `filter` | `{}` | Filter output based on conditions provided |
|
||||
| `-f`, `--filter` | `filter` | | Filter output based on conditions provided |
|
||||
| `--format` | `string` | | Format output using a custom template:<br>'table': Print output in table format with column headers (default)<br>'table TEMPLATE': Print output in table format using the given Go template<br>'json': Print in JSON format<br>'TEMPLATE': Print output using the given Go template.<br>Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates |
|
||||
| `--no-trunc` | `bool` | | Don't truncate output |
|
||||
| `-q`, `--quiet` | `bool` | | Only show image IDs |
|
||||
|
||||
@ -11,7 +11,7 @@ List networks
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|:---------------------------------------|:---------|:--------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | `{}` | Provide filter values (e.g. `driver=bridge`) |
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | | Provide filter values (e.g. `driver=bridge`) |
|
||||
| [`--format`](#format) | `string` | | Format output using a custom template:<br>'table': Print output in table format with column headers (default)<br>'table TEMPLATE': Print output in table format using the given Go template<br>'json': Print in JSON format<br>'TEMPLATE': Print output using the given Go template.<br>Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates |
|
||||
| [`--no-trunc`](#no-trunc) | `bool` | | Do not truncate the output |
|
||||
| `-q`, `--quiet` | `bool` | | Only display network IDs |
|
||||
|
||||
@ -7,7 +7,7 @@ Remove all unused networks
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|:----------------------|:---------|:--------|:-------------------------------------------------|
|
||||
| [`--filter`](#filter) | `filter` | `{}` | Provide filter values (e.g. `until=<timestamp>`) |
|
||||
| [`--filter`](#filter) | `filter` | | Provide filter values (e.g. `until=<timestamp>`) |
|
||||
| `-f`, `--force` | `bool` | | Do not prompt for confirmation |
|
||||
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ List nodes in the swarm
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|:---------------------------------------|:---------|:--------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | `{}` | Filter output based on conditions provided |
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | | Filter output based on conditions provided |
|
||||
| [`--format`](#format) | `string` | | Format output using a custom template:<br>'table': Print output in table format with column headers (default)<br>'table TEMPLATE': Print output in table format using the given Go template<br>'json': Print in JSON format<br>'TEMPLATE': Print output using the given Go template.<br>Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates |
|
||||
| `-q`, `--quiet` | `bool` | | Only display IDs |
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ List tasks running on one or more nodes, defaults to current node
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|:---------------------------------------|:---------|:--------|:-------------------------------------------|
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | `{}` | Filter output based on conditions provided |
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | | Filter output based on conditions provided |
|
||||
| [`--format`](#format) | `string` | | Pretty-print tasks using a Go template |
|
||||
| `--no-resolve` | `bool` | | Do not map IDs to Names |
|
||||
| `--no-trunc` | `bool` | | Do not truncate output |
|
||||
|
||||
@ -11,7 +11,7 @@ List plugins
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|:---------------------------------------|:---------|:--------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | `{}` | Provide filter values (e.g. `enabled=true`) |
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | | Provide filter values (e.g. `enabled=true`) |
|
||||
| [`--format`](#format) | `string` | | Format output using a custom template:<br>'table': Print output in table format with column headers (default)<br>'table TEMPLATE': Print output in table format using the given Go template<br>'json': Print in JSON format<br>'TEMPLATE': Print output using the given Go template.<br>Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates |
|
||||
| `--no-trunc` | `bool` | | Don't truncate output |
|
||||
| `-q`, `--quiet` | `bool` | | Only display plugin IDs |
|
||||
|
||||
@ -12,7 +12,7 @@ List containers
|
||||
| Name | Type | Default | Description |
|
||||
|:-----------------|:---------|:--------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `-a`, `--all` | `bool` | | Show all containers (default shows just running) |
|
||||
| `-f`, `--filter` | `filter` | `{}` | Filter output based on conditions provided |
|
||||
| `-f`, `--filter` | `filter` | | Filter output based on conditions provided |
|
||||
| `--format` | `string` | | Format output using a custom template:<br>'table': Print output in table format with column headers (default)<br>'table TEMPLATE': Print output in table format using the given Go template<br>'json': Print in JSON format<br>'TEMPLATE': Print output using the given Go template.<br>Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates |
|
||||
| `-n`, `--last` | `int` | `-1` | Show n last created containers (includes all states) |
|
||||
| `-l`, `--latest` | `bool` | | Show the latest created container (includes all states) |
|
||||
|
||||
@ -7,7 +7,7 @@ Search Docker Hub for images
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|:---------------------------------------|:---------|:--------|:-------------------------------------------|
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | `{}` | Filter output based on conditions provided |
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | | Filter output based on conditions provided |
|
||||
| [`--format`](#format) | `string` | | Pretty-print search using a Go template |
|
||||
| [`--limit`](#limit) | `int` | `0` | Max number of search results |
|
||||
| [`--no-trunc`](#no-trunc) | `bool` | | Don't truncate output |
|
||||
|
||||
@ -11,7 +11,7 @@ List secrets
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|:---------------------------------------|:---------|:--------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | `{}` | Filter output based on conditions provided |
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | | Filter output based on conditions provided |
|
||||
| [`--format`](#format) | `string` | | Format output using a custom template:<br>'table': Print output in table format with column headers (default)<br>'table TEMPLATE': Print output in table format using the given Go template<br>'json': Print in JSON format<br>'TEMPLATE': Print output using the given Go template.<br>Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates |
|
||||
| `-q`, `--quiet` | `bool` | | Only display IDs |
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ List services
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|:---------------------------------------|:---------|:--------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | `{}` | Filter output based on conditions provided |
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | | Filter output based on conditions provided |
|
||||
| [`--format`](#format) | `string` | | Format output using a custom template:<br>'table': Print output in table format with column headers (default)<br>'table TEMPLATE': Print output in table format using the given Go template<br>'json': Print in JSON format<br>'TEMPLATE': Print output using the given Go template.<br>Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates |
|
||||
| `-q`, `--quiet` | `bool` | | Only display IDs |
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ List the tasks of one or more services
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|:---------------------------------------|:---------|:--------|:-------------------------------------------|
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | `{}` | Filter output based on conditions provided |
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | | Filter output based on conditions provided |
|
||||
| [`--format`](#format) | `string` | | Pretty-print tasks using a Go template |
|
||||
| `--no-resolve` | `bool` | | Do not map IDs to Names |
|
||||
| `--no-trunc` | `bool` | | Do not truncate output |
|
||||
|
||||
@ -7,7 +7,7 @@ List the tasks in the stack
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|:---------------------------------------|:---------|:--------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | `{}` | Filter output based on conditions provided |
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | | Filter output based on conditions provided |
|
||||
| [`--format`](#format) | `string` | | Format output using a custom template:<br>'table': Print output in table format with column headers (default)<br>'table TEMPLATE': Print output in table format using the given Go template<br>'json': Print in JSON format<br>'TEMPLATE': Print output using the given Go template.<br>Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates |
|
||||
| [`--no-resolve`](#no-resolve) | `bool` | | Do not map IDs to Names |
|
||||
| [`--no-trunc`](#no-trunc) | `bool` | | Do not truncate output |
|
||||
|
||||
@ -7,7 +7,7 @@ List the services in the stack
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|:---------------------------------------|:---------|:--------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | `{}` | Filter output based on conditions provided |
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | | Filter output based on conditions provided |
|
||||
| [`--format`](#format) | `string` | | Format output using a custom template:<br>'table': Print output in table format with column headers (default)<br>'table TEMPLATE': Print output in table format using the given Go template<br>'json': Print in JSON format<br>'TEMPLATE': Print output using the given Go template.<br>Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates |
|
||||
| `-q`, `--quiet` | `bool` | | Only display IDs |
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ Get real time events from the server
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|:---------------------------------------|:---------|:--------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | `{}` | Filter output based on conditions provided |
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | | Filter output based on conditions provided |
|
||||
| [`--format`](#format) | `string` | | Format output using a custom template:<br>'json': Print in JSON format<br>'TEMPLATE': Print output using the given Go template.<br>Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates |
|
||||
| [`--since`](#since) | `string` | | Show all events created since timestamp |
|
||||
| `--until` | `string` | | Stream events until this timestamp |
|
||||
|
||||
@ -8,7 +8,7 @@ Remove unused data
|
||||
| Name | Type | Default | Description |
|
||||
|:----------------------|:---------|:--------|:---------------------------------------------------|
|
||||
| `-a`, `--all` | `bool` | | Remove all unused images not just dangling ones |
|
||||
| [`--filter`](#filter) | `filter` | `{}` | Provide filter values (e.g. `label=<key>=<value>`) |
|
||||
| [`--filter`](#filter) | `filter` | | Provide filter values (e.g. `label=<key>=<value>`) |
|
||||
| `-f`, `--force` | `bool` | | Do not prompt for confirmation |
|
||||
| `--volumes` | `bool` | | Prune anonymous volumes |
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ List volumes
|
||||
| Name | Type | Default | Description |
|
||||
|:---------------------------------------|:---------|:--------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `--cluster` | `bool` | | Display only cluster volumes, and use cluster volume list formatting |
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | `{}` | Provide filter values (e.g. `dangling=true`) |
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | | Provide filter values (e.g. `dangling=true`) |
|
||||
| [`--format`](#format) | `string` | | Format output using a custom template:<br>'table': Print output in table format with column headers (default)<br>'table TEMPLATE': Print output in table format using the given Go template<br>'json': Print in JSON format<br>'TEMPLATE': Print output using the given Go template.<br>Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates |
|
||||
| `-q`, `--quiet` | `bool` | | Only display volume names |
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ Remove unused local volumes
|
||||
| Name | Type | Default | Description |
|
||||
|:------------------------------|:---------|:--------|:---------------------------------------------------|
|
||||
| [`-a`](#all), [`--all`](#all) | `bool` | | Remove all unused volumes, not just anonymous ones |
|
||||
| [`--filter`](#filter) | `filter` | `{}` | Provide filter values (e.g. `label=<label>`) |
|
||||
| [`--filter`](#filter) | `filter` | | Provide filter values (e.g. `label=<label>`) |
|
||||
| `-f`, `--force` | `bool` | | Do not prompt for confirmation |
|
||||
|
||||
|
||||
|
||||
@ -291,6 +291,9 @@ func NewFilterOpt() FilterOpt {
|
||||
}
|
||||
|
||||
func (o *FilterOpt) String() string {
|
||||
if o == nil || len(o.filter) == 0 {
|
||||
return ""
|
||||
}
|
||||
repr, err := json.Marshal(o.filter)
|
||||
if err != nil {
|
||||
return "invalid filters"
|
||||
|
||||
Reference in New Issue
Block a user