MCPcopy
hub / github.com/wavetermdev/waveterm / fileMvRun

Function fileMvRun

cmd/wsh/cmd/wshcmd-file.go:381–409  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

379}
380
381func fileMvRun(cmd *cobra.Command, args []string) error {
382 src, dst := args[0], args[1]
383 force, err := cmd.Flags().GetBool("force")
384 if err != nil {
385 return err
386 }
387
388 srcPath, err := fixRelativePaths(src)
389 if err != nil {
390 return fmt.Errorf("unable to parse src path: %w", err)
391 }
392
393 _, err = checkFileSize(srcPath, MaxFileSize)
394 if err != nil {
395 return err
396 }
397
398 destPath, err := fixRelativePaths(dst)
399 if err != nil {
400 return fmt.Errorf("unable to parse dest path: %w", err)
401 }
402 log.Printf("Moving %s to %s; force: %v", srcPath, destPath, force)
403 rpcOpts := &wshrpc.RpcOpts{Timeout: TimeoutYear}
404 err = wshclient.FileMoveCommand(RpcClient, wshrpc.CommandFileCopyData{SrcUri: srcPath, DestUri: destPath, Opts: &wshrpc.FileCopyOpts{Overwrite: force, Timeout: TimeoutYear}}, rpcOpts)
405 if err != nil {
406 return fmt.Errorf("moving file: %w", err)
407 }
408 return nil
409}
410
411func filePrintColumns(filesChan <-chan wshrpc.RespOrErrorUnion[wshrpc.CommandRemoteListEntriesRtnData]) error {
412 width := 80

Callers

nothing calls this directly

Calls 4

FileMoveCommandFunction · 0.92
fixRelativePathsFunction · 0.85
GetBoolMethod · 0.80
checkFileSizeFunction · 0.70

Tested by

no test coverage detected