|
|
|
@@ -22,11 +22,13 @@ func init() { |
|
|
|
}, |
|
|
|
} |
|
|
|
c.Flags().IntVarP(&opt.Concurrency, "concurrency", "c", 5, "concurrency of download files") |
|
|
|
c.Flags().BoolVar(&opt.SaveToShards, "to-shards", false, "save downloaded files to shards") |
|
|
|
UserSpaceCmd.AddCommand(c) |
|
|
|
} |
|
|
|
|
|
|
|
type getpOpt struct { |
|
|
|
Concurrency int |
|
|
|
Concurrency int |
|
|
|
SaveToShards bool |
|
|
|
} |
|
|
|
|
|
|
|
func getp(c *cobra.Command, ctx *cmd.CommandContext, opt getpOpt, args []string) error { |
|
|
|
@@ -62,10 +64,11 @@ func getp(c *cobra.Command, ctx *cmd.CommandContext, opt getpOpt, args []string) |
|
|
|
startTime := time.Now() |
|
|
|
|
|
|
|
_, err = ctx.Client.UserSpace().DownloadPackage(cliapi.UserSpaceDownloadPackage{ |
|
|
|
PackageID: getPkg.Package.PackageID, |
|
|
|
UserSpaceID: getSpace.UserSpace.UserSpaceID, |
|
|
|
RootPath: rootPath, |
|
|
|
Concurrency: opt.Concurrency, |
|
|
|
PackageID: getPkg.Package.PackageID, |
|
|
|
UserSpaceID: getSpace.UserSpace.UserSpaceID, |
|
|
|
RootPath: rootPath, |
|
|
|
Concurrency: opt.Concurrency, |
|
|
|
SaveToShards: opt.SaveToShards, |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
return fmt.Errorf("download package %v to user space %v: %w", args[0], spaceName, err) |
|
|
|
|