Compare commits
No commits in common. "1a1431c85e8f4e223884ad0e81267eb8d9904842" and "d5b9ef8f04c84d20fbf17b1344d5f5cce30066b3" have entirely different histories.
1a1431c85e
...
d5b9ef8f04
12
CHANGELOG.md
12
CHANGELOG.md
@ -1,14 +1,6 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## v1.0.1 (2025-07-25)
|
## 1.0.0 (2025-07-25)
|
||||||
|
|
||||||
<!-- auto-changelog -->
|
|
||||||
|
|
||||||
### Known Issues
|
|
||||||
|
|
||||||
- help flags can cause issues
|
|
||||||
|
|
||||||
## v1.0.0 (2025-07-25)
|
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
@ -28,7 +20,7 @@
|
|||||||
- ascii art is broken (sad face)
|
- ascii art is broken (sad face)
|
||||||
- banana doesn't work
|
- banana doesn't work
|
||||||
|
|
||||||
## v0.0.0 (never)
|
## 0.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,16 +1,7 @@
|
|||||||
# BearMetal PDF Tools
|
# Emma's Simple Form Field Checker
|
||||||
|
|
||||||
A collection of tools for working with PDF forms.
|
Compares a PDF form to a list of CS class files to see if all field names are
|
||||||
|
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
|
||||||
|
|
||||||
@ -29,51 +20,17 @@ 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
|
||||||
|
|
||||||
`pdf-tools <tool> <args>` -> `<tool>` is one of the following
|
`checkfields <path to PDF> <comma-separated list of paths to CS class files>`
|
||||||
|
-OR- `checkfields` and follow prompts.
|
||||||
|
|
||||||
- check-code
|
### Output
|
||||||
- field-rename
|
|
||||||
- list-form-fields
|
|
||||||
|
|
||||||
## Contributing
|
> All form fields present!
|
||||||
|
|
||||||
Contributions are welcome!
|
-OR-
|
||||||
|
|
||||||
## License
|
> The following field names are not present in the CS code
|
||||||
|
|
||||||
GPL 3.0
|
> \<list of missing form fields\>
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### 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).
|
|
||||||
|
18
cli/index.ts
18
cli/index.ts
@ -6,6 +6,8 @@ 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 }>][] = [
|
||||||
@ -21,7 +23,6 @@ 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() {
|
||||||
@ -42,7 +43,9 @@ export class PdfToolsCli {
|
|||||||
|
|
||||||
private async banana() {
|
private async banana() {
|
||||||
const asciiArt = await getAsciiArt("banana");
|
const asciiArt = await getAsciiArt("banana");
|
||||||
this.closeMessage = colorize(asciiArt, "yellow");
|
const body = this.terminalLayout.getBlock("body");
|
||||||
|
body.clearAll();
|
||||||
|
cliLog(colorize(asciiArt, "yellow"), body);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async help() {
|
private async help() {
|
||||||
@ -61,11 +64,6 @@ 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;
|
||||||
@ -77,15 +75,11 @@ export class PdfToolsCli {
|
|||||||
await this.runTool(toCase(task, "title"));
|
await this.runTool(toCase(task, "title"));
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
this.cleanup();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private cleanup() {
|
|
||||||
this.terminalLayout.clearAll();
|
this.terminalLayout.clearAll();
|
||||||
Deno.stdin.setRaw(false);
|
Deno.stdin.setRaw(false);
|
||||||
if (this.closeMessage) console.log(this.closeMessage);
|
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();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@bearmetal/pdf-tools",
|
"name": "@bearmetal/pdf-tools",
|
||||||
"version": "1.0.1",
|
"version": "1.0.0",
|
||||||
"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,9 +123,8 @@ 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(preview, "green")}`,
|
`${colorize(name, "red")} -> ${colorize(toChange, "green")}`,
|
||||||
() => {
|
() => {
|
||||||
applyRename(field, name, patternRegex, toChange);
|
applyRename(field, name, patternRegex, toChange);
|
||||||
},
|
},
|
||||||
|
@ -26,5 +26,5 @@ function getBearmetalAsciiPath() {
|
|||||||
return filename.name;
|
return filename.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "https://git.cyborggrizzly.com/BearMetal/pdf-tools/raw/branch/main/asciiart.txt";
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user