Created
October 19, 2020 19:10
-
-
Save isaacabraham/93e2a92f405da5da518e316d3f2f41c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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