Scala CLI Tools

Build Status Codacy Badge Scaladoc

A collection of Scala command-line interface tools.

Table of Contents

Library

Memory

Humanize or dehumanize bytes:

import scalax.cli.Memory

Memory.humanize(10485760) // "10 MiB"

implicit val MU = Memory.SI
Memory.dehumanize("10 MB") // Some(10000000)

Table

Print a pretty command line table:

// create the table builder object

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

// get lines

val lines: List[String] = table.lines

// print it directly

table.print()
table.print(Console.err)

// h1 | h2 | h3
// ---|----|---
// a  |  b | c
// d  |  e | f

Apps

  • dehumanize un-pretty-print byte values
  • highlight search for pattern and highlight matches
  • humanize pretty-print byte values
  • meansd print mean and standard deviation

Installation

Arch Linux

Install all apps with the scala-cli-tools AUR package:

pacaur -S scala-cli-tools

Manual

Install all apps to ~/bin:

PREFIX=$HOME NATIVE_MODE=release \
  sbt install