adds flag coalescing to argparser
adds handling of inlined args to call tools fixes terminal layout clearing troubles
This commit is contained in:
@@ -4,25 +4,9 @@ import { callWithArgPrompt } from "util/call.ts";
|
||||
import { TerminalBlock } from "../cli/TerminalLayout.ts";
|
||||
import { forceArgs } from "../cli/forceArgs.ts";
|
||||
import { colorize } from "../cli/style.ts";
|
||||
import { cliLog, cliPrompt } from "../cli/prompts.ts";
|
||||
import { cliAlert, cliLog, cliPrompt } from "../cli/prompts.ts";
|
||||
import { multiSelectMenuInteractive } from "../cli/selectMenu.ts";
|
||||
|
||||
// const thing = PDFAcroField.prototype.getFullyQualifiedName;
|
||||
// PDFAcroField.prototype.getFullyQualifiedName = function () {
|
||||
// const name = thing.call(this)
|
||||
// // if (name?.includes('langauge'))
|
||||
// console.log(name)
|
||||
// return name;
|
||||
// }
|
||||
|
||||
// const thing = PDFHexString.prototype.copyBytesInto
|
||||
// PDFHexString.prototype.copyBytesInto = function (buffer: Uint8Array, offset: number) {
|
||||
// console.log((this as any).value)
|
||||
|
||||
// const result = thing.call(this, buffer, offset)
|
||||
// return result;
|
||||
// }
|
||||
|
||||
async function renameFields(
|
||||
path: string,
|
||||
pattern: string | RegExp,
|
||||
@@ -48,29 +32,10 @@ async function renameFields(
|
||||
if (mName) {
|
||||
changesMade = true;
|
||||
cField.dict.set(PDFName.of("T"), PDFString.of(mName));
|
||||
// console.log(cField.getPartialName())
|
||||
}
|
||||
}
|
||||
cField = cField.getParent();
|
||||
// console.log(cField?.getPartialName())
|
||||
}
|
||||
console.log(field.getName());
|
||||
// const newName = name.replace(pattern, change);
|
||||
// console.log("Change to: %c" + newName, "color: yellow");
|
||||
// if (confirm('Ok?')) {
|
||||
// let parent = field.acroField.getParent();
|
||||
// field.acroField.setPartialName(segments.pop())
|
||||
// while (parent && segments.length) {
|
||||
// console.log(parent.getPartialName())
|
||||
// parent.setPartialName(segments.pop())
|
||||
// parent = parent.getParent();
|
||||
// }
|
||||
// changesMade = true;
|
||||
// console.log(field.getName())
|
||||
// // dict.set(PDFName.of("T"), PDFHexString.fromText(newName))
|
||||
// console.log("%cDone!", "color: lime")
|
||||
// }
|
||||
// break;
|
||||
}
|
||||
}
|
||||
if (changesMade) {
|
||||
@@ -123,8 +88,8 @@ class RenameFields implements ITool {
|
||||
}
|
||||
|
||||
help(standalone = false) {
|
||||
cliLog(
|
||||
"Usage: renamefields <pdfPath> <pattern> <change>",
|
||||
cliAlert(
|
||||
"Usage: rename-fields <pdfPath> <pattern> <change>\n",
|
||||
standalone ? undefined : this.block,
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user