Skip to content

Commit

Permalink
Releases/v2.16.0 (#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
bachue authored Nov 1, 2024
1 parent 476bb76 commit 8afdceb
Show file tree
Hide file tree
Showing 31 changed files with 1,058 additions and 98 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# 2.16.0
## 新增
1. create-share / share-ls / share-cp 命令支持创建对文件夹的共享,列举和下载
2. 上传命令支持额外的 --accelerate 选项
3. fop 命令支持 --workflow-template-id 和 --type 选项

## 更新
1. listbucket2 现在即使使用了 --limit 参数得到的 marker 也是精确的

# 2.15.0
## 新增
1. buckets 命令列举全量 bucket
Expand Down Expand Up @@ -56,7 +65,7 @@
# 2.9.0
1. 新增 batchforbidden 命令,支持批量修改文件启用/禁用状态,具体参考命令使用说明
2. qdownload 命令新增支持自定义文件本地存储路径, 具体参考命令使用说明
4. stat 命令补充部分文件元数据信息,比如过期删除时间等
4. stat 命令补充部分文件元数据信息,比如过期删除时间等
5. bucket 命令补充部分空间信息,比如可查看空间配置的 Refer 等
6. 优化 qupload 关于上传流程中检测文件是否存在机制
7. 优化 qdownload 关于下载流程中检测文件是否存在机制
Expand Down
42 changes: 21 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,52 +32,52 @@ linux: $(LINUX86).zip $(LINUX64).zip $(LINUXARM).zip $(LINUXARM64).zip $(LINUXMI
windows: $(WIN86).zip $(WIN64).zip $(WINARM).zip $(WINARM64).zip

qshell-$(VERSION)-darwin-%.zip: qshell-$(VERSION)-darwin-%
@zip $@ $<
zip $@ $<
qshell-$(VERSION)-linux-%.zip: qshell-$(VERSION)-linux-%
@zip $@ $<
zip $@ $<
qshell-$(VERSION)-windows-%.zip: qshell-$(VERSION)-windows-%.exe
@zip $@ $<
zip $@ $<

$(DARWIN):
@GOOS=darwin GOARCH=amd64 $(GO) build -ldflags $(LDFLAGS) -o $(DARWIN) .
GOOS=darwin GOARCH=amd64 $(GO) build -ldflags $(LDFLAGS) -o $(DARWIN) ./main/
$(DARWINARM64):
@GOOS=darwin GOARCH=arm64 $(GO) build -ldflags $(LDFLAGS) -o $(DARWINARM64) .
GOOS=darwin GOARCH=arm64 $(GO) build -ldflags $(LDFLAGS) -o $(DARWINARM64) ./main/
$(LINUX86):
@CGO_ENABLED=0 GOOS=linux GOARCH=386 $(GO) build -ldflags $(LDFLAGS) -o $(LINUX86) .
CGO_ENABLED=0 GOOS=linux GOARCH=386 $(GO) build -ldflags $(LDFLAGS) -o $(LINUX86) ./main/
$(LINUX64):
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GO) build -ldflags $(LDFLAGS) -o $(LINUX64) .
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GO) build -ldflags $(LDFLAGS) -o $(LINUX64) ./main/
$(LINUXARM):
@CGO_ENABLED=0 GOOS=linux GOARCH=arm $(GO) build -ldflags $(LDFLAGS) -o $(LINUXARM) .
CGO_ENABLED=0 GOOS=linux GOARCH=arm $(GO) build -ldflags $(LDFLAGS) -o $(LINUXARM) ./main/
$(LINUXARM64):
@CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(GO) build -ldflags $(LDFLAGS) -o $(LINUXARM64) .
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(GO) build -ldflags $(LDFLAGS) -o $(LINUXARM64) ./main/
$(LINUXMIPS):
@CGO_ENABLED=0 GOOS=linux GOARCH=mips $(GO) build -ldflags $(LDFLAGS) -o $(LINUXMIPS) .
CGO_ENABLED=0 GOOS=linux GOARCH=mips $(GO) build -ldflags $(LDFLAGS) -o $(LINUXMIPS) ./main/
$(LINUXMIPSLE):
@CGO_ENABLED=0 GOOS=linux GOARCH=mipsle $(GO) build -ldflags $(LDFLAGS) -o $(LINUXMIPSLE) .
CGO_ENABLED=0 GOOS=linux GOARCH=mipsle $(GO) build -ldflags $(LDFLAGS) -o $(LINUXMIPSLE) ./main/
$(LINUXMIPS64):
@CGO_ENABLED=0 GOOS=linux GOARCH=mips64 $(GO) build -ldflags $(LDFLAGS) -o $(LINUXMIPS64) .
CGO_ENABLED=0 GOOS=linux GOARCH=mips64 $(GO) build -ldflags $(LDFLAGS) -o $(LINUXMIPS64) ./main/
$(LINUXMIPS64LE):
@CGO_ENABLED=0 GOOS=linux GOARCH=mips64le $(GO) build -ldflags $(LDFLAGS) -o $(LINUXMIPS64LE) .
CGO_ENABLED=0 GOOS=linux GOARCH=mips64le $(GO) build -ldflags $(LDFLAGS) -o $(LINUXMIPS64LE) ./main/
$(LINUXLOONG64):
@CGO_ENABLED=0 GOOS=linux GOARCH=loong64 $(GO) build -ldflags $(LDFLAGS) -o $(LINUXLOONG64) .
CGO_ENABLED=0 GOOS=linux GOARCH=loong64 $(GO) build -ldflags $(LDFLAGS) -o $(LINUXLOONG64) ./main/
$(LINUXRISCV64):
@CGO_ENABLED=0 GOOS=linux GOARCH=riscv64 $(GO) build -ldflags $(LDFLAGS) -o $(LINUXRISCV64) .
CGO_ENABLED=0 GOOS=linux GOARCH=riscv64 $(GO) build -ldflags $(LDFLAGS) -o $(LINUXRISCV64) ./main/
$(WIN86).exe:
@CGO_ENABLED=0 GOOS=windows GOARCH=386 $(GO) build -ldflags $(LDFLAGS) -o $(WIN86).exe .
CGO_ENABLED=0 GOOS=windows GOARCH=386 $(GO) build -ldflags $(LDFLAGS) -o $(WIN86).exe ./main/
$(WIN64).exe:
@CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GO) build -ldflags $(LDFLAGS) -o $(WIN64).exe .
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GO) build -ldflags $(LDFLAGS) -o $(WIN64).exe ./main/
$(WINARM).exe:
@CGO_ENABLED=0 GOOS=windows GOARCH=arm $(GO) build -ldflags $(LDFLAGS) -o $(WINARM).exe .
CGO_ENABLED=0 GOOS=windows GOARCH=arm $(GO) build -ldflags $(LDFLAGS) -o $(WINARM).exe ./main/
$(WINARM64).exe:
@CGO_ENABLED=0 GOOS=windows GOARCH=arm64 $(GO) build -ldflags $(LDFLAGS) -o $(WINARM64).exe .
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 $(GO) build -ldflags $(LDFLAGS) -o $(WINARM64).exe ./main/

