feat(instances): allow disabling prefixes in aliases and TUI
Test / test (push) Successful in 3m19s
Release / release (push) Successful in 8m31s

This commit is contained in:
Sebastian Unterschütz committed 2026-11-16 22:13:05 +01:00
1 parent 1f46d9d9e5
commit 20d7a40543
12 files changed
+298 -19

No files matched your search

+14
View File
@@ -65,3 +65,17 @@ func (c *Config) CachePath() string {
sum := sha256.Sum256([]byte(strings.Join(identities, "\x00")))
return filepath.Join(filepath.Dir(c.Cache.Path), fmt.Sprintf("instances-%x", sum[:8]), filepath.Base(c.Cache.Path))
}
// HostLabel omits the configured instance prefix for display only. Callers
// must retain the canonical target for connections and handle label collisions.
func (c *Config) HostLabel(target string) string {
source, host, qualified := strings.Cut(target, "/")
if qualified {
for _, instance := range c.NetBoxes {
if instance.DisablePrefix && strings.EqualFold(instance.Name, source) {
return host
}
}
}
return target
}