lima-vm / lima-vm/lima

Add `limactl list --filter` option

Open
#4,007 4 comments 0 reactions 1 assignee Claimed by @olamilekan000 View on GitHub
Dominant language
Go
Stars
21.9k
Forks
957
Avg merge
2d 6h
Merged PRs (30d)
53

Description

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:

```console
❯ 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:

```console
❯ 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
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.