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:
2026-02-25 20:27:22 +01:00
parent 838941e3eb
commit 9c639206f7
11 changed files with 90 additions and 11 deletions

View File

@@ -187,7 +187,8 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if err != nil {
return m, tea.Quit
}
m.hosts = m.sortHosts(hosts)
m.allHosts = hosts
m.hosts = m.sortHosts(m.applyVisibilityFilter(hosts))
// Reapply search filter if there is one active
if m.searchInput.Value() != "" {
@@ -231,7 +232,8 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if err != nil {
return m, tea.Quit
}
m.hosts = m.sortHosts(hosts)
m.allHosts = hosts
m.hosts = m.sortHosts(m.applyVisibilityFilter(hosts))
// Reapply search filter if there is one active
if m.searchInput.Value() != "" {
@@ -276,7 +278,8 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if err != nil {
return m, tea.Quit
}
m.hosts = m.sortHosts(hosts)
m.allHosts = hosts
m.hosts = m.sortHosts(m.applyVisibilityFilter(hosts))
// Reapply search filter if there is one active
if m.searchInput.Value() != "" {
@@ -535,7 +538,8 @@ func (m Model) handleListViewKeys(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
m.table.Focus()
return m, nil
}
m.hosts = m.sortHosts(hosts)
m.allHosts = hosts
m.hosts = m.sortHosts(m.applyVisibilityFilter(hosts))
// Reapply search filter if there is one active
if m.searchInput.Value() != "" {
@@ -705,6 +709,19 @@ func (m Model) handleListViewKeys(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
m.viewMode = ViewHelp
return m, nil
}
case "H":
if !m.searchMode && !m.deleteMode {
// Toggle visibility of hidden hosts
m.showHidden = !m.showHidden
m.hosts = m.sortHosts(m.applyVisibilityFilter(m.allHosts))
if m.searchInput.Value() != "" {
m.filteredHosts = m.filterHosts(m.searchInput.Value())
} else {
m.filteredHosts = m.hosts
}
m.updateTableRows()
return m, nil
}
case "s":
if !m.searchMode && !m.deleteMode {
// Cycle through sort modes (only 2 modes now)