command

package
v0.0.0-...-7f85f33 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2022 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Overview

Copyright (c) 2020 tickstep & chenall

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2020 tickstep.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2020 tickstep.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2020 tickstep.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2020 tickstep.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2020 tickstep.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2020 tickstep.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2020 tickstep.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2020 tickstep.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2020 tickstep.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2020 tickstep.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2020 tickstep.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2020 tickstep.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2020 tickstep.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2020 tickstep.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2020 tickstep.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2020 tickstep.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2020 tickstep.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2020 tickstep.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2020 tickstep.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2020 tickstep.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	// DefaultUploadMaxAllParallel 默认所有文件并发上传数量,即可以同时并发上传多少个文件
	DefaultUploadMaxAllParallel = 1
	// DefaultUploadMaxRetry 默认上传失败最大重试次数
	DefaultUploadMaxRetry = 3
)
View Source
const (
	DefaultSaveToPanPath = "/cloudpan189-go"
)

Variables

View Source
var (
	// MaxDownloadRangeSize 文件片段最大值
	MaxDownloadRangeSize = 55 * converter.MB

	// DownloadCacheSize 默认每个线程下载缓存大小
	DownloadCacheSize = 64 * converter.KB
)
View Source
var ErrBadArgs = errors.New("参数错误")
View Source
var ErrNotLogined = errors.New("未登录账号")
View Source
var UploadFlags = []cli.Flag{
	cli.IntFlag{
		Name:  "p",
		Usage: "本次操作文件上传并发数量,即可以同时并发上传多少个文件。0代表跟从配置文件设置",
		Value: 0,
	},
	cli.IntFlag{
		Name:  "retry",
		Usage: "上传失败最大重试次数",
		Value: DefaultUploadMaxRetry,
	},
	cli.BoolFlag{
		Name:  "np",
		Usage: "no progress 不展示上传进度条",
	},
	cli.BoolFlag{
		Name:  "ow",
		Usage: "overwrite, 覆盖已存在的同名文件,注意已存在的文件会被移到回收站",
	},
	cli.BoolFlag{
		Name:  "norapid",
		Usage: "不检测秒传",
	},
	cli.StringFlag{
		Name:  "familyId",
		Usage: "家庭云ID",
		Value: "",
	},
	cli.StringSliceFlag{
		Name:  "exn",
		Usage: "exclude name,指定排除的文件夹或者文件的名称,只支持正则表达式。支持同时排除多个名称,每一个名称就是一个exn参数",
		Value: nil,
	},
}

Functions

func Backup

func Backup(c *cli.Context) error

func CmdBackup

func CmdBackup() cli.Command

func CmdCd

func CmdCd() cli.Command

func CmdConfig

func CmdConfig() cli.Command

func CmdCp

func CmdCp() cli.Command

func CmdDownload

func CmdDownload() cli.Command

func CmdExport

func CmdExport() cli.Command

func CmdFamily

func CmdFamily() cli.Command

func CmdImport

func CmdImport() cli.Command

func CmdLogin

func CmdLogin() cli.Command

func CmdLoglist

func CmdLoglist() cli.Command

func CmdLogout

func CmdLogout() cli.Command

func CmdLs

func CmdLs() cli.Command

func CmdMkdir

func CmdMkdir() cli.Command

func CmdMv

func CmdMv() cli.Command

func CmdPwd

func CmdPwd() cli.Command

func CmdQuota

func CmdQuota() cli.Command

func CmdRapidUpload

func CmdRapidUpload() cli.Command

func CmdRecycle

func CmdRecycle() cli.Command

func CmdRename

func CmdRename() cli.Command

func CmdRm

func CmdRm() cli.Command

func CmdShare

func CmdShare() cli.Command

func CmdSign

func CmdSign() cli.Command

func CmdSu

func CmdSu() cli.Command

func CmdTool

func CmdTool() cli.Command

func CmdUpload

func CmdUpload() cli.Command

func CmdWho

func CmdWho() cli.Command

func CmdXcp

func CmdXcp() cli.Command

func DelRemoteFileFromDB

func DelRemoteFileFromDB(familyId int64, localDir string, savePath string, flagSync bool)

删除那些本地不存在而网盘存在的网盘文件 默认使用本地数据库判断,如果 flagSync 为 true 则遍历网盘文件列表进行判断(速度较慢)。

func GetActivePanClient

func GetActivePanClient() *cloudpan.PanClient

func GetActiveUser

func GetActiveUser() *config.PanUser

func GetAppFileInfoByPaths

func GetAppFileInfoByPaths(familyId int64, paths ...string) (fileInfoList []*cloudpan.AppFileEntity, failedPaths []string, error error)

GetFileInfoByPaths 获取指定文件路径的文件详情信息

func GetFamilyCloudMark

func GetFamilyCloudMark(familyId int64) string

func GetFileInfoByPaths

func GetFileInfoByPaths(paths ...string) (fileInfoList []*cloudpan.FileEntity, failedPaths []string, error error)

GetFileInfoByPaths 获取指定文件路径的文件详情信息

func IsFamilyCloud

