mirror of
https://github.com/tickstep/aliyunpan.git
synced 2025-01-23 22:42:15 +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, "\\", "/"))
|
localRootPath := path.Clean(strings.ReplaceAll(f.task.LocalFolderPath, "\\", "/"))
|
||||||
|
|
||||||
relativePath := strings.TrimPrefix(localPath, localRootPath)
|
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 通过网盘文件路径获取对应的本地文件的对应路径
|
// getLocalPathFromPanPath 通过网盘文件路径获取对应的本地文件的对应路径
|
||||||
@ -551,6 +552,15 @@ func (f *FileActionTaskManager) fileActionTaskExecutor(ctx context.Context) {
|
|||||||
if uploadWaitGroup.Parallel() == 0 && downloadWaitGroup.Parallel() == 0 { // 如果也没有进行中的异步任务
|
if uploadWaitGroup.Parallel() == 0 && downloadWaitGroup.Parallel() == 0 { // 如果也没有进行中的异步任务
|
||||||
f.setExecuteLoopFlag(true)
|
f.setExecuteLoopFlag(true)
|
||||||
logger.Verboseln("file execute task is finish, exit normally")
|
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
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -442,6 +442,7 @@ func (t *SyncTask) scanLocalFile(ctx context.Context) {
|
|||||||
logger.Verboseln("start scan local file process at ", utils.NowTimeStr())
|
logger.Verboseln("start scan local file process at ", utils.NowTimeStr())
|
||||||
t.SetScanLoopFlag(false)
|
t.SetScanLoopFlag(false)
|
||||||
t.fileActionTaskManager.StartFileActionTaskExecutor()
|
t.fileActionTaskManager.StartFileActionTaskExecutor()
|
||||||
|
PromptOutput("开始进行文件扫描...")
|
||||||
}
|
}
|
||||||
|
|
||||||
obj := folderQueue.Pop()
|
obj := folderQueue.Pop()
|
||||||
@ -666,6 +667,7 @@ func (t *SyncTask) scanPanFile(ctx context.Context) {
|
|||||||
logger.Verboseln("start scan pan file process at ", utils.NowTimeStr())
|
logger.Verboseln("start scan pan file process at ", utils.NowTimeStr())
|
||||||
t.SetScanLoopFlag(false)
|
t.SetScanLoopFlag(false)
|
||||||
t.fileActionTaskManager.StartFileActionTaskExecutor()
|
t.fileActionTaskManager.StartFileActionTaskExecutor()
|
||||||
|
PromptOutput("开始进行文件扫描...")
|
||||||
}
|
}
|
||||||
obj := folderQueue.Pop()
|
obj := folderQueue.Pop()
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package syncdrive
|
package syncdrive
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/tickstep/aliyunpan/internal/utils"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
@ -33,3 +35,9 @@ func IsSymlinkFile(file fs.FileInfo) bool {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func PromptOutput(msg string) {
|
||||||
|
if LogPrompt {
|
||||||
|
fmt.Println("[" + utils.NowTimeStr() + "] " + msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user