Skip to content

DoganCK/SeqPrinter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

This package provides a colored and tabularized thread-safe output for sequences of named or anonymous records.

(Colors not visible in markdown.)

Installation

FSI

#r "nuget: SeqPrinter, 0.4.0"
open SeqPrinter

.NET CLI

dotnet add package SeqPrinter --version 0.4.0

Usage

Basic

type Person = { Name: string; Age: int; Height: int }

let typedList =
    [
        {
            Name = "Stanley"
            Age = 32
            Height = 175
        }
        {
            Name = "Akira"
            Age = 27
            Height = 175
        }
        {
            Name = "Andrei"
            Age = 35
            Height = 200
        }
    ]

typedList |> Printer.print
 Age      Height   Name     
 <Int32>  <Int32>  <String> 
 32       175      Stanley  
 27       175      Akira    
 35       200      Andrei   
Displaying 1-3 of 3 items.

Selecting Columns

You can select which fields of your type to display as columns.

typedList
|> Printer
|> Printer.withColumns [ "Name"; "Height" ]
|> Printer.print
 Name      Height  
 <String>  <Int32> 
 Stanley   175     
 Akira     175     
 Andrei    200     
Displaying 1-3 of 3 items.

Ordering columns

Similarly you can also determine the order of fields to display.

typedList
|> Printer
|> Printer.withColumns [ "Name"; "Age"; "Height" ]
|> Printer.print
 Name      Age      Height  
 <String>  <Int32>  <Int32> 
 Stanley   32       175     
 Akira     27       175     
 Andrei    35       200     
Displaying 1-3 of 3 items.

Pagination

Page Size

let printer = 
    typedList
    |> List.replicate 25
    |> List.concat
    |> Printer
    |> Printer.withPageSize 10
 Age      Height   Name     
 <Int32>  <Int32>  <String> 
 32       175      Stanley  
 27       175      Akira    
 35       200      Andrei   
 32       175      Stanley  
 27       175      Akira    
 35       200      Andrei   
 32       175      Stanley  
 27       175      Akira    
 35       200      Andrei   
 32       175      Stanley  
Displaying 1-10 of 75 items.

Navigation

printer
|>Printer.nextPage

// Alternative

printer.NextPage()
 Age      Height   Name     
 <Int32>  <Int32>  <String> 
 27       175      Akira    
 35       200      Andrei   
 32       175      Stanley  
 27       175      Akira    
 35       200      Andrei   
 32       175      Stanley  
 27       175      Akira    
 35       200      Andrei   
 32       175      Stanley  
 27       175      Akira    
Displaying 11-20 of 75 items.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages