Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@isaacabraham
Created October 19, 2020 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isaacabraham/93e2a92f405da5da518e316d3f2f41c4 to your computer and use it in GitHub Desktop.
Save isaacabraham/93e2a92f405da5da518e316d3f2f41c4 to your computer and use it in GitHub Desktop.
module IsaacStuff =
type TableRow =
| Empty
| DataRow of string array
type TableSetting =
| Border of TableBorder
| Column of TableColumn
| Row of TableRow
let createTable settings =
settings
|> List.fold(fun (table:Table) setting ->
match setting with
| Border border ->
table.Border <- border
table
| Column column ->
table.AddColumn column
| Row Empty ->
table.AddEmptyRow()
| Row (DataRow names) ->
table.AddRow names) (Table())
let render = AnsiConsole.Render
open IsaacStuff
let layout = [
Border TableBorder.Rounded
Column (TableColumn "[u]Name[/]")
Column (TableColumn "[u]Age[/]")
Column (TableColumn "[u]Department[/]")
Row (DataRow [| "Hello"; "[red]World![/]"; "" |])
Row Empty
Row (DataRow [| "[blue]Bonjour[/]"; "[white]le[/]"; "[red]monde![/]" |])
]
layout
|> createTable
|> render
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment