Skip to content

Commit aba4d2e

Browse files
committed
Make wush rsync more equivalent to regular rsync
1 parent 682a34b commit aba4d2e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

cmd/wush/rsync.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ func rsyncCmd() *serpent.Command {
2626
sshStdio bool
2727
)
2828
return &serpent.Command{
29-
Use: "rsync",
29+
Use: "rsync [flags] -- [rsync args]",
3030
Long: "Runs rsync to transfer files to a " + cliui.Code("wush") + " peer. " +
31-
"Use " + cliui.Code("wush receive") + " on the computer you would like to connect to.",
31+
"Use " + cliui.Code("wush receive") + " on the computer you would like to connect to." +
32+
"\n\n" +
33+
"Example: " + "wush rsync -- --progress --stats -avz --human-readable /local/path :/remote/path",
3234
Handler: func(inv *serpent.Invocation) error {
3335
ctx := inv.Context()
3436
logger := slog.New(slog.NewTextHandler(io.Discard, nil))
@@ -79,11 +81,11 @@ func rsyncCmd() *serpent.Command {
7981

8082
progPath := os.Args[0]
8183
args := []string{
82-
"-c",
83-
"rsync --progress --stats -avz --human-readable " + fmt.Sprintf("-e=\"%s --auth-id %s --stdio --\" ", progPath, send.Auth.AuthKey()) + strings.Join(inv.Args, " "),
84+
"-e", fmt.Sprintf("%s --auth-id %s --stdio --", progPath, send.Auth.AuthKey()),
8485
}
85-
fmt.Println("Running: rsync", args)
86-
cmd := exec.CommandContext(ctx, "sh", args...)
86+
args = append(args, inv.Args...)
87+
fmt.Println("Running: rsync", strings.Join(args, " "))
88+
cmd := exec.CommandContext(ctx, "rsync", args...)
8789
cmd.Stdin = inv.Stdin
8890
cmd.Stdout = inv.Stdout
8991
cmd.Stderr = inv.Stderr

0 commit comments

Comments
 (0)