.PHONY: cleanzip cleanbin clean upload

cleanzip:
@rm -f qshell-$(VERSION)-*.zip
rm -f qshell-$(VERSION)-*.zip

cleanbin:
@rm -f qshell-$(VERSION)-*
rm -f qshell-$(VERSION)-*

clean: cleanzip cleanbin

Expand Down
15 changes: 9 additions & 6 deletions cmd/fop.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ var preFopStatusCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
return cmd
}

var preFopCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.PreFopInfo{}
var pfopCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.PfopInfo{}
var cmd = &cobra.Command{
Use: "pfop <Bucket> <Key> <fopCommand>",
Short: "Issue a request to process file in bucket",
Expand All @@ -42,14 +42,17 @@ var preFopCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
if len(args) > 2 {
info.Fops = args[2]
}
operations.PreFop(cfg, info)
operations.Pfop(cfg, info)
},
}
cmd.Flags().StringVarP(&info.Pipeline, "pipeline", "p", "", "task pipeline")
cmd.Flags().StringVarP(&info.NotifyURL, "notify-url", "u", "", "notfiy url")
cmd.Flags().StringVarP(&info.WorkflowTemplateID, "workflow-template-id", "", "", "Workflow template ID")

cmd.Flags().BoolVarP(&info.NotifyForce, "force", "y", false, "force execute")
cmd.Flags().BoolVarP(&info.NotifyForce, "force-old", "f", false, "force execute, deprecated")
cmd.Flags().BoolVarP(&info.Force, "force", "y", false, "force execute")
cmd.Flags().BoolVarP(&info.Force, "force-old", "f", false, "force execute, deprecated")

