chore: add filter to ListMachines

This commit is contained in:
Pavel Sviderski committed 2025-04-11 21:26:40 +10:00
1 parent 2f5a2c6344
commit 87331a9265
19 files changed
+129 -76

No files matched your search

+1 -10
View File
@@ -54,16 +54,7 @@ func list(ctx context.Context, uncli *cli.CLI, opts listOptions) error {
// Apply machine filter if specified.
var filter *api.VolumeFilter
if len(opts.machines) > 0 {
// Expand comma-separated machine names.
var machines []string
for _, m := range opts.machines {
for _, nameOrID := range strings.Split(m, ",") {
if nameOrID = strings.TrimSpace(nameOrID); nameOrID != "" {
machines = append(machines, nameOrID)
}
}
}
machines := cli.ExpandCommaSeparatedValues(opts.machines)
filter = &api.VolumeFilter{
Machines: machines,
}