feat: read bool 更新
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"git.icechen.cn/pkg/wujian_develop_tool/config"
|
||||
"github.com/sergi/go-diff/diffmatchpatch"
|
||||
"os"
|
||||
|
||||
"github.com/fatih/color"
|
||||
@@ -121,6 +122,17 @@ func copyTo(fileName string, toPath string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
toFileContent, err := os.ReadFile(toPath)
|
||||
if err == nil {
|
||||
dmp := diffmatchpatch.New()
|
||||
diffContent := dmp.DiffMain(string(fileContent), string(toFileContent), true)
|
||||
diffString := dmp.DiffToDelta(diffContent)
|
||||
if diffString == "" || util.ReadBoolWithMessage(diffString) {
|
||||
color.Red("跳过文件: %s", fileName)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
toFile, err := os.OpenFile(toPath, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, os.ModePerm)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user