Pretty-Print a Table in Larzscript
Render tabular data as an aligned ASCII table for the terminal, or Markdown for a README.
table.render() takes a header row plus data rows and column-aligns everything automatically; table.to_markdown() renders the same data as a Markdown table.
larzscript pkg install table
Code
import "table" as table let rows = [["Name", "Language"], ["Ada", "Larzscript"], ["Bo", "Python"]] print(table.render(rows)) print(table.to_markdown(rows))
Output
| Name | Language | |------|------------| | Ada | Larzscript | | Bo | Python | | Name | Language | |------|------------| | Ada | Larzscript | | Bo | Python |
Related
larztableAligned ASCII tables→Build a CLI Tool with Subcommands in LarzscriptBuild a real command-line tool with named subcommands and auto-generated help, the shape every larzscript-* showcase app in this ecosystem uses.→Parse Command-Line Arguments in LarzscriptParse --flag=value pairs and positional arguments out of argv, without a full CLI framework.→Read a File Line by Line in LarzscriptRead a text file's contents and split it into lines - the everyday first step of any script that processes a file.→