func IsFamilyCloud(familyId int64) bool

func OpenSyncDb

func OpenSyncDb(path string) (panupload.SyncDb, error)

func RunChangeDirectory

func RunChangeDirectory(familyId int64, targetPath string)

func RunCopy

func RunCopy(paths ...string)

RunCopy 执行复制文件/目录

func RunDownload

func RunDownload(paths []string, options *DownloadOptions)

RunDownload 执行下载网盘内文件

func RunExportFiles

func RunExportFiles(familyId int64, overwrite bool, panPaths []string, saveLocalFilePath string)

func RunGetUserInfo

func RunGetUserInfo() (userInfo *cloudpan.UserInfo, error error)

func RunImportFiles

func RunImportFiles(familyId int64, overwrite bool, panSavePath, localFilePath string)

func RunLogin

func RunLogin(username, password string) (usernameStr, passwordStr string, webToken cloudpan.WebLoginToken, appToken cloudpan.AppLoginToken, error error)

func RunLs

func RunLs(familyId int64, targetPath string, lsOptions *LsOptions, orderBy cloudpan.OrderBy, orderSort cloudpan.OrderSort)

func RunMkdir

func RunMkdir(familyId int64, name string)

func RunMove

func RunMove(familyId int64, paths ...string)

RunMove 执行移动文件/目录

func RunRapidUpload

func RunRapidUpload(familyId int64, isOverwrite bool, panFilePath string, md5Str string, length int64)

func RunRecycleClear

func RunRecycleClear()

RunRecycleClear 清空回收站

func RunRecycleDelete

func RunRecycleDelete(fidStrList ...string)

RunRecycleDelete 执行删除回收站文件或目录

func RunRecycleList

func RunRecycleList(page int)

RunRecycleList 执行列出回收站文件列表

func RunRecycleRestore

func RunRecycleRestore(fidStrList ...string)

RunRecycleRestore 执行还原回收站文件或目录

func RunRemove

func RunRemove(familyId int64, paths ...string)

RunRemove 执行 批量删除文件/目录

func RunRename

func RunRename(familyId int64, oldName string, newName string)

func RunShareCancel

func RunShareCancel(shareIDs []int64)

RunShareCancel 执行取消分享

func RunShareList

func RunShareList(page int)

RunShareList 执行列出分享列表

func RunShareSave

func RunShareSave(shareUrl, savePanDirPath string)

func RunShareSet

func RunShareSet(paths []string, expiredTime cloudpan.ShareExpiredTime, shareMode cloudpan.ShareMode)

RunShareSet 执行分享

func RunSwitchFamilyList

func RunSwitchFamilyList(targetFamilyId int64)

func RunUpload

func RunUpload(localPaths []string, savePath string, opt *UploadOptions)

RunUpload 执行文件上传

func RunUserSign

func RunUserSign()

func RunXCopy

func RunXCopy(source FileSourceType, familyId int64, paths ...string)

RunXCopy 执行移动文件/目录

func WalkAllFile

func WalkAllFile(dirPath string, walkFn filepath.WalkFunc) error

Types

type DownloadOptions

type DownloadOptions struct {
	IsPrintStatus        bool
	IsExecutedPermission bool
	IsOverwrite          bool
	SaveTo               string
	Parallel             int
	Load                 int
	MaxRetry             int
	NoCheck              bool
	ShowProgress         bool
	FamilyId             int64
}

DownloadOptions 下载可选参数

type FileSourceType

type FileSourceType string
const (
	// 个人云文件
	PersonCloud FileSourceType = "person"

	// 家庭云文件
	FamilyCloud FileSourceType = "family"
)

type ImportExportFileItem

type ImportExportFileItem struct {
	FileMd5    string `json:"md5"`
	FileSize   int64  `json:"size"`
	Path       string `json:"path"`
	LastOpTime string `json:"lastOpTime"`
}

type LocateDownloadOption

type LocateDownloadOption struct {
	FromPan bool
}

LocateDownloadOption 获取下载链接可选参数

type LsOptions

type LsOptions struct {
	Total bool
}

LsOptions 列目录可选项

type QuotaInfo

type QuotaInfo struct {
	// 已使用个人空间大小
	UsedSize int64
	// 个人空间总大小
	Quota int64
}

func RunGetQuotaInfo

func RunGetQuotaInfo() (quotaInfo *QuotaInfo, error error)

type SearchOptions

type SearchOptions struct {
	Total   bool
	Recurse bool
}

SearchOptions 搜索可选项

type UploadOptions

type UploadOptions struct {
	AllParallel   int // 所有文件并发上传数量,即可以同时并发上传多少个文件
	Parallel      int // 单个文件并发上传数量
	MaxRetry      int
	NoRapidUpload bool
	NoSplitFile   bool // 禁用分片上传
	ShowProgress  bool
	IsOverwrite   bool // 覆盖已存在的文件,如果同名文件已存在则移到回收站里
	FamilyId      int64
	ExcludeNames  []string // 排除的文件名,包括文件夹和文件。即这些文件/文件夹不进行上传,支持正则表达式
}

UploadOptions 上传可选项

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL