feat: add netssh link and shell aliases for links
netssh link add|list|remove manages links; netssh NAME follows them, links complete with Tab and get a shell alias. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
793f095e80
commit
e905a39068
5 files changed
+247
-1
No files matched your search
@@ -129,6 +129,20 @@ func BuildAliasEntries(entries []cache.Entry, cfg config.Config) []AliasEntry {
|
||||
out = append(out, AliasEntry{Name: cfg.Shell.Alias})
|
||||
}
|
||||
|
||||
// Links are names the user chose explicitly: they come before host aliases.
|
||||
validLink := regexp.MustCompile(`^[a-zA-Z_][a-zA-Z0-9_-]*$`)
|
||||
links := make([]string, 0, len(cfg.Links))
|
||||
for name := range cfg.Links {
|
||||
links = append(links, strings.ToLower(name))
|
||||
}
|
||||
sort.Strings(links)
|
||||
for _, name := range links {
|
||||
if !seen[name] && validLink.MatchString(name) {
|
||||
seen[name] = true
|
||||
out = append(out, AliasEntry{Name: name, Host: name})
|
||||
}
|
||||
}
|
||||
|
||||
withoutPrefix := make(map[string]bool, len(cfg.NetBoxes))
|
||||
for _, source := range cfg.NetBoxes {
|
||||
withoutPrefix[strings.ToLower(source.Name)] = source.DisablePrefix
|
||||
|
||||
Reference in new issue
Block a user