Documentation
¶
Index ¶
- func BuildCommand(h HostConnection) (name string, args []string)
- func DownloadRecursive(ctx context.Context, client *sftp.Client, remotePath, localPath string, ...) error
- func ListRemote(conn *ssh.Client, path string) ([]os.FileInfo, error)
- func RunInNewTerminal(h HostConnection) (cmdStr string, err error)
- func RunSCP(h HostConnection, direction string, localPath, remotePath string) (output string, err error)
- func RunSCPHostToHost(source HostConnection, sourcePath string, dest HostConnection, destPath string) (output string, err error)
- func UploadRecursive(ctx context.Context, client *sftp.Client, localPath, remotePath string, ...) error
- type HostConnection
- type TransferProgress
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildCommand ¶
func BuildCommand(h HostConnection) (name string, args []string)
BuildCommand returns the sftp command and args for the given connection. Caller can run it (e.g. in a new terminal) or display it.
func DownloadRecursive ¶
func ListRemote ¶
ListRemote lists the given path on the remote server over the SSH connection. Caller must ensure conn is valid; it is not closed by this function.
func RunInNewTerminal ¶
func RunInNewTerminal(h HostConnection) (cmdStr string, err error)
RunInNewTerminal runs the sftp command in a new terminal window so the user can interact with it. On macOS uses Terminal.app via osascript; on Linux tries gnome-terminal or xterm; on Windows uses cmd start. Returns the command string and any error (e.g. if no terminal could be launched).
func RunSCP ¶
func RunSCP(h HostConnection, direction string, localPath, remotePath string) (output string, err error)
RunSCP runs scp for push (local → remote) or pull (remote → local). Returns combined output.
func RunSCPHostToHost ¶
func RunSCPHostToHost(source HostConnection, sourcePath string, dest HostConnection, destPath string) (output string, err error)
RunSCPHostToHost copies from source host to dest host (stream goes through local machine). Both source and dest are remote paths: user@host:path.
func UploadRecursive ¶
Types ¶
type HostConnection ¶
HostConnection holds the connection details for building an sftp command.