Skip to content

Commit

Permalink
support hiding in the host list
Browse files Browse the repository at this point in the history
HideHost
  • Loading branch information
lonnywong committed Mar 30, 2024
1 parent ff6eaf5 commit 6f11c38
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
14 changes: 7 additions & 7 deletions README.cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ trzsz-ssh ( tssh ) 设计为 ssh 客户端的直接替代品,提供与 openssh

- 如果目标机器参数是 `~/.ssh/config` 中别名的一部分,不能完全匹配某个别名,也会打开登录界面。

- 别名含有 `*``?` 通配符时,则不会显示在登录界面中,要隐藏的别名可以加个 `*` 前缀或后缀
- 如果配置了 `#!! HideHost yes`,或者别名中含有 `*``?` 通配符时,则不会显示在登录界面中。

- `tssh` 支持很多快捷键,支持搜索,在 `tmux``iTerm2``Windows Terminal` 等中使用时支持多选。

Expand Down Expand Up @@ -613,12 +613,12 @@ trzsz-ssh ( tssh ) 设计为 ssh 客户端的直接替代品,提供与 openssh
- `tssh` 配置中的注释基本与 `openssh` 一致,额外做了一些扩展支持,详见下表:
| 注释 | openssh | tssh |
| :-------------------- | :-----: | :----: |
| `#` 开头的配置行 | 是注释 | 是注释 |
| `#!!` 开头的配置行 | 是注释 | 非注释 |
| `Key Value # Comment` | 看情况 | 是注释 |
| `Key=Value # Comment` | 看情况 | 非注释 |
| 注释 | openssh | tssh |
| :-------------------- | :-----: | :----: |
| `#` 开头的配置行 | 是注释 | 是注释 |
| `#!!` 开头的配置行 | 是注释 | 非注释 |
| `Key Value # Comment` | 看情况 | 是注释 |
| `Key=Value # Comment` | 看情况 | 非注释 |

- `#` 开头的配置行,`openssh` 一律认为是注释;`tssh` 认为 `#!!` 开头的配置行不是注释,其他以 `#` 开头的配置行是注释。
- `Key Value # Comment` 配置(没有 `=` 号),`openssh` 有些情况认为 `#` 后的内容是注释,有些情况认为不是注释;`tssh` 一律认为 `#` 后的内容是注释。
Expand Down
14 changes: 7 additions & 7 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ trzsz-ssh ( tssh ) is an ssh client designed as a drop-in replacement for the op
- If the destination is part of the aliases in `~/.ssh/config`, and can't completely match an alias, the login prompt will also be opened.

- The aliases with `*` or `?` wildcard will not be displayed in the login prompt. To hide the alias, you can add a `*` prefix or suffix.
- If `#!! HideHost yes` is configured, or the alias contains `*` or `?` wildcard characters, it will not be displayed in the login prompt.

- `tssh` supports shortcuts, supports search, and supports multi-selection when used in `tmux`, `iTerm2`, and `Windows Terminal`, etc.

Expand Down Expand Up @@ -613,12 +613,12 @@ trzsz-ssh ( tssh ) is an ssh client designed as a drop-in replacement for the op
- The comments in the `tssh` configuration are basically the same as `openssh`, with some additional extended support, see the following table for details:
| Comments | openssh | tssh |
| :-------------------- | :----------: | :-----------: |
| Starting with `#` | Is a comment | Is a comment |
| Starting with `#!!` | Is a comment | Not a comment |
| `Key Value # Comment` | It depends | Is a comment |
| `Key=Value # Comment` | It depends | Not a comment |
| Comments | openssh | tssh |
| :-------------------- | :----------: | :-----------: |
| Starting with `#` | Is a comment | Is a comment |
| Starting with `#!!` | Is a comment | Not a comment |
| `Key Value # Comment` | It depends | Is a comment |
| `Key=Value # Comment` | It depends | Not a comment |
- Configuration starting with `#` are always considered by `openssh` to be a comment; `tssh` considers configuration starting with `#!!` not to be a comment, and other configurations starting with `#` are comments.
Expand Down
3 changes: 3 additions & 0 deletions tssh/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,9 @@ func appendPromptHosts(hosts []*sshHost, cfgHosts ...*ssh_config.Host) []*sshHos
}
continue
}
if strings.ToLower(getConfig(alias, "HideHost")) == "yes" {
continue
}
hosts = append(hosts, &sshHost{
Alias: alias,
Host: getConfig(alias, "HostName"),
Expand Down

0 comments on commit 6f11c38

Please sign in to comment.