mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-27 19:43:34 +00:00
chore: add filter to ListMachines
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/psviderski/uncloud/internal/cli"
|
||||
"github.com/psviderski/uncloud/pkg/api"
|
||||
@@ -60,16 +59,7 @@ func remove(ctx context.Context, uncli *cli.CLI, names []string, opts removeOpti
|
||||
}
|
||||
|
||||
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.Machines = machines
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user