mirror of
https://github.com/psviderski/uncloud.git
synced 2026-10-07 21:59:15 +00:00
chore: add filter to ListMachines
This commit is contained in:
1 parent
2f5a2c6344
commit
87331a9265
19 files changed
+129
-76
No files matched your search
@@ -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,
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user