Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wookietreiber/scala-cli-tools

Scala Command-Line Interface Tools
https://github.com/wookietreiber/scala-cli-tools

cli command-line command-line-interface scala scala-cli

Last synced: about 1 month ago
JSON representation

Scala Command-Line Interface Tools

Awesome Lists containing this project

README

        

Scala CLI Tools
===============

[![Build Status](https://travis-ci.com/wookietreiber/scala-cli-tools.svg?branch=master)](https://travis-ci.com/wookietreiber/scala-cli-tools)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/67d9aaafa59a414e9b808ef45abb3fb0)](https://www.codacy.com/app/wookietreiber/scala-cli-tools?utm_source=github.com&utm_medium=referral&utm_content=wookietreiber/scala-cli-tools&utm_campaign=Badge_Grade)
[![Scaladoc](https://javadoc-badge.appspot.com/com.github.wookietreiber/scala-cli-tools_2.12.svg?label=scaladoc)](https://javadoc-badge.appspot.com/com.github.wookietreiber/scala-cli-tools_2.12)

A collection of Scala command-line interface tools.

Table of Contents
-----------------

- [Library](#library)
* [Memory](#memory)
* [Table](#table)
- [Apps](#apps)
- [Installation](#installation)
* [Arch Linux](#arch-linux)
* [Manual](#manual)

Library
-------

### Memory

Humanize or dehumanize bytes:

```scala
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:

```scala
// 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](https://aur.archlinux.org/packages/scala-cli-tools/):

```bash
pacaur -S scala-cli-tools
```

### Manual

Install all apps to `~/bin`:

```bash
PREFIX=$HOME NATIVE_MODE=release \
sbt install
```