mirror of
https://github.com/tickstep/aliyunpan.git
synced 2025-01-23 14:32:14 +08:00
add prompt for sync command
This commit is contained in:
parent
21770fec89
commit
8ae323eaa6
@ -135,7 +135,8 @@ func (f *FileActionTaskManager) getPanPathFromLocalPath(localPath string) string
|
||||
localRootPath := path.Clean(strings.ReplaceAll(f.task.LocalFolderPath, "\\", "/"))
|
||||
|
||||
relativePath := strings.TrimPrefix(localPath, localRootPath)
|
||||
return path.Join(path.Clean(f.task.PanFolderPath), relativePath)
|
||||
panPath := path.Join(path.Clean(f.task.PanFolderPath), relativePath)
|
||||
return strings.ReplaceAll(panPath, "\\", "/")
|
||||
}
|
||||
|
||||
// getLocalPathFromPanPath 通过网盘文件路径获取对应的本地文件的对应路径
|
||||
@ -551,6 +552,15 @@ func (f *FileActionTaskManager) fileActionTaskExecutor(ctx context.Context) {
|
||||
if uploadWaitGroup.Parallel() == 0 && downloadWaitGroup.Parallel() == 0 { // 如果也没有进行中的异步任务
|
||||
f.setExecuteLoopFlag(true)
|
||||
logger.Verboseln("file execute task is finish, exit normally")
|
||||
prompt := ""
|
||||
if f.task.Mode == UploadOnly {
|
||||
prompt = "完成全部文件的同步上传,等待下一次扫描"
|
||||
} else if f.task.Mode == UploadOnly {
|
||||
prompt = "完成全部文件的同步下载,等待下一次扫描"
|
||||
} else {
|
||||
prompt = "完成全部文件的同步,等待下一次扫描"
|
||||
}
|
||||
PromptOutput(prompt)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -442,6 +442,7 @@ func (t *SyncTask) scanLocalFile(ctx context.Context) {
|
||||
logger.Verboseln("start scan local file process at ", utils.NowTimeStr())
|
||||
t.SetScanLoopFlag(false)
|
||||
t.fileActionTaskManager.StartFileActionTaskExecutor()
|
||||
PromptOutput("开始进行文件扫描...")
|
||||
}
|
||||
|
||||
obj := folderQueue.Pop()
|
||||
@ -666,6 +667,7 @@ func (t *SyncTask) scanPanFile(ctx context.Context) {
|
||||
logger.Verboseln("start scan pan file process at ", utils.NowTimeStr())
|
||||
t.SetScanLoopFlag(false)
|
||||
t.fileActionTaskManager.StartFileActionTaskExecutor()
|
||||
PromptOutput("开始进行文件扫描...")
|
||||
}
|
||||
obj := folderQueue.Pop()
|
||||
if obj == nil {
|
||||
|
@ -1,6 +1,8 @@
|
||||
package syncdrive
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/tickstep/aliyunpan/internal/utils"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path"
|
||||
@ -33,3 +35,9 @@ func IsSymlinkFile(file fs.FileInfo) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func PromptOutput(msg string) {
|
||||
if LogPrompt {
|
||||
fmt.Println("[" + utils.NowTimeStr() + "] " + msg)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user