fix: field rename skips saves for unmodified files
This commit is contained in:
parent
001b90744b
commit
89a3df17e6
@ -153,6 +153,7 @@ class RenameFields implements ITool {
|
|||||||
const fields = form.getFields();
|
const fields = form.getFields();
|
||||||
|
|
||||||
const foundUpdates: [string, callback][] = [];
|
const foundUpdates: [string, callback][] = [];
|
||||||
|
let changesMade = false;
|
||||||
|
|
||||||
for (const field of fields) {
|
for (const field of fields) {
|
||||||
const name = field.getName();
|
const name = field.getName();
|
||||||
@ -164,6 +165,7 @@ class RenameFields implements ITool {
|
|||||||
`${colorize(name, "red")} -> ${colorize(preview, "green")}`,
|
`${colorize(name, "red")} -> ${colorize(preview, "green")}`,
|
||||||
() => {
|
() => {
|
||||||
applyRename(field, name, patternRegex, toChange);
|
applyRename(field, name, patternRegex, toChange);
|
||||||
|
changesMade = true;
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -178,11 +180,15 @@ class RenameFields implements ITool {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changesMade) {
|
||||||
const path = await cliPrompt(
|
const path = await cliPrompt(
|
||||||
"Save to path (or hit enter to keep current):",
|
"Save to path (or hit enter to keep current):",
|
||||||
this.block,
|
this.block,
|
||||||
);
|
);
|
||||||
await savePdf(pdf, path || pdfPath);
|
await savePdf(pdf, path || pdfPath);
|
||||||
|
} else {
|
||||||
|
cliLog("No changes made, skipping", this.block);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user