Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/naoty/table

A command to print ASCII table from stdin
https://github.com/naoty/table

Last synced: 2 months ago
JSON representation

A command to print ASCII table from stdin

Awesome Lists containing this project

README

        

# table

## Installation

```sh
$ brew tap naoty/misc
$ brew install table
```

## Input Format

### TSV

```sh
$ echo -e "2017-01-01\t10000\n2017-01-02\t8000" | table
+------------+-------+
| 2017-01-01 | 10000 |
| 2017-01-02 | 8000 |
+------------+-------+
```

`-H` or `--header` option adds headers to the table.

```sh
$ echo -e "day\tDAU\n2017-01-01\t10000\n2017-01-02\t8000" | table -H
+------------+-------+
| day | DAU |
+------------+-------+
| 2017-01-01 | 10000 |
| 2017-01-02 | 8000 |
+------------+-------+
```

### CSV

```sh
$ echo -e "2017-01-01,10000\n2017-01-02,8000" | table -f csv
+------------+-------+
| 2017-01-01 | 10000 |
| 2017-01-02 | 8000 |
+------------+-------+
```

### JSONL (JSON Lines)

```sh
$ echo -n '{"day":"2020-01-01","DAU":10000}\n{"day":"2020-01-02","DAU":8000}' | table -f jsonl
+-------+------------+
| DAU | day |
+-------+------------+
| 10000 | 2020-01-01 |
| 8000 | 2020-01-02 |
+-------+------------+
```

## Output Format

### ASCII

```sh
$ echo -e "day\tDAU\n2017-01-01\t10000\n2017-01-02\t8000" | table -H -f tsv:ascii
+------------+-------+
| day | DAU |
+------------+-------+
| 2017-01-01 | 10000 |
| 2017-01-02 | 8000 |
+------------+-------+
```

### Markdown

```sh
$ echo -e "day\tDAU\n2017-01-01\t10000\n2017-01-02\t8000" | table -H -f tsv:markdown
| day | DAU |
| ---------- | ----- |
| 2017-01-01 | 10000 |
| 2017-01-02 | 8000 |
```