| 421 | } |
| 422 | |
| 423 | func (e *AmbiguousVMIDError) Error() string { |
| 424 | var b strings.Builder |
| 425 | |
| 426 | fmt.Fprintf(&b, "VMID %d is ambiguous — it exists in multiple profiles:\n", e.VMID) |
| 427 | |
| 428 | for _, vm := range e.Matches { |
| 429 | fmt.Fprintf(&b, " %-12s → %s (%s, %s) on %s\n", |
| 430 | vm.SourceProfile, vm.Name, vm.Type, vm.Status, vm.Node) |
| 431 | } |
| 432 | |
| 433 | fmt.Fprintf(&b, "\nRe-run with --profile to target one, e.g.:\n") |
| 434 | fmt.Fprintf(&b, " pvetui --profile %s guests show %d", e.Matches[0].SourceProfile, e.VMID) |
| 435 | |
| 436 | return b.String() |
| 437 | } |
| 438 | |
| 439 | // FindNodeByNameInGroup searches for a node with the given name across all profiles. |
| 440 | // Returns the node and its source profile name, or an error if not found. |