feat(instances): allow disabling prefixes in aliases and TUI
Release / release (push) Canceled after 0s
Release / release (push) Canceled after 0s
This commit is contained in:
1 parent
d9060a6eb7
commit
3804c33669
12 files changed
+298
-19
No files matched your search
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user