Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.18.0
## 调整
1. 分片上传默认使用 v2 接口

# 2.17.0
## 新增
1. 支持智能分层
Expand Down
4 changes: 2 additions & 2 deletions cmd/ali.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
)

var aliListBucketCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = ali.ListBucketInfo{}
var cmd = &cobra.Command{
info := ali.ListBucketInfo{}
cmd := &cobra.Command{
Use: "alilistbucket <DataCenter> <Bucket> <AccessKeyId> <AccessKeySecret> [Prefix] <ListBucketResultFile>",
Short: "List all the file in the bucket of aliyun oss by prefix",
Run: func(cmd *cobra.Command, args []string) {
Expand Down
3 changes: 2 additions & 1 deletion cmd/autocompletion.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package cmd

import (
"bytes"
"os"

"github.com/qiniu/qshell/v2/iqshell"
"github.com/spf13/cobra"
"os"
)

func completeCmdBuilder(superCmd *cobra.Command, cfg *iqshell.Config) *cobra.Command {
Expand Down
20 changes: 10 additions & 10 deletions cmd/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
)

var domainsCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.ListDomainInfo{}
var cmd = &cobra.Command{
info := operations.ListDomainInfo{}
cmd := &cobra.Command{
Use: "domains <Bucket>",
Short: "Get all domains of the bucket",
Run: func(cmd *cobra.Command, args []string) {
Expand All @@ -27,8 +27,8 @@ var domainsCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
}

var bucketCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.GetBucketInfo{}
var cmd = &cobra.Command{
info := operations.GetBucketInfo{}
cmd := &cobra.Command{
Use: "bucket <Bucket>",
Short: "Get bucket info",
Long: `Get bucket info`,
Expand All @@ -44,8 +44,8 @@ var bucketCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
}

var mkBucketCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.CreateInfo{}
var cmd = &cobra.Command{
info := operations.CreateInfo{}
cmd := &cobra.Command{
Use: "mkbucket <Bucket>",
Short: "Create a bucket in region",
Long: `Create a bucket in region;
Expand All @@ -65,7 +65,7 @@ The Bucket name is required to be unique within the scope of the object storage
}

var listBucketCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.ListInfo{
info := operations.ListInfo{
Bucket: "",
Prefix: "",
Marker: "",
Expand All @@ -90,7 +90,7 @@ var listBucketCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
OutputFileMaxSize: 0,
EnableRecord: false,
}
var cmd = &cobra.Command{
cmd := &cobra.Command{
Use: "listbucket <Bucket>",
Short: "List all the files in the bucket",
Long: "List all the files in the bucket to stdout if output file not specified. Each row of data information is displayed in the following order:\n Key\tSize\tHash\tPutTime\tMimeType\tFileType\tEndUser",
Expand All @@ -108,8 +108,8 @@ var listBucketCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
}

var listBucketCmd2Builder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.ListInfo{}
var cmd = &cobra.Command{
info := operations.ListInfo{}
cmd := &cobra.Command{
Use: "listbucket2 <Bucket>",
Short: "List all the files in the bucket",
Long: "List all the files in the bucket to stdout if output file not specified. Each row of data information is displayed in the following order by default:\n Key\tFileSize\tHash\tPutTime\tMimeType\tFileType\tEndUser",
Expand Down
8 changes: 4 additions & 4 deletions cmd/cdn.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
)

var cdnPrefetchCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.PrefetchInfo{}
var cmd = &cobra.Command{
info := operations.PrefetchInfo{}
cmd := &cobra.Command{
Use: "cdnprefetch [-i <ItemListFile>]",
Short: "Batch prefetch the urls in the url list file",
Long: "Batch prefetch the urls in the url list file or from stdin if ItemListFile not specified",
Expand All @@ -28,8 +28,8 @@ var cdnPrefetchCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
}

var cdnRefreshCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.RefreshInfo{}
var cmd = &cobra.Command{
info := operations.RefreshInfo{}
cmd := &cobra.Command{
Use: "cdnrefresh [-i <ItemListFile>]",
Short: "Batch refresh the cdn cache by the url list file",
Long: "Batch refresh the cdn cache by the url list file or from stdin if ItemListFile not specified",
Expand Down
2 changes: 1 addition & 1 deletion cmd/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ have already in local disk and need to skip download or not.`,

var getCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
info := operations.DownloadInfo{}
var cmd = &cobra.Command{
cmd := &cobra.Command{
Use: "get <Bucket> <Key>",
Short: "Download a single file from bucket",
Run: func(cmd *cobra.Command, args []string) {
Expand Down
8 changes: 4 additions & 4 deletions cmd/fop.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
)

var preFopStatusCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.PreFopStatusInfo{}
var cmd = &cobra.Command{
info := operations.PreFopStatusInfo{}
cmd := &cobra.Command{
Use: "prefop <PersistentId>",
Short: "Query the pfop status",
Run: func(cmd *cobra.Command, args []string) {
Expand All @@ -27,8 +27,8 @@ var preFopStatusCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
}

var pfopCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.PfopInfo{}
var cmd = &cobra.Command{
info := operations.PfopInfo{}
cmd := &cobra.Command{
Use: "pfop <Bucket> <Key> <fopCommand>",
Short: "Issue a request to process file in bucket",
Run: func(cmd *cobra.Command, args []string) {
Expand Down
8 changes: 4 additions & 4 deletions cmd/m3u8.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
)

var m3u8ReplaceDomainCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.ReplaceDomainInfo{}
var cmd = &cobra.Command{
info := operations.ReplaceDomainInfo{}
cmd := &cobra.Command{
Use: "m3u8replace <Bucket> <M3u8Key> [<NewDomain>]",
Short: "Replace m3u8 domain in the playlist",
Run: func(cmd *cobra.Command, args []string) {
Expand All @@ -33,8 +33,8 @@ var m3u8ReplaceDomainCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
}

var m3u8DeleteCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.DeleteInfo{}
var cmd = &cobra.Command{
info := operations.DeleteInfo{}
cmd := &cobra.Command{
Use: "m3u8delete <Bucket> <M3u8Key>",
Short: "Delete m3u8 playlist and the slices it references",
Run: func(cmd *cobra.Command, args []string) {
Expand Down
8 changes: 4 additions & 4 deletions cmd/match.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
)

var matchCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.MatchInfo{}
var cmd = &cobra.Command{
info := operations.MatchInfo{}
cmd := &cobra.Command{
Use: "match <Bucket> <Key> <LocalFile>",
Short: "Verify that the local file matches the Qiniu cloud storage file",
Run: func(cmd *cobra.Command, args []string) {
Expand All @@ -30,8 +30,8 @@ var matchCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
}

var batchMatchCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.BatchMatchInfo{}
var cmd = &cobra.Command{
info := operations.BatchMatchInfo{}
cmd := &cobra.Command{
Use: "batchmatch <Bucket> <LocalFileDir>",
Short: "Batch Verify that the local file matches the Qiniu cloud storage file",
Run: func(cmd *cobra.Command, args []string) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ var rootCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
}

func Execute() {
var cfg = &iqshell.Config{
cfg := &iqshell.Config{
Document: false,
DebugEnable: false,
DDebugEnable: false,
Expand Down
62 changes: 31 additions & 31 deletions cmd/rs.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
)

var statCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.StatusInfo{}
var cmd = &cobra.Command{
info := operations.StatusInfo{}
cmd := &cobra.Command{
Use: "stat <Bucket> <Key>",
Short: "Get the basic info of a remote file",
Run: func(cmd *cobra.Command, args []string) {
Expand All @@ -28,8 +28,8 @@ var statCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
}

var forbiddenCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.ForbiddenInfo{}
var cmd = &cobra.Command{
info := operations.ForbiddenInfo{}
cmd := &cobra.Command{
Use: "forbidden <Bucket> <Key>",
Short: "Forbidden file in qiniu bucket",
Long: "Forbidden object in qiniu bucket, when used with -r option, unforbidden the object",
Expand All @@ -49,8 +49,8 @@ var forbiddenCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
}

var deleteCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.DeleteInfo{}
var cmd = &cobra.Command{
info := operations.DeleteInfo{}
cmd := &cobra.Command{
Use: "delete <Bucket> <Key>",
Short: "Delete a remote file in the bucket",
Run: func(cmd *cobra.Command, args []string) {
Expand All @@ -68,8 +68,8 @@ var deleteCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
}

var changeLifecycleCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = &operations.ChangeLifecycleInfo{}
var cmd = &cobra.Command{
info := &operations.ChangeLifecycleInfo{}
cmd := &cobra.Command{
Use: "chlifecycle <Bucket> <Key> [--to-ia-after-days <ToIAAfterDays>] [--to-archive-after-days <ToArchiveAfterDays>] [--to-deep-archive-after-days <ToDeepArchiveAfterDays>] [--to-intelligent-tiering-after-days <ToIntelligentTieringAfterDays>] [--delete-after-days <DeleteAfterDays>]",
Short: "Set the lifecycle of a file.",
Long: `Set the lifecycle of a file. Lifecycle value must great than or equal to -1, unit: day.
Expand Down Expand Up @@ -98,8 +98,8 @@ var changeLifecycleCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
}

var deleteAfterCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.DeleteAfterInfo{}
var cmd = &cobra.Command{
info := operations.DeleteAfterInfo{}
cmd := &cobra.Command{
Use: "expire <Bucket> <Key> <DeleteAfterDays>",
Short: "Set the deleteAfterDays of a file. DeleteAfterDays:great than or equal to 0, 0: cancel expiration time, unit: day",
Run: func(cmd *cobra.Command, args []string) {
Expand All @@ -120,8 +120,8 @@ var deleteAfterCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
}

var moveCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.MoveInfo{}
var cmd = &cobra.Command{
info := operations.MoveInfo{}
cmd := &cobra.Command{
Use: "move <SrcBucket> <SrcKey> <DestBucket> [-k <DestKey>]",
Short: "Move/Rename a file and save in bucket",
Run: func(cmd *cobra.Command, args []string) {
Expand Down Expand Up @@ -149,8 +149,8 @@ var moveCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
}

var renameCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.RenameInfo{}
var cmd = &cobra.Command{
info := operations.RenameInfo{}
cmd := &cobra.Command{
Use: "rename <SrcBucket> <SrcKey> <DestKey>",
Short: "Make a rename of a file and save in the bucket",
Example: `rename A.png(bucket:bucketA key:A.png) to B.png(bucket:bucketA key:B.png):
Expand Down Expand Up @@ -180,8 +180,8 @@ you can check if B.png has exists by:
}

var copyCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.CopyInfo{}
var cmd = &cobra.Command{
info := operations.CopyInfo{}
cmd := &cobra.Command{
Use: "copy <SrcBucket> <SrcKey> <DestBucket> [-k <DestKey>]",
Short: "Make a copy of a file and save in bucket",
Example: `copy A.png(bucket:bucketA key:A.png) to B.png(bucket:bucketB key:B.png):
Expand Down Expand Up @@ -211,8 +211,8 @@ you can check if B.png has exists by:
}

var changeMimeCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.ChangeMimeInfo{}
var cmd = &cobra.Command{
info := operations.ChangeMimeInfo{}
cmd := &cobra.Command{
Use: "chgm <Bucket> <Key> <NewMimeType>",
Short: "Change the mime type of a file",
Example: `change mimetype of A.png(bucket:bucketA key:A.png) to image/jpeg
Expand All @@ -237,8 +237,8 @@ and you can check result by command:
}

var changeTypeCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.ChangeTypeInfo{}
var cmd = &cobra.Command{
info := operations.ChangeTypeInfo{}
cmd := &cobra.Command{
Use: "chtype <Bucket> <Key> <FileType>",
Short: "Change the file type of a file",
Long: `Change the file type of a file, file type must be one of 0, 1, 2, 3.
Expand Down Expand Up @@ -270,8 +270,8 @@ and you can check result by command:
}

var restoreArCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.RestoreArchiveInfo{}
var cmd = &cobra.Command{
info := operations.RestoreArchiveInfo{}
cmd := &cobra.Command{
Use: "restorear <Bucket> <Key> <FreezeAfterDays>",
Short: `Unfreeze archive file and file freeze after <FreezeAfterDays> days, <FreezeAfterDays> value should be between 1 and 7, include 1 and 7`,
Run: func(cmd *cobra.Command, args []string) {
Expand All @@ -293,8 +293,8 @@ var restoreArCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
}

var privateUrlCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.PrivateUrlInfo{}
var cmd = &cobra.Command{
info := operations.PrivateUrlInfo{}
cmd := &cobra.Command{
Use: "privateurl <PublicUrl> [<Deadline>]",
Short: "Create private resource access url",
Run: func(cmd *cobra.Command, args []string) {
Expand All @@ -312,8 +312,8 @@ var privateUrlCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
}

var saveAsCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.SaveAsInfo{}
var cmd = &cobra.Command{
info := operations.SaveAsInfo{}
cmd := &cobra.Command{
Use: "saveas <PublicUrlWithFop> <SaveBucket> <SaveKey>",
Short: "Create a resource access url with fop and saveas",
Run: func(cmd *cobra.Command, args []string) {
Expand All @@ -334,8 +334,8 @@ var saveAsCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
}

var mirrorUpdateCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.MirrorUpdateInfo{}
var cmd = &cobra.Command{
info := operations.MirrorUpdateInfo{}
cmd := &cobra.Command{
Use: "mirrorupdate <Bucket> <Key>",
Short: "Fetch and update the file in bucket using mirror storage",
Run: func(cmd *cobra.Command, args []string) {
Expand All @@ -353,8 +353,8 @@ var mirrorUpdateCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
}

var prefetchCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info = operations.MirrorUpdateInfo{}
var cmd = &cobra.Command{
info := operations.MirrorUpdateInfo{}
cmd := &cobra.Command{
Use: "prefetch <Bucket> <Key>",
Short: "Fetch and update the file in bucket using mirror storage",
Run: func(cmd *cobra.Command, args []string) {
Expand All @@ -373,7 +373,7 @@ var prefetchCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {

var fetchCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
var info operations.FetchInfo
var cmd = &cobra.Command{
cmd := &cobra.Command{
Use: "fetch <RemoteResourceUrl> <Bucket> [-k <Key>]",
Short: "Fetch a remote resource by url and save in bucket",
Run: func(cmd *cobra.Command, args []string) {
Expand Down
Loading