From a6c64a61aefa33c74d5ec7bdd6b211ec2713ce81 Mon Sep 17 00:00:00 2001 From: Lonny Wong Date: Sat, 16 Mar 2024 11:33:17 +0800 Subject: [PATCH] ssh_config "=" means no comment at the end of the line #92 Co-authored-by: warjiang <1096409085@qq.com> --- README.cn.md | 15 +++++++++++++++ README.en.md | 17 +++++++++++++++++ README.md | 1 + go.mod | 2 +- go.sum | 4 ++-- 5 files changed, 36 insertions(+), 3 deletions(-) diff --git a/README.cn.md b/README.cn.md index 88d6fc9..863ffed 100644 --- a/README.cn.md +++ b/README.cn.md @@ -609,6 +609,21 @@ trzsz-ssh ( tssh ) 设计为 ssh 客户端的直接替代品,提供与 openssh SetTerminalTitle = Yes ``` +## 配置注释 + +- `tssh` 配置中的注释基本与 `openssh` 一致,额外做了一些扩展支持,详见下表: + +| 注释 | openssh | tssh | +| :-------------------- | :-----: | :----: | +| `#` 开头的配置行 | 是注释 | 是注释 | +| `#!!` 开头的配置行 | 是注释 | 非注释 | +| `Key Value # Comment` | 看情况 | 是注释 | +| `Key=Value # Comment` | 看情况 | 非注释 | + +- `#` 开头的配置行,`openssh` 一律认为是注释;`tssh` 认为 `#!!` 开头的配置行不是注释,其他以 `#` 开头的配置行是注释。 +- `Key Value # Comment` 配置(没有 `=` 号),`openssh` 有些情况认为 `#` 后的内容是注释,有些情况认为不是注释;`tssh` 一律认为 `#` 后的内容是注释。 +- `Key=Value # Comment` 配置(有 `=` 号),`openssh` 有些情况认为 `#` 后的内容是注释,有些情况认为不是注释;`tssh` 一律认为 `#` 后的内容不是注释。 + ## 其他功能 - 使用 `-f` 后台运行时,可以加上 `--reconnect` 参数,在后台进程因连接断开等而退出时,会自动重新连接。 diff --git a/README.en.md b/README.en.md index bed410f..93e6281 100644 --- a/README.en.md +++ b/README.en.md @@ -609,6 +609,23 @@ trzsz-ssh ( tssh ) is an ssh client designed as a drop-in replacement for the op SetTerminalTitle = Yes ``` +## Comments of Config + +- 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 | + +- 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. + +- `Key Value # Comment` configuration (without `=` sign), `openssh` considers the content after `#` to be a comment in some cases, and considers it not to be a comment in some other cases; `tssh` always considers the content after `#` to be a comment. + +- `Key=Value # Comment` configuration (with `=` sign), `openssh` considers the content after `#` to be a comment in some cases, and considers it not to be a comment in some other cases; `tssh` always considers the content after `#` not to be a comment. + ## Other Features - Use `-f` to run in the background, you can add `--reconnect`, it will automatically reconnect when the background process exits. diff --git a/README.md b/README.md index d5d4021..9202a22 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ trzsz-ssh ( tssh ) offers additional useful features: | [Automated Interaction](README.en.md#automated-interaction) | [自动交互](README.cn.md#%E8%87%AA%E5%8A%A8%E4%BA%A4%E4%BA%92) | | [Remember Password](README.en.md#remember-password) | [记住密码](README.cn.md#%E8%AE%B0%E4%BD%8F%E5%AF%86%E7%A0%81) | | [Custom Configuration](README.en.md#custom-configuration) | [个性配置](README.cn.md#%E4%B8%AA%E6%80%A7%E9%85%8D%E7%BD%AE) | +| [Comments of Config](README.en.md#comments-of-config) | [配置注释](README.cn.md#%E9%85%8D%E7%BD%AE%E6%B3%A8%E9%87%8A) | | [Other Features](README.en.md#other-features) | [其他功能](README.cn.md#%E5%85%B6%E4%BB%96%E5%8A%9F%E8%83%BD) | ## Installation diff --git a/go.mod b/go.mod index 5858761..248e2a3 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/trzsz/go-arg v1.5.3 github.com/trzsz/iterm2 v0.1.2 github.com/trzsz/promptui v0.10.7 - github.com/trzsz/ssh_config v1.3.4 + github.com/trzsz/ssh_config v1.3.5 github.com/trzsz/trzsz-go v1.1.8-0.20240303135018-b95b67671472 golang.org/x/crypto v0.20.0 golang.org/x/sys v0.17.0 diff --git a/go.sum b/go.sum index 16dbda3..5d2353f 100644 --- a/go.sum +++ b/go.sum @@ -95,8 +95,8 @@ github.com/trzsz/iterm2 v0.1.2 h1:VwfLzr2fKeaLf+p4tS0ms+kqdiQQxVLbTJUoyuQXmK8= github.com/trzsz/iterm2 v0.1.2/go.mod h1:PMI+3JcT7J9D0T6e3mOWv8ICYdrrNZwuge3Tm7zDLws= github.com/trzsz/promptui v0.10.7 h1:77uBrmsIPYYJS/9n+zwFRhwOz82EKXkkdjOiWSEUPpk= github.com/trzsz/promptui v0.10.7/go.mod h1:9dp59ixe32qBV9GjDxQ1PDWwbzHjTzveZenQwEoVHbg= -github.com/trzsz/ssh_config v1.3.4 h1:7of+6rUmdWdqfgXnH9csgJe1kNkriS9xOiFGx4KCkEw= -github.com/trzsz/ssh_config v1.3.4/go.mod h1:Dl1okTjVVfsrtTA8nqkJ1OnjiCrZY6DUEI2DGT2/YoQ= +github.com/trzsz/ssh_config v1.3.5 h1:wSZT2PG/7IICvHTIGeDQF5xT5HMXwRfYdnC8IcM3Yk8= +github.com/trzsz/ssh_config v1.3.5/go.mod h1:Dl1okTjVVfsrtTA8nqkJ1OnjiCrZY6DUEI2DGT2/YoQ= github.com/trzsz/trzsz-go v1.1.8-0.20240303135018-b95b67671472 h1:ZtVHV/7EQCJmqUS2ZDPfYVn0IUVF7nXj6d6rF7v90dc= github.com/trzsz/trzsz-go v1.1.8-0.20240303135018-b95b67671472/go.mod h1:WLMZCtkmAKnH66bHRhB2iFbY/e+wBPDGkeOJuP60qxY= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=