cmd.Flags().Int64VarP(&info.Type, "type", "", 0, "task type")
_ = cmd.Flags().MarkDeprecated("force-old", "use --force instead")

return cmd
Expand All @@ -61,7 +64,7 @@ func init() {

func fopCmdLoader(superCmd *cobra.Command, cfg *iqshell.Config) {
superCmd.AddCommand(
preFopCmdBuilder(cfg),
pfopCmdBuilder(cfg),
preFopStatusCmdBuilder(cfg),
)
}
90 changes: 90 additions & 0 deletions cmd/share.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package cmd

import (
"strings"

"github.com/qiniu/qshell/v2/docs"
"github.com/qiniu/qshell/v2/iqshell"
"github.com/qiniu/qshell/v2/iqshell/storage/object/operations"
"github.com/spf13/cobra"
)

var createShareCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.CreateShareInfo{}
var cmd = &cobra.Command{
Use: "create-share [kodo://]<Bucket>/<Prefix>",
Short: "Share the specified directory",
Run: func(cmd *cobra.Command, args []string) {
cfg.CmdCfg.CmdId = docs.CreateShareType
if len(args) > 0 {
url := args[0]
url = strings.TrimPrefix(url, "kodo://")
parts := strings.SplitN(url, "/", 2)
if len(parts) > 0 {
info.Bucket = parts[0]
}
if len(parts) > 1 {
info.Prefix = parts[1]
}
info.Permission = "READONLY"
}
operations.CreateShare(cfg, info)
},
}
cmd.Flags().StringVarP(&info.ExtractCode, "extract-code", "", "", "Specify extract code for the share, must consist of 6 alphabets and numbers")
cmd.Flags().Int64VarP(&info.DurationSeconds, "validity-period", "", 900, "Specify validity period in seconds, must be longer than 1 mintutes and shorter than 2 hours")
cmd.Flags().StringVarP(&info.OutputPath, "output", "", "", "Specify path to save output")
return cmd
}

var listShareCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.ListShareInfo{}
var cmd = &cobra.Command{
Use: "share-ls <Link>",
Short: "List shared files",
Run: func(cmd *cobra.Command, args []string) {
cfg.CmdCfg.CmdId = docs.ShareLsType
if len(args) > 0 {
info.LinkURL = args[0]
}
operations.ListShare(cfg, info)
},
}
cmd.Flags().StringVarP(&info.ExtractCode, "extract-code", "", "", "Specify extract code for the share, must consist of 6 alphabets and numbers")
cmd.Flags().StringVarP(&info.Prefix, "prefix", "p", "", "list the shared directory with this prefix if set")
cmd.Flags().Int64VarP(&info.Limit, "limit", "n", 0, "max count of items to output")
cmd.Flags().StringVarP(&info.Marker, "marker", "m", "", "list marker")
return cmd
}

var copyShareCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.CopyShareInfo{}
var cmd = &cobra.Command{
Use: "share-cp <Link> --to=<ToPath>",
Short: "Copy shared files",
Run: func(cmd *cobra.Command, args []string) {
cfg.CmdCfg.CmdId = docs.ShareCpType
if len(args) > 0 {
info.LinkURL = args[0]
}
operations.CopyShare(cfg, info)
},
}
cmd.Flags().StringVarP(&info.ExtractCode, "extract-code", "", "", "Specify extract code for the share, must consist of 6 alphabets and numbers")
cmd.Flags().StringVarP(&info.FromPath, "from", "", "", "copy from path")
cmd.Flags().StringVarP(&info.ToPath, "to", "", "", "copy to path")
cmd.Flags().BoolVarP(&info.Recursive, "recursive", "r", false, "copy directories recursively")
return cmd
}

func init() {
registerLoader(shareCmdLoader)
}

func shareCmdLoader(superCmd *cobra.Command, cfg *iqshell.Config) {
superCmd.AddCommand(
createShareCmdBuilder(cfg),
listShareCmdBuilder(cfg),
copyShareCmdBuilder(cfg),
)
}
4 changes: 4 additions & 0 deletions cmd/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ var upload2CmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
cmd.Flags().StringVar(&info.SkipFixedStrings, "skip-fixed-strings", "", "skip files with the fixed string in the name")
cmd.Flags().StringVar(&info.SkipSuffixes, "skip-suffixes", "", "skip files with these suffixes")
cmd.Flags().StringVar(&info.UpHost, "up-host", "", "upload host")
cmd.Flags().BoolVarP(&info.Accelerate, "accelerate", "", false, "enable uploading acceleration")
cmd.Flags().StringVar(&info.RecordRoot, "record-root", "", "record root dir, and will save record info to the dir(db and log), default <UserRoot>/.qshell")
cmd.Flags().StringVar(&LogFile, "log-file", "", "log file")
cmd.Flags().StringVar(&LogLevel, "log-level", "debug", "log level")
Expand Down Expand Up @@ -146,6 +147,7 @@ var syncCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
cmd.Flags().BoolVarP(&info.UseResumeV2, "resumable-api-v2", "", false, "use resumable upload v2 APIs to upload")
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.Flags().StringVarP(&info.UpHost, "up-host", "u", "", "upload host")
cmd.Flags().BoolVarP(&info.Accelerate, "accelerate", "", false, "enable uploading acceleration")

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, 4:ARCHIVE_IR storage")
cmd.Flags().IntVarP(&info.FileType, "storage", "s", 0, "set storage type of file, same to --file-type")
Expand Down Expand Up @@ -203,6 +205,7 @@ var formUploadCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
_ = cmd.Flags().MarkDeprecated("storage", "use --file-type instead") // 废弃 storage

cmd.Flags().StringVarP(&info.UpHost, "up-host", "u", "", "uphost")
cmd.Flags().BoolVarP(&info.Accelerate, "accelerate", "", false, "enable uploading acceleration")

