Skip to content

Commit

Permalink
support custom progress color
Browse files Browse the repository at this point in the history
  • Loading branch information
lonnywong committed Jul 14, 2024
1 parent 2e836c6 commit eaad80e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,9 @@ trzsz-ssh ( tssh ) 设计为 ssh 客户端的直接替代品,提供与 openssh
# 全局的拖拽文件上传命令,注意 ~/.ssh/config 中配置的优先级更高
DragFileUploadCommand = trz -y

# trzsz 进度条将从第一种颜色渐变到第二种颜色。注意不要带 `#`。
ProgressColorPair = B14FFF 00FFA3

# tssh 搜索和选择服务器时,配置主题风格和自定义颜色
PromptThemeLayout = simple
PromptThemeColors = {"active_host": "magenta|bold", "inactive_host": "magenta"}
Expand Down
3 changes: 3 additions & 0 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,9 @@ trzsz-ssh ( tssh ) is an ssh client designed as a drop-in replacement for the op
# The global drag file upload command, note that the priority configured in ~/.ssh/config is higher.
DragFileUploadCommand = trz -y
# The trzsz progress bar will gradient from the first color to the second color. Don't include `#`.
ProgressColorPair = B14FFF 00FFA3
# When searching and selecting servers with tssh, the theme and colors.
PromptThemeLayout = simple
PromptThemeColors = {"active_host": "magenta|bold", "inactive_host": "magenta"}
Expand Down
6 changes: 6 additions & 0 deletions tssh/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ type tsshConfig struct {
defaultUploadPath string
defaultDownloadPath string
dragFileUploadCommand string
progressColorPair string
promptThemeLayout string
promptThemeColors map[string]string
promptPageSize uint8
Expand Down Expand Up @@ -141,6 +142,8 @@ func parseTsshConfig() {
userConfig.defaultDownloadPath = resolveHomeDir(value)
case name == "dragfileuploadcommand" && userConfig.dragFileUploadCommand == "":
userConfig.dragFileUploadCommand = value
case name == "progresscolorpair" && userConfig.progressColorPair == "":
userConfig.progressColorPair = value
case name == "promptthemelayout" && userConfig.promptThemeLayout == "":
userConfig.promptThemeLayout = value
case name == "promptthemecolors" && len(userConfig.promptThemeColors) == 0:
Expand Down Expand Up @@ -198,6 +201,9 @@ func showTsshConfig() {
if userConfig.dragFileUploadCommand != "" {
debug("DragFileUploadCommand = %s", userConfig.dragFileUploadCommand)
}
if userConfig.progressColorPair != "" {
debug("ProgressColorPair = %s", userConfig.progressColorPair)
}
if userConfig.promptThemeLayout != "" {
debug("PromptThemeLayout = %s", userConfig.promptThemeLayout)
}
Expand Down
1 change: 1 addition & 0 deletions tssh/trzsz.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ func enableTrzsz(args *sshArgs, ss *sshClientSession) error {
dragFileUploadCommand = userConfig.dragFileUploadCommand
}
trzszFilter.SetDragFileUploadCommand(dragFileUploadCommand)
trzszFilter.SetProgressColorPair(userConfig.progressColorPair)

// setup tunnel connect
trzszFilter.SetTunnelConnector(func(port int) net.Conn {
Expand Down

0 comments on commit eaad80e

Please sign in to comment.