1.0.1 #8
12
CHANGELOG.md
12
CHANGELOG.md
@ -1,6 +1,14 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## 1.0.0 (2025-07-25)
|
## v1.0.1 (2025-07-25)
|
||||||
|
|
||||||
|
<!-- auto-changelog -->
|
||||||
|
|
||||||
|
### Known Issues
|
||||||
|
|
||||||
|
- help flags can cause issues
|
||||||
|
|
||||||
|
## v1.0.0 (2025-07-25)
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
@ -20,7 +28,7 @@
|
|||||||
- ascii art is broken (sad face)
|
- ascii art is broken (sad face)
|
||||||
- banana doesn't work
|
- banana doesn't work
|
||||||
|
|
||||||
## 0.0.0 (never)
|
## v0.0.0 (never)
|
||||||
|
|
||||||
this is just here for a reference to the auto-changelog
|
this is just here for a reference to the auto-changelog
|
||||||
|
|
||||||
|
63
README.md
63
README.md
@ -1,7 +1,16 @@
|
|||||||
# Emma's Simple Form Field Checker
|
# BearMetal PDF Tools
|
||||||
|
|
||||||
Compares a PDF form to a list of CS class files to see if all field names are
|
A collection of tools for working with PDF forms.
|
||||||
present, excluding signature fields.
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Check Code Tool
|
||||||
|
- reads supplied code files to see if form fields are present and represented
|
||||||
|
in a switch statement
|
||||||
|
- Field Rename Tool
|
||||||
|
- provide a search and replace pattern to bulk rename form fields
|
||||||
|
- List Form Fields
|
||||||
|
- Sometimes you just need to see what fields there are
|
||||||
|
|
||||||
## Prereqs
|
## Prereqs
|
||||||
|
|
||||||
@ -20,17 +29,51 @@ Deno >=2.2 (not required if downloading .exe)
|
|||||||
> If you want it to be a global command, create an executables directory and add
|
> If you want it to be a global command, create an executables directory and add
|
||||||
> it to the PATH
|
> it to the PATH
|
||||||
|
|
||||||
|
### Precompiled
|
||||||
|
|
||||||
|
Download the latest release from the
|
||||||
|
[releases page](https://git.cyborggrizzly.com/BearMetal/pdf-tools/releases)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
`checkfields <path to PDF> <comma-separated list of paths to CS class files>`
|
`pdf-tools <tool> <args>` -> `<tool>` is one of the following
|
||||||
-OR- `checkfields` and follow prompts.
|
|
||||||
|
|
||||||
### Output
|
- check-code
|
||||||
|
- field-rename
|
||||||
|
- list-form-fields
|
||||||
|
|
||||||
> All form fields present!
|
## Contributing
|
||||||
|
|
||||||
-OR-
|
Contributions are welcome!
|
||||||
|
|
||||||
> The following field names are not present in the CS code
|
## License
|
||||||
|
|
||||||
> \<list of missing form fields\>
|
GPL 3.0
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### About this project
|
||||||
|
|
||||||
|
BearMetal PDF Tools is a collection of tools made to fix the current state of
|
||||||
|
PDF form editing. Adobe Acrobat is a great tool, but it's not always the easiest
|
||||||
|
to use, nor is it free. It also lacks some features that I find useful, such as
|
||||||
|
bulk renaming of form fields. There's also a lack of powerful, free, and open
|
||||||
|
source tools for PDF editing.
|
||||||
|
|
||||||
|
This project aims to fill that gap by providing a set of tools that can be used
|
||||||
|
to edit PDF forms. The tools are written in Deno, a modern and secure runtime
|
||||||
|
for JavaScript and TypeScript. They are designed to be easy to use and to
|
||||||
|
provide a great user experience.
|
||||||
|
|
||||||
|
The tools are designed to be used in a terminal, and are not designed to be
|
||||||
|
integrated into other applications. They are also not designed to be used as a
|
||||||
|
library, but rather as a command line tool.
|
||||||
|
|
||||||
|
### About BearMetal
|
||||||
|
|
||||||
|
BearMetal is a project that aims to decrapify modern web development. It is a
|
||||||
|
collection of tools, libraries, and resources that aim to make web development
|
||||||
|
more accessible and less intimidating. The project is open source and free to
|
||||||
|
use, and is designed to be used by anyone, regardless of skill level or
|
||||||
|
experience. You can find a list of libraries and tools on
|
||||||
|
[JSR](https://jsr.io/@bearmetal).
|
||||||
|
22
cli/index.ts
22
cli/index.ts
@ -6,8 +6,6 @@ import { selectMenuInteractive } from "./selectMenu.ts";
|
|||||||
import { TerminalBlock, TerminalLayout } from "./TerminalLayout.ts";
|
import { TerminalBlock, TerminalLayout } from "./TerminalLayout.ts";
|
||||||
import { cliAlert, cliLog } from "./prompts.ts";
|
import { cliAlert, cliLog } from "./prompts.ts";
|
||||||
import type { ITool } from "../types.ts";
|
import type { ITool } from "../types.ts";
|
||||||
import { join, toFileUrl } from "@std/path";
|
|
||||||
import { log } from "util/logfile.ts";
|
|
||||||
|
|
||||||
// Register tools here (filename, no extension)
|
// Register tools here (filename, no extension)
|
||||||
const toolRegistry: [string, Promise<{ default: ITool }>][] = [
|
const toolRegistry: [string, Promise<{ default: ITool }>][] = [
|
||||||
@ -23,6 +21,7 @@ export class PdfToolsCli {
|
|||||||
|
|
||||||
private args = ArgParser.parse(Deno.args).setFlagDefs({
|
private args = ArgParser.parse(Deno.args).setFlagDefs({
|
||||||
help: ["-h", "--help"],
|
help: ["-h", "--help"],
|
||||||
|
banana: ["-b", "--banana"],
|
||||||
});
|
});
|
||||||
|
|
||||||
async importTools() {
|
async importTools() {
|
||||||
@ -43,9 +42,7 @@ export class PdfToolsCli {
|
|||||||
|
|
||||||
private async banana() {
|
private async banana() {
|
||||||
const asciiArt = await getAsciiArt("banana");
|
const asciiArt = await getAsciiArt("banana");
|
||||||
const body = this.terminalLayout.getBlock("body");
|
this.closeMessage = colorize(asciiArt, "yellow");
|
||||||
body.clearAll();
|
|
||||||
cliLog(colorize(asciiArt, "yellow"), body);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async help() {
|
private async help() {
|
||||||
@ -64,6 +61,11 @@ export class PdfToolsCli {
|
|||||||
this.terminalLayout.register("title", titleBlock);
|
this.terminalLayout.register("title", titleBlock);
|
||||||
const bodyBlock = new TerminalBlock();
|
const bodyBlock = new TerminalBlock();
|
||||||
this.terminalLayout.register("body", bodyBlock);
|
this.terminalLayout.register("body", bodyBlock);
|
||||||
|
if (this.args.getFlag("banana")) {
|
||||||
|
titleBlock.setFixedHeight(0);
|
||||||
|
await this.banana();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (this.args.getFlag("help") && !this.args.task) {
|
if (this.args.getFlag("help") && !this.args.task) {
|
||||||
await this.help();
|
await this.help();
|
||||||
return;
|
return;
|
||||||
@ -75,12 +77,16 @@ export class PdfToolsCli {
|
|||||||
await this.runTool(toCase(task, "title"));
|
await this.runTool(toCase(task, "title"));
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
this.terminalLayout.clearAll();
|
this.cleanup();
|
||||||
Deno.stdin.setRaw(false);
|
|
||||||
if (this.closeMessage) console.log(this.closeMessage);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private cleanup() {
|
||||||
|
this.terminalLayout.clearAll();
|
||||||
|
Deno.stdin.setRaw(false);
|
||||||
|
if (this.closeMessage) console.log(this.closeMessage);
|
||||||
|
}
|
||||||
|
|
||||||
private async toolMenu() {
|
private async toolMenu() {
|
||||||
const tools = this.tools.keys().toArray();
|
const tools = this.tools.keys().toArray();
|
||||||
const bodyBlock = this.terminalLayout.getBlock("body");
|
const bodyBlock = this.terminalLayout.getBlock("body");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@bearmetal/pdf-tools",
|
"name": "@bearmetal/pdf-tools",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"license": "GPL 3.0",
|
"license": "GPL 3.0",
|
||||||
"tasks": {
|
"tasks": {
|
||||||
"dev": "deno run -A --env-file=.env --watch main.ts",
|
"dev": "deno run -A --env-file=.env --watch main.ts",
|
||||||
|
@ -123,8 +123,9 @@ class RenameFields implements ITool {
|
|||||||
const match = patternRegex.exec(name);
|
const match = patternRegex.exec(name);
|
||||||
if (match) {
|
if (match) {
|
||||||
const toChange = evaluateChange(change, match);
|
const toChange = evaluateChange(change, match);
|
||||||
|
const preview = name.replace(new RegExp(patternRegex), toChange);
|
||||||
foundUpdates.push([
|
foundUpdates.push([
|
||||||
`${colorize(name, "red")} -> ${colorize(toChange, "green")}`,
|
`${colorize(name, "red")} -> ${colorize(preview, "green")}`,
|
||||||
() => {
|
() => {
|
||||||
applyRename(field, name, patternRegex, toChange);
|
applyRename(field, name, patternRegex, toChange);
|
||||||
},
|
},
|
||||||
|
@ -26,5 +26,5 @@ function getBearmetalAsciiPath() {
|
|||||||
return filename.name;
|
return filename.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return "https://git.cyborggrizzly.com/BearMetal/pdf-tools/raw/branch/main/asciiart.txt";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user