Go to file
Eric Rumsey e83fcd0b4d Add writeAnsiU function and remove tests
`writeAnsi` is a convenient function that automatically encodes text and
automatically adds a reset.

`writeAnsiU` is a unary function that takes in an array of Uint8Arrays
and keys for ANSI_BUFFERS. There is no automatic text encoding, so an
`ansiText` function has been added. There is also no automatic reset.
This allows the function's logic to be simpler, resulting in 3-4 times
performance increase per Windows benchmarking. It is also more flexible
for complex formatting scenarios.

Both functions convienently allow strings that are keys of ANSI_BUFFERS
to be passed, and these are auto-matched. Both functions return a
Promise<number>, allowing for maximum performance but necessitating
error handling on the part of the consumer.

It is also important to `await` these functions when calling in a
specific order. This is an advantage of `writeAnsiU`, which allows for
longer, more complex prints in a single function call.
2025-06-02 10:59:48 -05:00
src/lib Add writeAnsiU function and remove tests 2025-06-02 10:59:48 -05:00
.gitignore Initial commit 2025-05-14 16:22:35 -05:00
bun.lock Switch to dprint for better formatting 2025-05-23 17:37:29 -05:00
dprint.json Change line width for dprint 2025-05-27 13:28:47 -05:00
eslint.config.js Configure linting for functional programming 2025-05-23 17:36:54 -05:00
index.ts Initial commit 2025-05-14 16:22:35 -05:00
package.json Switch to dprint for better formatting 2025-05-23 17:37:29 -05:00
README.md Initial commit 2025-05-14 16:22:35 -05:00
tsconfig.json Initial commit 2025-05-14 16:22:35 -05:00

cli-framework

To install dependencies:

bun install

To run:

bun run index.ts

This project was created using bun init in bun v1.2.9. Bun is a fast all-in-one JavaScript runtime.