Skip to content

Add limactl list --filter option #4007

@jandubois

Description

@jandubois

After implementing the --yq option I found that I would like to have a --filter EXPR option, that would be equivalent to --yq 'select(EXPR)'.

This alone doesn't seem worthwhile, but I would want --filter to also work with --format table and --format '{{GO-TMPL}}'.

So you could do something like this:

limactl ls --filter '.status == "Running"'
NAME       STATUS     SSH                VMTYPE    ARCH       CPUS    MEMORY    DISK      DIR
docker     Running    127.0.0.1:60763    vz        aarch64    4       4GiB      100GiB    ~/.lima/docker
qemu       Running    127.0.0.1:63754    qemu      aarch64    4       4GiB      100GiB    ~/.lima/qemu

The --filter option can be specified multiple times, so you could have a limactl-ps plugin that runs the command above (with "$@"), and then use it like this:

limactl ps -f '.config.vmType == "vz"'
NAME       STATUS     SSH                VMTYPE    ARCH       CPUS    MEMORY    DISK      DIR
docker     Running    127.0.0.1:60763    vz        aarch64    4       4GiB      100GiB    ~/.lima/docker

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions