ipadm: translate to English, fix help alignment

- All ipadm-internal messages (usage, prompts, errors) are now English
- Usage text is built programmatically from a (left, desc) row list with
  computed column width instead of hand-aligned spaces, so it can't drift
  out of alignment again when rows are added/changed
- README's literal usage block updated to match; rest of the repo docs
  stay German
This commit is contained in:
2026-08-18 11:49:47 +02:00
parent 8591223aca
commit 1a39f54858
9 changed files with 137 additions and 99 deletions
+9 -9
View File
@@ -37,16 +37,16 @@ func interactiveEdit(hosts []Host, name string, cfg netConfig) ([]Host, error) {
var cur Host
if idx >= 0 {
cur = hosts[idx]
fmt.Printf("Bearbeite bestehenden Host %q (Enter = Wert behalten)\n", name)
fmt.Printf("Editing existing host %q (press enter to keep a value)\n", name)
} else {
cur = Host{Name: name}
fmt.Printf("Neuer Host %q (Enter bei MAC/Comment = leer lassen)\n", name)
fmt.Printf("New host %q (press enter to leave MAC/comment empty)\n", name)
}
for {
ip := prompt("IP-Adresse", cur.IP)
ip := prompt("IP address", cur.IP)
if err := validateIP(ip, cfg.lanCIDR, cfg.poolStart, cfg.poolEnd); err != nil {
fmt.Fprintln(os.Stderr, "Fehler:", err)
fmt.Fprintln(os.Stderr, "error:", err)
continue
}
cur.IP = ip
@@ -54,26 +54,26 @@ func interactiveEdit(hosts []Host, name string, cfg netConfig) ([]Host, error) {
}
for {
mac := prompt("MAC-Adresse (optional, '-' zum Löschen)", macOrDash(cur.MAC))
mac := prompt("MAC address (optional, '-' to clear)", macOrDash(cur.MAC))
if mac == "-" {
mac = ""
}
norm, err := normalizeMAC(mac)
if err != nil {
fmt.Fprintln(os.Stderr, "Fehler:", err)
fmt.Fprintln(os.Stderr, "error:", err)
continue
}
cur.MAC = norm
break
}
cur.Comment = prompt("Kommentar", cur.Comment)
cur.Comment = prompt("Comment", cur.Comment)
if other := findByIP(hosts, cur.IP, idx); other >= 0 {
return nil, fmt.Errorf("IP %s ist bereits Host %q zugewiesen", cur.IP, hosts[other].Name)
return nil, fmt.Errorf("IP %s is already assigned to host %q", cur.IP, hosts[other].Name)
}
if other := findByMAC(hosts, cur.MAC, idx); other >= 0 {
return nil, fmt.Errorf("MAC %s ist bereits Host %q zugewiesen", cur.MAC, hosts[other].Name)
return nil, fmt.Errorf("MAC %s is already assigned to host %q", cur.MAC, hosts[other].Name)
}
if idx >= 0 {