mirror of
https://github.com/Gu1llaum-3/sshm.git
synced 2026-03-14 03:41:27 +01:00
feat: add hidden tag to hide hosts from TUI and search
Hosts tagged with "hidden" are excluded from the TUI list, shell completions, and sshm search. Direct connections via sshm <host> still work regardless of the tag. A toggle key (H) shows or hides hidden hosts in the TUI, with a yellow banner indicating the active state. The key is documented in the help panel (h). A contextual hint on the Tags field in the add and edit forms reminds the user that "hidden" hides the host from the list.
This commit is contained in:
@@ -1624,6 +1624,27 @@ func GetAllConfigFiles() ([]string, error) {
|
||||
return files, nil
|
||||
}
|
||||
|
||||
// FilterVisibleHosts returns only hosts that do not have the "hidden" tag.
|
||||
func FilterVisibleHosts(hosts []SSHHost) []SSHHost {
|
||||
var visible []SSHHost
|
||||
for _, h := range hosts {
|
||||
if !hostHasTag(h.Tags, "hidden") {
|
||||
visible = append(visible, h)
|
||||
}
|
||||
}
|
||||
return visible
|
||||
}
|
||||
|
||||
// hostHasTag reports whether the given tag list contains the target tag (case-insensitive).
|
||||
func hostHasTag(tags []string, target string) bool {
|
||||
for _, t := range tags {
|
||||
if strings.EqualFold(t, target) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// GetAllConfigFilesFromBase returns all SSH config files starting from a specific base config file
|
||||
func GetAllConfigFilesFromBase(baseConfigPath string) ([]string, error) {
|
||||
if baseConfigPath == "" {
|
||||
|
||||
Reference in New Issue
Block a user