Repository navigation
history: add filters to ls - #3091
Conversation
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
| |:----------------|:--------------|:--------|:---------------------------------------------| | ||
| | `--builder` | `string` | | Override the configured builder instance | | ||
| | `-D`, `--debug` | `bool` | | Enable debug logging | | ||
| | `--filter` | `stringArray` | | Provide filter values (e.g., `status=error`) | |
There was a problem hiding this comment.
As follow-up we should document the available filters with some examples similar to https://docs.docker.com/reference/cli/docker/container/ls/#filter
There was a problem hiding this comment.
Ah found pr description we could grab in the docs: moby/buildkit#5705 (comment)
There was a problem hiding this comment.
Note that separators are different. BuildKit uses containerd style while buildx uses docker style.
| if key == "status" { | ||
| return recValue == value | ||
| } | ||
| return strings.Contains(recValue, value) |
There was a problem hiding this comment.
I'm surprised we don't have an operator for "contains" with docker filters like ~ and does not contain with !~ (cc @thaJeztah).
| if key == "status" { | ||
| sep = "==" | ||
| } else { | ||
| sep = "~=" |
There was a problem hiding this comment.
Ah ok I see we set it here after valueFiler matching moby/buildkit#5705 (comment)
|
@crazy-max Would it make sense to add |
Hum indeed I wonder if this should be a global one then: Edit:
Nevermind a global one would not make sense for some subcommands like |
Why not? It wouldn't make sense for |
Adds
--filterand--localtohistory ls. Filters are "docker-style" with=and!=separators and less-than and greater-than for time fields.