From 2af1ecfa0a0331d102aa0587942bdbaaaab39778 Mon Sep 17 00:00:00 2001 From: Lonny Wong Date: Sat, 13 Jul 2024 11:57:16 +0800 Subject: [PATCH] another way to support blocks feature in Warp --- README.cn.md | 12 +++++++++++- README.en.md | 14 ++++++++++++-- tssh/main.go | 2 +- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/README.cn.md b/README.cn.md index 652f721..863a0bf 100644 --- a/README.cn.md +++ b/README.cn.md @@ -696,7 +696,17 @@ trzsz-ssh ( tssh ) 设计为 ssh 客户端的直接替代品,提供与 openssh - 软链后,`ssh -V` 应输出 `trzsz ssh` 加版本号,如果不是,说明软链不成功,或者在 `PATH` 中 `openssh` 的优先级更高,你要软链到另一个地方或者调整 `PATH` 的优先级。 - - 软链后,要直接使用 `ssh`,它等价于 `tssh`。如果还是用 `tssh` 是不会支持分块 Blocks 功能的。 + - 为了让 `tssh` 搜索登录也支持分块 Blocks 功能,需要在 `~/.bash_profile` ( bash ) 或 `~/.zshrc` ( zsh ) 中建一个 `tssh` 函数: + + ```sh + tssh() { + if [ $# -eq 0 ]; then + ssh FAKE_DEST_IN_WARP + else + ssh "$@" + fi + } + ``` - `--dragfile` 参数可能会让 Warp 分块功能失效,请参考前文配置 `EnableDragFile` 来启用拖拽功能。 diff --git a/README.en.md b/README.en.md index 3436d11..bcbcef4 100644 --- a/README.en.md +++ b/README.en.md @@ -690,7 +690,7 @@ trzsz-ssh ( tssh ) is an ssh client designed as a drop-in replacement for the op ## Trouble shooting -- In the Warp terminal, the features like Blocks requires renaming `tssh` to `ssh`. It is recommended to create a soft link (friendly for updates): +- In the Warp terminal, the features like blocks requires renaming `tssh` to `ssh`. It is recommended to create a soft link (friendly for updates): ``` sudo ln -sv $(which tssh) /usr/local/bin/ssh @@ -698,7 +698,17 @@ trzsz-ssh ( tssh ) is an ssh client designed as a drop-in replacement for the op - After the soft link, `ssh -V` should output `trzsz ssh` plus the version number. If not, it means that the soft link is unsuccessful, or `openssh` has a higher priority in `PATH`, and you need to soft link to another path or adjust the priority of `PATH`. - - After the soft link, you need to use `ssh` directly, which is equivalent to `tssh`. If you still use `tssh`, it will not support the Blocks feature. + - In order to make `tssh` search login also support the blocks feature, you need to create a `tssh` function in `~/.bash_profile` ( bash ) or `~/.zshrc` ( zsh ): + + ```sh + tssh() { + if [ $# -eq 0 ]; then + ssh FAKE_DEST_IN_WARP + else + ssh "$@" + fi + } + ``` - The `--dragfile` argument may disable the Warp features, please refer to the previous section to configure `EnableDragFile` to enable the drag and drop to upload feature. diff --git a/tssh/main.go b/tssh/main.go index 294b444..a3c8fbd 100644 --- a/tssh/main.go +++ b/tssh/main.go @@ -162,7 +162,7 @@ func TsshMain(argv []string) int { // choose ssh alias dest := "" quit := false - if args.Destination == "" { + if args.Destination == "" || args.Destination == "FAKE_DEST_IN_WARP" { if !isTerminal { parser.WriteHelp(os.Stderr) return 3