cmd.Flags().StringVarP(&info.Policy.EndUser, "end-user", "", "", "Owner identification")
cmd.Flags().StringVarP(&info.Policy.CallbackURL, "callback-urls", "l", "", "upload callback urls, separated by comma")
Expand Down Expand Up @@ -262,6 +265,7 @@ var resumeUploadCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {

cmd.Flags().IntVarP(&info.ResumeWorkerCount, "worker", "c", 3, "worker count")
cmd.Flags().StringVarP(&info.UpHost, "up-host", "u", "", "uphost")
cmd.Flags().BoolVarP(&info.Accelerate, "accelerate", "", false, "enable uploading acceleration")

cmd.Flags().StringVarP(&info.Policy.EndUser, "end-user", "", "", "Owner identification")
cmd.Flags().StringVarP(&info.Policy.CallbackURL, "callback-urls", "l", "", "upload callback urls, separated by comma")
Expand Down
12 changes: 12 additions & 0 deletions docs/create-share.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package docs

import _ "embed"

//go:embed create-share.md
var createShareDocument string

const CreateShareType = "create-share"

func init() {
addCmdDocumentInfo(CreateShareType, createShareDocument)
}
42 changes: 42 additions & 0 deletions docs/create-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 简介
`create-share` 命令为需要分享的目录创建授权链接。

# 格式
```
qshell create-share [kodo://]<Bucket>/<Prefix>
```

# 帮助文档
可以在命令行输入如下命令获取帮助文档:
```
// 简单描述
$ qshell create-share -h
// 详细文档(此文档)
$ qshell create-share --doc
```

# 鉴权
需要使用 `qshell account` 或者 `qshell user add` 命令设置鉴权信息 `AccessKey`, `SecretKey``Name`

# 参数
- Bucket: 空间名称【必选】
- Prefix: 前缀【必选】

# 选项
- --extract-code: 提取码,只能包含六位大小写字母或者数字,如果不填写,将会自动生成。【可选】
- --validity-period: 有效时间,如果不填写,默认为 15 分钟。【可选】
- --output: 保存路径,以 JSON 格式保存输出内容,如果不填写,则直接以文本形式输出。【可选】

# 示例
```
$ qshell create-share kodo://bucketname/prefix
Link:
http://portal.qiniu.com/kodo-shares/verify?id=AGQEKDRxBBjbGmsKduQS9oFx59rz&token=qhtbC5YmDCO-WiPriuoCG_t4hZ1LboSOtRYSJXo_%3A9uJY8FiNrKjNrt4MpBx547jlgwr8aes15z5i8VY6l5SU6ga2IKWDBSGTv1jo-rOocklE7QqApzG6okJktZ36umLoqv9x1kuo5fNmgasLXowyTuHIM3kXsaV_DoXmvQsGr5ol6j4RtrmLcKdtXhpkGH8MfSjEgRV91Bx_Q_mSwpJ1028p8yZCSad_QOu_kSPxzeLZmWlUpAtO2oEXdbMTBxhTCH_3awCgqkgoogi0FQGP4zHxeFr0n3vj69DpmWqe6DiYbYLivCuU0kOF5Khv4I6-w6vjjdY
Extract Code:
wp7gqc
Expire:
2024-10-09 10:44:41 +0000
$ qshell create-share --output=share.json kodo://bucketname/prefix
```
7 changes: 4 additions & 3 deletions docs/fput.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ qshell fput [--overwrite] [--callback-urls <CallbackUrls>] [--callback-host <Cal
可以在命令行输入如下命令获取帮助文档:
```
// 简单描述
$ qshell fput -h
$ qshell fput -h
// 详细文档(此文档)
$ qshell fput --doc
Expand All @@ -27,8 +27,9 @@ $ qshell fput --doc
- Bucket:空间名,可以为公开空间或私有空间【必选】
- Key:文件保存在七牛空间的名称 【必选】
- LocalFile:本地文件的路径【必选】

# 选项
- --accelerate:启用上传加速。【可选】
- --overwrite:是否覆盖空间已有文件,默认为 `false`。 【可选】
- -t/--mimetype:指定文件的 MimeType。 【可选】
- --file-type:文件存储类型,默认为 `0`(标准存储),`1` 为低频存储,`2` 为归档存储,`3` 为深度归档存储,`4` 为归档直读存储。 【可选】
Expand All @@ -52,7 +53,7 @@ $ qshell fput --doc
2) 检查 Key 扩展名;
3) 侦测内容。
3. 设为 -1 值,无论上传端指定了何值直接使用该值。
```
```
- --traffic-limit:上传请求单链接速度限制,控制客户端带宽占用。限速值取值范围为 819200 ~ 838860800,单位为 bit/s。【可选】


Expand Down
Loading

0 comments on commit 8afdceb

Please sign in to comment.