Skip to content

Commit

Permalink
optimize debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
lonnywong committed Aug 31, 2024
1 parent 9ee1df2 commit 7a1d15b
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions tssh/trzsz.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,23 @@ func enableTrzsz(args *sshArgs, ss *sshClientSession) error {
return fmt.Errorf("get terminal size failed: %v", err)
}

// custom configuration
defaultUploadPath := getExOptionConfig(args, "DefaultUploadPath")
if defaultUploadPath == "" {
defaultUploadPath = userConfig.defaultUploadPath
}
defaultDownloadPath := args.DownloadPath
if defaultDownloadPath == "" {
defaultDownloadPath = getExOptionConfig(args, "DefaultDownloadPath")
if defaultDownloadPath == "" {
defaultDownloadPath = userConfig.defaultDownloadPath
}
}
dragFileUploadCommand := getExOptionConfig(args, "DragFileUploadCommand")
if dragFileUploadCommand == "" {
dragFileUploadCommand = userConfig.dragFileUploadCommand
}

// create a TrzszFilter to support trzsz ( trz / tsz )
//
// os.Stdin ┌────────┐ os.Stdin ┌─────────────┐ ServerIn ┌────────┐
Expand Down Expand Up @@ -185,27 +202,9 @@ func enableTrzsz(args *sshArgs, ss *sshClientSession) error {
})

// setup trzsz config
defaultUploadPath := getExOptionConfig(args, "DefaultUploadPath")
if defaultUploadPath == "" {
defaultUploadPath = userConfig.defaultUploadPath
}
trzszFilter.SetDefaultUploadPath(defaultUploadPath)

downloadPath := args.DownloadPath
if downloadPath == "" {
downloadPath = getExOptionConfig(args, "DefaultDownloadPath")
if downloadPath == "" {
downloadPath = userConfig.defaultDownloadPath
}
}
trzszFilter.SetDefaultDownloadPath(downloadPath)

dragFileUploadCommand := getExOptionConfig(args, "DragFileUploadCommand")
if dragFileUploadCommand == "" {
dragFileUploadCommand = userConfig.dragFileUploadCommand
}
trzszFilter.SetDefaultDownloadPath(defaultDownloadPath)
trzszFilter.SetDragFileUploadCommand(dragFileUploadCommand)

trzszFilter.SetProgressColorPair(userConfig.progressColorPair)

// setup tunnel connect
Expand Down

0 comments on commit 7a1d15b

Please sign in to comment.