Documentation ¶
Overview ¶
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.
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
- Variables
- func CmdAlbum() cli.Command
- func CmdCd() cli.Command
- func CmdConfig() cli.Command
- func CmdCp() cli.Command
- func CmdDownload() cli.Command
- func CmdDrive() cli.Command
- func CmdLogin() cli.Command
- func CmdLoglist() cli.Command
- func CmdLogout() cli.Command
- func CmdLs() cli.Command
- func CmdMkdir() cli.Command
- func CmdMv() cli.Command
- func CmdPwd() cli.Command
- func CmdQuota() cli.Command
- func CmdRecycle() cli.Command
- func CmdRename() cli.Command
- func CmdRm() cli.Command
- func CmdSave() cli.Command
- func CmdShare() cli.Command
- func CmdSu() cli.Command
- func CmdSync() cli.Command
- func CmdTool() cli.Command
- func CmdTree() cli.Command
- func CmdUpload() cli.Command
- func CmdWho() cli.Command
- func CmdXcp() cli.Command
- func EscapeStr(s string) string
- func ExportCsv(savePath string, data [][]string) bool
- func GetActivePanClient() *config.PanClient
- func GetActiveUser() *config.PanUser
- func GetAllPathFolderByPath(pathStr string) []string
- func NewWebLoginToken(accessToken string, expired int64) aliyunpan_web.WebLoginToken
- func RandomStr(count int) string
- func RefreshOpenTokenInNeed(activeUser *config.PanUser) bool
- func RefreshWebTokenInNeed(activeUser *config.PanUser, deviceName string) bool
- func RunAlbumAddFile(albumName string, filePathList []string, filterOption AlbumFileCategoryOption)
- func RunAlbumCreate(name, description string)
- func RunAlbumDelete(nameList []string)
- func RunAlbumDownloadFile(albumNames []string, options *DownloadOptions)
- func RunAlbumList()
- func RunAlbumListFile(name string)
- func RunAlbumRename(name, newName string)
- func RunAlbumRmFile(name string, nameList []string)
- func RunChangeDirectory(driveId, targetPath string)
- func RunCopy(driveId string, paths ...string)
- func RunDownload(paths []string, options *DownloadOptions)
- func RunLogin() (ticketId string, openapiToken, webapiToken *config.PanClientToken, error error)
- func RunLs(driveId, targetPath string, lsOptions *LsOptions, ...)
- func RunMkdir(driveId, name string)
- func RunMove(driveId string, paths ...string)
- func RunRecycleClear(driveId string)
- func RunRecycleDelete(driveId string, fidStrList ...string)
- func RunRecycleList(driveId string)
- func RunRecycleRestore(driveId string, fidStrList ...string)
- func RunRemove(driveId string, paths ...string)
- func RunRename(driveId string, oldName string, newName string)
- func RunRenameBatch(skipConfirm bool, driveId string, expression, replacement, filePattern string)
- func RunSave(driveId string, args ...string)
- func RunShareCancel(shareIdList []string)
- func RunShareExport(option, saveFilePath string)
- func RunShareList()
- func RunShareSet(modeFlag, driveId string, paths []string, expiredTime string, sharePwd string)
- func RunSwitchDriveList(targetDriveId string)
- func RunSync(defaultTask *syncdrive.SyncTask, cycleMode syncdrive.CycleMode, ...)
- func RunTestShellPattern(driveId string, pattern string)
- func RunTree(driveId, pathStr string, showFullPath, showFileSize bool, ...)
- func RunUpload(localPaths []string, savePath string, opt *UploadOptions)
- func RunXCopy(srcDriveId, dstDriveId string, paths ...string)
- func TryLogin() *config.PanUser
- func UnescapeStr(s string) string
- type AlbumFileCategoryOption
- type DownloadOptions
- type LocateDownloadOption
- type LsOptions
- type QuotaInfo
- type SearchOptions
- type UploadOptions
Constants ¶
const ( // DefaultUploadMaxAllParallel 默认所有文件并发上传数量,即可以同时并发上传多少个文件 DefaultUploadMaxAllParallel = 1 // DefaultUploadMaxRetry 默认上传失败最大重试次数 DefaultUploadMaxRetry = 3 )
Variables ¶
var ( // MaxDownloadRangeSize 文件片段最大值 MaxDownloadRangeSize = 55 * converter.MB // DownloadCacheSize 默认每个线程下载缓存大小 DownloadCacheSize = 64 * converter.KB )
var ( ReloadConfigFunc = func(c *cli.Context) error { err := config.Config.Reload() if err != nil { fmt.Printf("重载配置错误: %s\n", err) } return nil } SaveConfigFunc = func(c *cli.Context) error { saveConfigMutex.Lock() defer saveConfigMutex.Unlock() err := config.Config.Save() if err != nil { fmt.Printf("保存配置错误: %s\n", err) } return nil } )
var ErrBadArgs = errors.New("参数错误")
var ErrNotLogined = errors.New("未登录账号")
var UploadFlags = []cli.Flag{ cli.IntFlag{ Name: "p", Usage: "本次操作文件上传并发数量,即可以同时并发上传多少个文件。0代表跟从配置文件设置(取值范围:1 ~ 20)", Value: 0, }, cli.IntFlag{ Name: "retry", Usage: "上传失败最大重试次数", Value: DefaultUploadMaxRetry, }, cli.IntFlag{ Name: "timeout", Usage: "上传请求超时时间,单位为秒。当遇到网络不好导致上传超时可以尝试调大该值,建议设置30秒以上", }, cli.BoolFlag{ Name: "np", Usage: "no progress 不展示上传进度条", }, cli.BoolFlag{ Name: "ow", Usage: "overwrite, 覆盖已存在的同名文件,注意已存在的文件会被移到回收站", }, cli.BoolFlag{ Name: "skip", Usage: "skip same name, 跳过已存在的同名文件,即使文件内容不一致(不检查SHA1)", }, cli.BoolFlag{ Name: "norapid", Usage: "不检测秒传。跳过费时的SHA1计算直接上传", }, cli.StringFlag{ Name: "driveId", Usage: "网盘ID", Value: "", }, cli.StringSliceFlag{ Name: "exn", Usage: "exclude name,指定排除的文件夹或者文件的名称,只支持正则表达式。支持同时排除多个名称,每一个名称就是一个exn参数", Value: nil, }, cli.IntFlag{ Name: "bs", Usage: "block size,上传分片大小,单位KB。推荐值:1024 ~ 10240。当上传极大单文件时候请适当调高该值", Value: 10240, }, }
Functions ¶
func CmdDownload ¶
func CmdLoglist ¶
func CmdRecycle ¶
func GetActivePanClient ¶
func GetActiveUser ¶
func GetAllPathFolderByPath ¶ added in v0.0.5
func NewWebLoginToken ¶ added in v0.3.0
func NewWebLoginToken(accessToken string, expired int64) aliyunpan_web.WebLoginToken
func RefreshOpenTokenInNeed ¶ added in v0.3.0
RefreshOpenTokenInNeed 刷新 openapi access token
func RefreshWebTokenInNeed ¶ added in v0.3.0
RefreshWebTokenInNeed 刷新 webapi access token
func RunAlbumAddFile ¶ added in v0.1.4
func RunAlbumAddFile(albumName string, filePathList []string, filterOption AlbumFileCategoryOption)
RunAlbumAddFile 增加网盘文件到相簿
func RunAlbumCreate ¶ added in v0.1.4
func RunAlbumCreate(name, description string)
func RunAlbumDelete ¶ added in v0.1.4
func RunAlbumDelete(nameList []string)
func RunAlbumDownloadFile ¶ added in v0.2.8
func RunAlbumDownloadFile(albumNames []string, options *DownloadOptions)
func RunAlbumList ¶ added in v0.1.4
func RunAlbumList()
func RunAlbumListFile ¶ added in v0.1.4
func RunAlbumListFile(name string)
func RunAlbumRename ¶ added in v0.1.4
func RunAlbumRename(name, newName string)
func RunAlbumRmFile ¶ added in v0.1.4
func RunChangeDirectory ¶
func RunChangeDirectory(driveId, targetPath string)
func RunLogin ¶
func RunLogin() (ticketId string, openapiToken, webapiToken *config.PanClientToken, error error)
func RunLs ¶
func RunLs(driveId, targetPath string, lsOptions *LsOptions, orderBy aliyunpan.FileOrderBy, orderDirection aliyunpan.FileOrderDirection)
func RunRecycleDelete ¶
RunRecycleDelete 执行删除回收站文件或目录
func RunRecycleRestore ¶
RunRecycleRestore 执行还原回收站文件或目录
func RunRenameBatch ¶ added in v0.2.5
RunRenameBatch 批量重命名文件
func RunShareExport ¶ added in v0.1.9
func RunShareExport(option, saveFilePath string)
func RunShareSet ¶
RunShareSet 执行分享
func RunSwitchDriveList ¶
func RunSwitchDriveList(targetDriveId string)
func RunTestShellPattern ¶ added in v0.2.4
RunTestShellPattern 执行测试通配符
func RunUpload ¶
func RunUpload(localPaths []string, savePath string, opt *UploadOptions)
RunUpload 执行文件上传
Types ¶
type AlbumFileCategoryOption ¶ added in v0.1.4
type AlbumFileCategoryOption string
var ( ImageOnlyOption AlbumFileCategoryOption = "image" VideoOnlyOption AlbumFileCategoryOption = "video" ImageVideoOnlyOption AlbumFileCategoryOption = "image_video" AllFileOption AlbumFileCategoryOption = "none" )
type DownloadOptions ¶
type DownloadOptions struct { IsPrintStatus bool IsExecutedPermission bool IsOverwrite bool SaveTo string Parallel int // 文件下载最大线程数 SliceParallel int // 单个文件分片下载最大线程数 Load int MaxRetry int NoCheck bool ShowProgress bool DriveId string ExcludeNames []string // 排除的文件名,包括文件夹和文件。即这些文件/文件夹不进行下载,支持正则表达式 IsMultiUserDownload bool // 是否启用多用户联合下载 }
DownloadOptions 下载可选参数
type LocateDownloadOption ¶
type LocateDownloadOption struct {
FromPan bool
}
LocateDownloadOption 获取下载链接可选参数
type QuotaInfo ¶
func RunGetQuotaInfo ¶
type UploadOptions ¶
type UploadOptions struct { AllParallel int // 所有文件并发上传数量,即可以同时并发上传多少个文件 Parallel int // 单个文件并发上传数量 MaxRetry int MaxTimeoutSec int // http请求超时时间,单位秒 NoRapidUpload bool ShowProgress bool IsOverwrite bool // 覆盖已存在的文件,如果同名文件已存在则移到回收站里 IsSkipSameName bool // 跳过已存在的文件,即使文件内容不一致(不检查SHA1) DriveId string ExcludeNames []string // 排除的文件名,包括文件夹和文件。即这些文件/文件夹不进行上传,支持正则表达式 BlockSize int64 // 分片大小 }
UploadOptions 上传可选项