Skip to content

Commit 68beac7

Browse files
author
YangSen-qn
committed
sync support set resume v2 part size & change some doc
1 parent d52e461 commit 68beac7

19 files changed

+52
-33
lines changed

cmd/asyncfetch.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func asyncFetchCmdBuilder(cfg *iqshell.Config) *cobra.Command {
3636
cmd.Flags().IntVarP(&info.FileType, "storage-type", "g", 0, "storage type, same to --file-type")
3737
_ = cmd.Flags().MarkDeprecated("storage-type", "use --file-type instead") // 废弃 storage-type
3838

39-
cmd.Flags().BoolVarP(&info.Overwrite, "overwrite", "w", false, "overwrite the file of same key in bucket")
39+
cmd.Flags().BoolVarP(&info.Overwrite, "overwrite", "", false, "overwrite the file of same key in bucket")
4040
cmd.Flags().StringVarP(&info.BatchInfo.InputFile, "input-file", "i", "", "input file with urls")
4141
cmd.Flags().IntVarP(&info.BatchInfo.WorkerCount, "thread-count", "c", 20, "thread count")
4242
cmd.Flags().BoolVarP(&info.BatchInfo.EnableRecord, "enable-record", "", false, "record work progress, and do from last progress while retry")

cmd/download.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ have already in local disk and need to skip download or not.`,
2929
},
3030
}
3131
cmd.Flags().StringVarP(&info.SuccessExportFilePath, "success-list", "s", "", "specifies the file path where the successful file list is saved")
32-
cmd.Flags().StringVarP(&info.FailExportFilePath, "failure-list", "f", "", "specifies the file path where the failure file list is saved")
32+
cmd.Flags().StringVarP(&info.FailExportFilePath, "failure-list", "e", "", "specifies the file path where the failure file list is saved")
3333

3434
cmd.Flags().IntVarP(&info.WorkerCount, "thread-count", "c", 5, "num of threads to download files")
3535
cmd.Flags().IntVarP(&info.WorkerCount, "thread", "", 5, "num of threads to download files")
@@ -65,7 +65,7 @@ have already in local disk and need to skip download or not.`,
6565
},
6666
}
6767
cmd.Flags().StringVarP(&info.SuccessExportFilePath, "success-list", "s", "", "specifies the file path where the successful file list is saved")
68-
cmd.Flags().StringVarP(&info.FailExportFilePath, "failure-list", "f", "", "specifies the file path where the failure file list is saved")
68+
cmd.Flags().StringVarP(&info.FailExportFilePath, "failure-list", "e", "", "specifies the file path where the failure file list is saved")
6969

7070
cmd.Flags().IntVarP(&info.WorkerCount, "thread-count", "c", 5, "num of threads to download files")
7171
cmd.Flags().IntVarP(&info.WorkerCount, "thread", "", 5, "num of threads to download files")
@@ -120,7 +120,7 @@ var getCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
120120
cmd.Flags().StringVarP(&info.Domain, "domain", "", "", "domain of request")
121121
cmd.Flags().StringVarP(&info.Domain, "cdn-domain", "", "", "set the CDN domain name for downloading, the default is empty, which means downloading from the storage source site")
122122
_ = cmd.Flags().MarkDeprecated("domain", "use --cdn-domain instead")
123-
123+
124124
cmd.Flags().BoolVarP(&info.CheckHash, "check-hash", "", false, "check the consistency of the hash between the local file and the server file. the download fails while the file is inconsistent.")
125125
cmd.Flags().BoolVarP(&info.CheckSize, "check-size", "", false, "check the consistency of the file size between the local file and the server file. the download fails while the file is inconsistent.")
126126
cmd.Flags().BoolVarP(&info.UseGetFileApi, "get-file-api", "", false, "public storage cloud not support, private storage cloud support when has getfile api.")

cmd/rs.go

+6
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ var moveCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
111111
},
112112
}
113113
cmd.Flags().BoolVarP(&info.Force, "overwrite", "w", false, "overwrite mode")
114+
_ = cmd.Flags().MarkShorthandDeprecated("overwrite", "deprecated and use --overwrite instead")
115+
114116
cmd.Flags().StringVarP(&info.DestKey, "key", "k", "", "filename saved in bucket")
115117
return cmd
116118
}
@@ -141,6 +143,8 @@ you can check if B.png has exists by:
141143
},
142144
}
143145
cmd.Flags().BoolVarP(&info.Force, "overwrite", "w", false, "overwrite mode")
146+
_ = cmd.Flags().MarkShorthandDeprecated("overwrite", "deprecated and use --overwrite instead")
147+
144148
return cmd
145149
}
146150

@@ -169,6 +173,8 @@ you can check if B.png has exists by:
169173
},
170174
}
171175
cmd.Flags().BoolVarP(&info.Force, "overwrite", "w", false, "overwrite mode")
176+
_ = cmd.Flags().MarkShorthandDeprecated("overwrite", "deprecated and use --overwrite instead")
177+
172178
cmd.Flags().StringVarP(&info.DestKey, "key", "k", "", "filename saved in bucket, use <SrcKey> while omitted")
173179
return cmd
174180
}

cmd/rsbatch.go

+1
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ func setBatchCmdFailExportFileFlags(cmd *cobra.Command, info *batch.Info) {
311311
}
312312
func setBatchCmdOverwriteFlags(cmd *cobra.Command, info *batch.Info) {
313313
cmd.Flags().BoolVarP(&info.Overwrite, "overwrite", "w", false, "overwrite mode")
314+
_ = cmd.Flags().MarkShorthandDeprecated("overwrite", "deprecated and use --overwrite instead")
314315
}
315316

316317
func init() {

cmd/upload.go

+9-8
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var uploadCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
2828
},
2929
}
3030
cmd.Flags().StringVarP(&info.SuccessExportFilePath, "success-list", "s", "", "specifies the file path where the successful file list is saved")
31-
cmd.Flags().StringVarP(&info.FailExportFilePath, "failure-list", "f", "", "specifies the file path where the failure file list is saved")
31+
cmd.Flags().StringVarP(&info.FailExportFilePath, "failure-list", "e", "", "specifies the file path where the failure file list is saved")
3232
cmd.Flags().StringVarP(&info.OverwriteExportFilePath, "overwrite-list", "w", "", "specifies the file path where the overwrite file list is saved")
3333
cmd.Flags().IntVarP(&info.Info.WorkerCount, "worker", "c", 1, "worker count")
3434
cmd.Flags().StringVarP(&info.CallbackUrl, "callback-urls", "l", "", "upload callback urls, separated by comma")
@@ -62,16 +62,16 @@ var upload2CmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
6262
operations.BatchUpload2(cfg, info)
6363
},
6464
}
65-
cmd.Flags().StringVar(&info.SuccessExportFilePath, "success-list", "", "upload success file list")
66-
cmd.Flags().StringVar(&info.FailExportFilePath, "failure-list", "", "upload failure file list")
67-
cmd.Flags().StringVar(&info.OverwriteExportFilePath, "overwrite-list", "", "upload success (overwrite) file list")
65+
cmd.Flags().StringVarP(&info.SuccessExportFilePath, "success-list", "s", "", "upload success file list")
66+
cmd.Flags().StringVarP(&info.FailExportFilePath, "failure-list", "e", "", "upload failure file list")
67+
cmd.Flags().StringVarP(&info.OverwriteExportFilePath, "overwrite-list", "w", "", "upload success (overwrite) file list")
6868
cmd.Flags().IntVar(&info.Info.WorkerCount, "thread-count", 1, "multiple thread count")
6969
cmd.Flags().IntVar(&info.UploadConfig.WorkerCount, "worker-count", 3, "the number of concurrently uploaded parts of a single file in resumable upload")
7070

7171
cmd.Flags().BoolVarP(&info.ResumableAPIV2, "resumable-api-v2", "", false, "use resumable upload v2 APIs to upload")
7272
cmd.Flags().Int64Var(&info.ResumableAPIV2PartSize, "resumable-api-v2-part-size", data.BLOCK_SIZE, "the part size when use resumable upload v2 APIs to upload")
7373
cmd.Flags().BoolVar(&info.IgnoreDir, "ignore-dir", false, "ignore the dir in the dest file key")
74-
cmd.Flags().BoolVarP(&info.Overwrite, "overwrite", "w", false, "overwrite the file of same key in bucket")
74+
cmd.Flags().BoolVarP(&info.Overwrite, "overwrite", "", false, "overwrite the file of same key in bucket")
7575
cmd.Flags().BoolVar(&info.CheckExists, "check-exists", false, "check file key whether in bucket before upload")
7676
cmd.Flags().BoolVar(&info.CheckHash, "check-hash", false, "check hash")
7777
cmd.Flags().BoolVar(&info.CheckSize, "check-size", false, "check file size")
@@ -126,13 +126,14 @@ var syncCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
126126
}
127127
cmd.Flags().StringVarP(&info.SaveKey, "key", "k", "", "save as <key> in bucket")
128128
cmd.Flags().BoolVarP(&info.UseResumeV2, "resumable-api-v2", "", false, "use resumable upload v2 APIs to upload")
129+
cmd.Flags().Int64VarP(&info.ChunkSize, "resumable-api-v2-part-size", "", data.BLOCK_SIZE, "the part size when use resumable upload v2 APIs to upload, default 4M")
129130
cmd.Flags().StringVarP(&info.UpHost, "up-host", "u", "", "upload host")
130131

