Skip to content

Commit 5cf7aa5

Browse files
committed
chore(volumes): modify volumes:client cmd annotation and can not cp dir
1 parent 5cf9d52 commit 5cf7aa5

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

cmd/volumes.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,9 @@ func (d *DryccCmd) volumesClientCp(appID, src, dst string) error {
291291
if err != nil {
292292
return err
293293
}
294+
if urlpath == "" || urlpath == "/" {
295+
return fmt.Errorf("path is a directory, not a file")
296+
}
294297
res, err := volumes.GetFile(s.Client, appID, name, urlpath)
295298
if err != nil {
296299
return err
@@ -302,7 +305,7 @@ func (d *DryccCmd) volumesClientCp(appID, src, dst string) error {
302305
dst = path.Join(dst, arrays[len(arrays)-1])
303306
}
304307
}
305-
w, err := os.OpenFile(dst, os.O_CREATE|os.O_WRONLY, 0644)
308+
w, err := os.OpenFile(dst, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644)
306309
if err != nil {
307310
return err
308311
}

parser/volumes.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ Arguments:
232232
cp copy volume files
233233
rm remove volume files
234234
<args>
235-
arguments for running commands
235+
arguments for running commands, when cmd is 'cp', args should be '[source] [dest]'.
236+
volume path format 'vol://volumename/', '/' is equivalent to the mount path.
236237
237238
Options:
238239
-a --app=<app>

0 commit comments

Comments
 (0)