Skip to content

Commit 82d2bb3

Browse files
committed
remove recursive opt from wsh copy and move
1 parent 4b7637f commit 82d2bb3

File tree

4 files changed

+3
-17
lines changed

4 files changed

+3
-17
lines changed

cmd/wsh/cmd/wshcmd-file.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -418,10 +418,6 @@ func fileCpRun(cmd *cobra.Command, args []string) error {
418418

419419
func fileMvRun(cmd *cobra.Command, args []string) error {
420420
src, dst := args[0], args[1]
421-
recursive, err := cmd.Flags().GetBool("recursive")
422-
if err != nil {
423-
return err
424-
}
425421
force, err := cmd.Flags().GetBool("force")
426422
if err != nil {
427423
return err
@@ -435,9 +431,9 @@ func fileMvRun(cmd *cobra.Command, args []string) error {
435431
if err != nil {
436432
return fmt.Errorf("unable to parse dest path: %w", err)
437433
}
438-
log.Printf("Moving %s to %s; recursive: %v, force: %v", srcPath, destPath, recursive, force)
434+
log.Printf("Moving %s to %s; force: %v", srcPath, destPath, force)
439435
rpcOpts := &wshrpc.RpcOpts{Timeout: TimeoutYear}
440-
err = wshclient.FileMoveCommand(RpcClient, wshrpc.CommandFileCopyData{SrcUri: srcPath, DestUri: destPath, Opts: &wshrpc.FileCopyOpts{Overwrite: force, Timeout: TimeoutYear, Recursive: recursive}}, rpcOpts)
436+
err = wshclient.FileMoveCommand(RpcClient, wshrpc.CommandFileCopyData{SrcUri: srcPath, DestUri: destPath, Opts: &wshrpc.FileCopyOpts{Overwrite: force, Timeout: TimeoutYear}}, rpcOpts)
441437
if err != nil {
442438
return fmt.Errorf("moving file: %w", err)
443439
}

frontend/types/gotypes.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,6 @@ declare global {
387387
// wshrpc.FileCopyOpts
388388
type FileCopyOpts = {
389389
overwrite?: boolean;
390-
recursive?: boolean;
391390
merge?: boolean;
392391
timeout?: number;
393392
};

pkg/wshrpc/wshremote/wshremote.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,6 @@ func (impl *ServerImpl) RemoteFileMoveCommand(ctx context.Context, data wshrpc.C
707707
destUri := data.DestUri
708708
srcUri := data.SrcUri
709709
overwrite := opts != nil && opts.Overwrite
710-
recursive := opts != nil && opts.Recursive
711710

712711
destConn, err := connparse.ParseURIAndReplaceCurrentHost(ctx, destUri)
713712
if err != nil {
@@ -735,13 +734,6 @@ func (impl *ServerImpl) RemoteFileMoveCommand(ctx context.Context, data wshrpc.C
735734
}
736735
if srcConn.Host == destConn.Host {
737736
srcPathCleaned := filepath.Clean(wavebase.ExpandHomeDirSafe(srcConn.Path))
738-
finfo, err := os.Stat(srcPathCleaned)
739-
if err != nil {
740-
return fmt.Errorf("cannot stat file %q: %w", srcPathCleaned, err)
741-
}
742-
if finfo.IsDir() && !recursive {
743-
return fmt.Errorf("cannot move directory %q, recursive option not specified", srcUri)
744-
}
745737
err = os.Rename(srcPathCleaned, destPathCleaned)
746738
if err != nil {
747739
return fmt.Errorf("cannot move file %q to %q: %w", srcPathCleaned, destPathCleaned, err)

pkg/wshrpc/wshrpctypes.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,7 @@ type CommandRemoteStreamTarData struct {
546546

547547
type FileCopyOpts struct {
548548
Overwrite bool `json:"overwrite,omitempty"`
549-
Recursive bool `json:"recursive,omitempty"` // only used for move, always true for copy
550-
Merge bool `json:"merge,omitempty"` // only used for copy, always false for move
549+
Merge bool `json:"merge,omitempty"` // only used for copy, always false for move
551550
Timeout int64 `json:"timeout,omitempty"`
552551
}
553552

0 commit comments

Comments
 (0)