131132
cmd.Flags().IntVarP(&info.FileType, "file-type", "", 0, "set storage type of file, 0:STANDARD storage, 1:IA storage, 2:ARCHIVE storage, 3:DEEP_ARCHIVE storage")
132133
cmd.Flags().IntVarP(&info.FileType, "storage", "s", 0, "set storage type of file, same to --file-type")
133134
_ = cmd.Flags().MarkDeprecated("storage", "use --file-type instead") // 废弃 storage
134135

135-
cmd.Flags().BoolVarP(&info.Overwrite, "overwrite", "w", false, "overwrite the file of same key in bucket")
136+
cmd.Flags().BoolVarP(&info.Overwrite, "overwrite", "", false, "overwrite the file of same key in bucket")
136137

137138
return cmd
138139
}
@@ -159,7 +160,7 @@ var formUploadCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
159160
operations.UploadFile(cfg, info)
160161
},
161162
}
162-
cmd.Flags().BoolVarP(&info.Overwrite, "overwrite", "w", false, "overwrite the file of same key in bucket")
163+
cmd.Flags().BoolVarP(&info.Overwrite, "overwrite", "", false, "overwrite the file of same key in bucket")
163164
cmd.Flags().StringVarP(&info.MimeType, "mimetype", "t", "", "file mime type")
164165

165166
cmd.Flags().IntVarP(&info.FileType, "file-type", "", 0, "set storage type of file, 0:STANDARD storage, 1:IA storage, 2:ARCHIVE storage, 3:DEEP_ARCHIVE storage")
@@ -196,7 +197,7 @@ var resumeUploadCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
196197
}
197198

198199
cmd.Flags().StringVarP(&info.MimeType, "mimetype", "t", "", "file mime type")
199-
cmd.Flags().BoolVarP(&info.Overwrite, "overwrite", "w", false, "overwrite the file of same key in bucket")
200+
cmd.Flags().BoolVarP(&info.Overwrite, "overwrite", "", false, "overwrite the file of same key in bucket")
200201
cmd.Flags().BoolVarP(&info.UseResumeV2, "resumable-api-v2", "", false, "use resumable upload v2 APIs to upload")
201202

202203
cmd.Flags().Int64VarP(&info.ChunkSize, "resumable-api-v2-part-size", "", data.BLOCK_SIZE, "the part size when use resumable upload v2 APIs to upload, default 4M")

