Compare commits
5 Commits
d5b9ef8f04
...
1a1431c85e
Author | SHA1 | Date | |
---|---|---|---|
1a1431c85e | |||
711880a670 | |||
4f043d2bd7 | |||
43d5916e52 | |||
51aaf27fda |
12
CHANGELOG.md
12
CHANGELOG.md
@ -1,6 +1,14 @@
|
||||
# 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
|
||||
|
||||
@ -20,7 +28,7 @@
|
||||
- ascii art is broken (sad face)
|
||||
- banana doesn't work
|
||||
|
||||
## 0.0.0 (never)
|
||||
## v0.0.0 (never)
|
||||
|
||||
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
|
||||
present, excluding signature fields.
|
||||
A collection of tools for working with PDF forms.
|
||||
|
||||
## 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
|
||||
|
||||
@ -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
|
||||
> it to the PATH
|
||||
|
||||
### Precompiled
|
||||
|
||||
Download the latest release from the
|
||||
[releases page](https://git.cyborggrizzly.com/BearMetal/pdf-tools/releases)
|
||||
|
||||
## Usage
|
||||
|
||||
`checkfields <path to PDF> <comma-separated list of paths to CS class files>`
|
||||
-OR- `checkfields` and follow prompts.
|
||||
`pdf-tools <tool> <args>` -> `<tool>` is one of the following
|
||||
|
||||
### 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).
|
||||
|
18
cli/index.ts
18
cli/index.ts
@ -6,8 +6,6 @@ import { selectMenuInteractive } from "./selectMenu.ts";
|
||||
import { TerminalBlock, TerminalLayout } from "./TerminalLayout.ts";
|
||||
import { cliAlert, cliLog } from "./prompts.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)
|
||||
const toolRegistry: [string, Promise<{ default: ITool }>][] = [
|
||||
@ -23,6 +21,7 @@ export class PdfToolsCli {
|
||||
|
||||
private args = ArgParser.parse(Deno.args).setFlagDefs({
|
||||
help: ["-h", "--help"],
|
||||
banana: ["-b", "--banana"],
|
||||
});
|
||||
|
||||
async importTools() {
|
||||
@ -43,9 +42,7 @@ export class PdfToolsCli {
|
||||
|
||||
private async banana() {
|
||||
const asciiArt = await getAsciiArt("banana");
|
||||
const body = this.terminalLayout.getBlock("body");
|
||||
body.clearAll();
|
||||
cliLog(colorize(asciiArt, "yellow"), body);
|
||||
this.closeMessage = colorize(asciiArt, "yellow");
|
||||
}
|
||||
|
||||
private async help() {
|
||||
@ -64,6 +61,11 @@ export class PdfToolsCli {
|
||||
this.terminalLayout.register("title", titleBlock);
|
||||
const bodyBlock = new TerminalBlock();
|
||||
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) {
|
||||
await this.help();
|
||||
return;
|
||||
@ -75,11 +77,15 @@ export class PdfToolsCli {
|
||||
await this.runTool(toCase(task, "title"));
|
||||
}
|
||||
} finally {
|
||||
this.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
private cleanup() {
|
||||
this.terminalLayout.clearAll();
|
||||
Deno.stdin.setRaw(false);
|
||||
if (this.closeMessage) console.log(this.closeMessage);
|
||||
}
|
||||
}
|
||||
|
||||
private async toolMenu() {
|
||||
const tools = this.tools.keys().toArray();
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@bearmetal/pdf-tools",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"license": "GPL 3.0",
|
||||
"tasks": {
|
||||
"dev": "deno run -A --env-file=.env --watch main.ts",
|
||||
|
@ -123,8 +123,9 @@ class RenameFields implements ITool {
|
||||
const match = patternRegex.exec(name);
|
||||
if (match) {
|
||||
const toChange = evaluateChange(change, match);
|
||||
const preview = name.replace(new RegExp(patternRegex), toChange);
|
||||
foundUpdates.push([
|
||||
`${colorize(name, "red")} -> ${colorize(toChange, "green")}`,
|
||||
`${colorize(name, "red")} -> ${colorize(preview, "green")}`,
|
||||
() => {
|
||||
applyRename(field, name, patternRegex, toChange);
|
||||
},
|
||||
|
@ -26,5 +26,5 @@ function getBearmetalAsciiPath() {
|
||||
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