cli-table / cli-table3

Pretty unicode tables for the command line
MIT License
535 stars 44 forks source link

Generate random basic/complex tables for performance testing and debugging. #294

Open speedytwenty opened 2 years ago

speedytwenty commented 2 years ago

PROPOSED DOCS <-- Click ME! ME! ME!

This PR adds a rudimentary ability to generate basic and complex tables for performance testing, debugging, and amusement.

Basic usage:

➭ node scripts/generate [ROWS = 10] [COLS = 10] [options]

When installing this package:
➭ node node_modules/cli-table3/scripts/generate 10 5 --print

When cloning this repository:
➭ node scripts/generate 10 5 --print --complex --dump --col-width 10 --debug

Help:

➭ node scripts/generate --help
node scripts/generate [ROWS = 10] [COLS = 10]
  --print Print the generated table to the screen.
  --dump Print the generated table code to the screen.
  --complex Generate a complex table (basic tables are generated by default)
  --debug Print table debugging output (warnings only).

Basic table: A table where all cells are 1x1. Complex table: Any table with a cell specifying a colSpan or rowSpan greater than 1.

The added scripts/generate.md documents the generation script's functionality.

Known issues:

This script is presently prone to falling into a continuous loop and will remain a draft until it is stablized. Because it is random it is especially tough to debug.

Additionally, when printing a generated table, the table might not produce the "expected" output". It can be tough to discern if the problem is in the generated data or in cli-table3's layout rendering. (So far, after #278, I've found that it usually is in the generated dated)