cmd_test/download_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ func TestDownload2WithKeyFile(t *testing.T) {
292292
"--log-file", logPath,
293293
"--log-level", "debug",
294294
"-s", successLogPath,
295-
"-f", failLogPath,
295+
"-e", failLogPath,
296296
"-c", "4",
297297
"-d")
298298
if test.FileCountInDir(destDir) < 2 {

docs/abfetch.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
# 格式
1111
```
12-
qshell abfetch [-i <URLList>][-b <CallbackBody>][-T <CallbackHost>][-a <CallbackUrl>][-e <FailureList>][-t <DownloadHostHeader>][-g <FileType>][-s <SuccessList>][-c <ThreadCount>] <Bucket>
12+
qshell abfetch [-i <URLList>][-b <CallbackBody>][-T <CallbackHost>][-a <CallbackUrl>][-e <FailureList>][-t <DownloadHostHeader>][--file-type <FileType>][-s <SuccessList>][-c <ThreadCount>] <Bucket>
1313
```
1414

1515
# 帮助文档
@@ -37,9 +37,9 @@ $ qshell abfetch --doc
3737
- -b/--callback-body:回调的 http Body。 【可选】
3838
- -T/--callback-host:回调时的 HOST 头。 【可选】
3939
- -a/--callback-url:回调的请求地址。 【可选】
40-
- -t/--host:下载资源时使用的 HOST 头。 【可选】
4140
- --file-type:抓取的资源存储在七牛存储空间的类型,0:普通存储 1:低频存储 2:归档存储 3:深度归档, 默认为: 0。 【可选】
4241
- -c/--thread-count:指定抓取时使用的线程数目,默认:20。 【可选】
42+
- --overwrite:是否覆盖空间已有文件,默认为 `false`。 【可选】
4343
- -s/--success-list:指定一个文件的路径,如果资源抓取成功,则将资源信息写入此文件;默认不导出。 【可选】
4444
- -e/--failure-list:指定一个文件的路径,如果资源抓取失败,则将资源信息写入此文件;默认不导出。 【可选】
4545
- --disable-check-fetch-result:不检测异步 fetch 是否成功;检测方式是查询目标 bucket 是否存在 fetch 的文件;默认检测。【可选】

docs/copy.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ $ qshell copy --doc
3030
- DestBucket: 目标空间名称,可以和源空间名称相同【必选】
3131

3232
# 选项
33-
- -k: 目标文件名称(DestKey),如果是 `DestBucket``SrcBucket` 不同的情况下,这个参数可以不填,默认和 `SrcKey` 相同。【可选】
34-
- -w/--overwrite: 当保存的文件已存在时,强制用新文件覆盖原文件,如果无此选项操作会失败。【可选】
33+
- -k/--key: 目标文件名称(DestKey),如果是 `DestBucket``SrcBucket` 不同的情况下,这个参数可以不填,默认和 `SrcKey` 相同。【可选】
34+
- --overwrite: 当保存的文件已存在时,强制用新文件覆盖原文件,如果无此选项操作会失败。【可选】
3535

3636
##### 备注:
3737
1 如果复制的副本和原文件在同一个空间,那么必须提供不同于原文件的副本文件名,或者加上覆盖选项 `--overwrite`

docs/get.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ $ qshell get --doc
2525

2626
# 选项
2727
- -o/--outfile:保存在本地的文件路径;不指定,保存在当前文件夹,文件名使用存储空间中的名字【可选】
28-
- --domain:下载请求的 domain,qshell 下载使用 domain 优先级:1.domain(此选项) 2.bucket 绑定域名(qshell 内部查询,无需配置) ,当优先级高的 domain 下载失败后会尝试使用优先级低的 domain 进行下载。【可选】
28+
- --cdn-domain:下载请求的 domain,qshell 下载使用 domain 优先级:1.domain(此选项) 2.bucket 绑定域名(qshell 内部查询,无需配置) ,当优先级高的 domain 下载失败后会尝试使用优先级低的 domain 进行下载。【可选】
2929
- --get-file-api: 当存储服务端支持 getfile 接口时才有效。【可选】
3030
- --public:空间是否为公开空间;为 `true` 时为公有空间,公有空间下载时不会对下载 URL 进行签名,可以提升 CDN 域名性能,默认为 `false`(私有空间)【可选】
3131
- --check-size: 下载后检测本地文件和服务端文件 size 的一致性。【可选】

docs/listbucket2.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ $ qshell listbucket2 --doc
3232
# 选项
3333
- --prefix: 七牛空间中文件名的前缀,该参数为可选参数,如果不指定则获取空间中所有的文件列表。 【可选】
3434
- --limit:最多列条目的数量;当设置了此选项,输出的 marker 会有误差,不能使用; 默认输出所有条目。【可选】
35-
- --out:获取的文件列表保存在本地的文件名,如果不指定该参数,则会把结果输出到终端,一般可用于获取小规模文件列表测试使用。 【可选】
35+
- -o/--outfile:获取的文件列表保存在本地的文件名,如果不指定该参数,则会把结果输出到终端,一般可用于获取小规模文件列表测试使用。 【可选】
3636
- --output-file-max-lines:每个输出文件的最大行数,大于此行数会自动创建新的文件(新文件的文件名规律示例,源文件:/x/x/a.txt,新建文件为:/x/x/a-${index}.txt,index 为创建文件的序列号,从 0 开始),0:不限制单个输出文件的行数,默认:0。 【可选】
3737
- --output-file-max-size:每个输出文件的最大尺寸,大于此值会自动创建新的文件(新文件的文件名规律示例,源文件:/x/x/a.txt,新建文件为:/x/x/a-${index}.txt,index 为创建文件的序列号,从 0 开始),0:不限制单个输出文件的尺寸,单位:B,默认:0。 【可选】
3838
- --start:列举整个空间,然后从中筛选出文件上传日期在 <StartDate> 之后的文件;格式:yyyy-mm-dd-hh-MM-ss eg:2022-01-10-08-30-20 。【可选】
@@ -117,7 +117,7 @@ qshell listbucket if-pbl --prefix '2014/10/07/' -o if-pbl.prefix.list.txt
117117
hello.jpg 1710619 FlUqUK7zqbqm3NPwzq2q7TMZ-Ijs 14209629320769140 image/jpeg 1
118118
hello.mp4 8495868 lns2dAHvO0qYseZFgDn3UqZlMOi- 14207312835630132 video/mp4 0
119119
hhh 1492031 FjiRl_U0AeSsVCHXscCGObKyMy8f 14200176147531840 image/jpeg 1
120-
jemygraw.jpg 1900176 FtmHAbztWfPEqPMv4t4vMNRYMETK 14208960018750329 application/octet-stream 1 QiniuAndroid
120+
jemygraw.jpg 1900176 FtmHAbztWfPEqPMv4t4vMNRYMETK 14208960018750329 application/octet-stream 1
121121
```
122122

123123
# FAQ

docs/move.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# 格式
88
```
9-
qshell move [--overwrite] <SrcBucket> <SrcKey> <DestBucket> <DestKey>
9+
qshell move [--overwrite] <SrcBucket> <SrcKey> <DestBucket> [-k DestKey]
1010
```
1111

1212
# 帮助文档
@@ -26,7 +26,10 @@ $ qshell move --doc
2626
- SrcBucket: 源空间名称
2727
- SrcKey: 源文件名称
2828
- DestBucket: 目标空间名称
29-
- DestKey: 目标文件名称
29+
30+
# 选项
31+
- -k/--key: 目标文件名称(DestKey),如果是 `DestBucket``SrcBucket` 不同的情况下,这个参数可以不填,默认和 `SrcKey` 相同。【可选】
32+
- --overwrite: 当保存的文件已存在时,强制用新文件覆盖原文件,如果无此选项操作会失败。【可选】
3033

3134
# 示例
3235
1 将空间 `if-pbl` 中的 `qiniu.jpg` 移动到 `if-pri`

docs/pfop.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ $ qshell pfop --doc
2727
# 选项
2828
- -p/--pipeline:处理队列名称, 如果没有制定该选项,默认使用公有队列【可选】
2929
- -u/--notify-url:处理结果通知接收 URL,七牛将会向你设置的 URL 发起 Content-Type: application/json 的 POST 请求。【可选】
30-
- -f/--force:强制执行数据处理。当服务端发现 fops 指定的数据处理结果已经存在,那就认为已经处理成功,避免重复处理浪费资源。 增加此选项(--force),则可强制执行数据处理并覆盖原结果。【可选】
30+
- -y/--force:强制执行数据处理。当服务端发现 fops 指定的数据处理结果已经存在,那就认为已经处理成功,避免重复处理浪费资源。 增加此选项(--force),则可强制执行数据处理并覆盖原结果。【可选】
3131

3232
# 示例
3333
1 把 qiniutest 空间下的文件 `test.avi` 转码成 `mp4` 文件,转码后的结果保存到 `qiniutest` 空间中

docs/qdownload.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ $ qshell qdownload --doc
3434
其中 `ThreadCount` 表示支持同时下载多个文件。
3535

3636
# 选项
37-
- -c/--thread:配置下载的并发协程数量,表示支持同时下载多个文件(ThreadCount), 大小必须在 1~2000,如果不在这个范围内,默认为 5。
37+
- -c/--thread-count:配置下载的并发协程数量,表示支持同时下载多个文件(ThreadCount), 大小必须在 1~2000,如果不在这个范围内,默认为 5。
3838
- -s/--success-list:指定一个文件名字,导入下载成功的文件列表到该文件。
39-
- -f/--failure-list:指定一个文件名字, 导入下砸失败的文件列表到该文件。
39+
- -e/--failure-list:指定一个文件名字, 导入下砸失败的文件列表到该文件。
4040

4141
`qdownload` 功能需要配置文件的支持,配置文件的内容如下:
4242
```

docs/qdownload2.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Flags:
2323
--check-hash whether to verify the hash, if it is enabled, it may take a long time
2424
--dest-dir string local storage path, full path. default current dir
2525
--enable-slice --slice-file-size-threshold whether to enable slice download, you need to pay attention to the configuration of --slice-file-size-threshold slice threshold option. Only when slice download is enabled and the size of the downloaded file is greater than the slice threshold will the slice download be started
26-
-f, --failure-list string specifies the file path where the failure file list is saved
26+
-e, --failure-list string specifies the file path where the failure file list is saved
2727
--get-file-api public storage cloud not support, private storage cloud support when has getfile api.
2828
-h, --help help for qdownload2
2929
--io-host string io host of request
@@ -42,5 +42,5 @@ Flags:
4242
--slice-size int slice size; when using slice download, the size of each slice; unit:B (default 4194304)
4343
-s, --success-list string specifies the file path where the successful file list is saved
4444
--suffixes string only download files with the specified suffixes
45-
-c, --thread int num of threads to download files (default 5)
45+
-c, --thread-count int num of threads to download files (default 5)
4646
```

0 commit comments

Comments
 (0)