MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / uniqueSortedVMNodes

Function uniqueSortedVMNodes

internal/ui/components/search.go:241–261  ·  view source on GitHub ↗
(vms []*api.VM)

Source from the content-addressed store, hash-verified

239}
240
241func uniqueSortedVMNodes(vms []*api.VM) []string {
242 set := map[string]struct{}{}
243 for _, vm := range vms {
244 if vm == nil {
245 continue
246 }
247 node := strings.TrimSpace(vm.Node)
248 if node == "" {
249 continue
250 }
251 set[node] = struct{}{}
252 }
253
254 out := make([]string, 0, len(set))
255 for node := range set {
256 out = append(out, node)
257 }
258 sort.Strings(out)
259
260 return out
261}
262
263func indexOfOption(options []string, target string) int {
264 for i, option := range options {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected