Giter VIP home page Giter VIP logo

seqprinter's Introduction

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.

seqprinter's People

Contributors

doganck avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.