This commit is contained in:
2025-04-24 21:40:59 -06:00
parent 7d42920dcb
commit 2634f40f2b
7 changed files with 68 additions and 23 deletions

View File

@@ -80,6 +80,22 @@ async function renameFields(
}
}
class RenameFields implements ITool {
name = "renamefields";
description = "Renames fields in a PDF form";
help() {
console.log("Usage: renamefields <pdfPath> <pattern> <change>");
}
async run(pdfPath: string = "", pattern: string = "", change: string = "") {
await callWithArgPrompt(renameFields, [
["Please provide path to PDF:", (p) => !!p && p.endsWith(".pdf")],
"Please provide search string:",
"Please provide requested change:",
], [pdfPath, pattern, change]);
}
}
export default new RenameFields();
if (import.meta.main) {
// await call(renameFields)
// while (!path || !path.endsWith('.pdf')) path = prompt("Please provide path to PDF:") || '';