added replace-all patch type
This commit is contained in:
parent
bb7da3e154
commit
3d08b492ac
5 changed files with 134 additions and 25 deletions
4
main.go
4
main.go
|
@ -155,7 +155,7 @@ func applyPatch(patchPath, rootPath string) error {
|
|||
return fmt.Errorf("patch file must specify output (o:) file")
|
||||
}
|
||||
|
||||
if patchType != "new" && patchType != "copy" {
|
||||
if patchType != "new" && patchType != "copy" && inputFilePath != outputFilePath {
|
||||
err = os.Rename(inputFilePath, outputFilePath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to replace output file: %v", err)
|
||||
|
@ -174,6 +174,8 @@ func applyPatch(patchPath, rootPath string) error {
|
|||
return applyCopyPatch(inputFilePath, outputFilePath)
|
||||
case "marker":
|
||||
return applyMarkerPatch(outputFilePath, modifications)
|
||||
case "replace-all":
|
||||
return applyReplaceAllPatch(rootPath, modifications)
|
||||
default:
|
||||
fmt.Printf("Type not specified defaulting to standard")
|
||||
return applyStandardModifications(outputFilePath, modifications)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue