Package

scalax

cli

Permalink

package cli

Visibility
  1. Public
  2. All

Value Members

  1. object Memory

    Permalink

    Humanize or dehumanize bytes.

    Humanize or dehumanize bytes.

    import scalax.cli.Memory
    
    Memory.humanize(10485760) // "10 MiB"
    
    implicit val MU = Memory.SI
    Memory.dehumanize("10 MB") // Some(10000000)
  2. object Stats

    Permalink

    Provides statistics related functions.

    Provides statistics related functions.

    meansd

    The used algorithm is described here.

    import scalax.cli.Stats
    
    // builds mean and standard deviation
    val numbers = Iterator(1.0, 2.0, 3.0)
    val (n, mean, sd) = Stats.meansd(numbers)
  3. object Table

    Permalink

    Print a pretty command line table.

    Print a pretty command line table.

    import scalax.cli.Table
    import shapeless.Sized
    
    val table = Table(Sized("h1", "h2", "h3"))
    
    table.rows += Sized("a", "b", "c")
    table.rows += Sized("d", "e", "f")
    
    table.alignments(1) = Table.Alignment.Right
    
    val lines: List[String] = table.lines

    Print it:

    table.print()
    table.print(Console.err)
    
    // h1 | h2 | h3
    // ---|----|---
    // a  |  b | c
    // d  |  e | f

Ungrouped