table: Simple tool to generate tables from DSV input

[ mit, program, text ] [ Propose Tags ] [ Report a vulnerability ]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0
Dependencies base (>=4.6 && <4.8), csv (>=0.1.0), optparse-applicative, process, split (>=0.2) [details]
License MIT
Author Daniel Choi
Maintainer dhchoi@gmail.com
Category Text
Home page https://github.com/danchoi/table
Uploaded by DanielChoi at 2015-01-02T00:43:24Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Executables table
Downloads 874 total (1 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2015-05-21 [all 7 reports]

Readme for table-0.1.0.0

[back to package description]

table

Formats lines of TSV, CSV, or DSV (delimiter-separated values) into a pretty plain text table, wrappings cells with long content to try to fit the table in the screen.

Usage

table

Usage: table ([-d DELIM] | [-s]) [-c] [-R] [-H] [-w WIDTH]
  Pretty format TSV input into table with aligned and wrapped cells

Available options:
  -h,--help                Show this help text
  -d DELIM                 Input field delimiter. Default is TAB (\t).
  -s                       Use any run of whitespace as input field delimiter
  -c                       Parse input as CSV
  -R                       Don't print row dividers
  -H                       Print header row divider
  -w WIDTH                 Max table width. Defaults to value of `tput cols`
                           command.

https://github.com/danchoi/table

Example

Format Rails issues from the GitHub API into a table. This example uses jq and jsontsv to transform the GitHub API JSON into tab separated values before piping that data into table:

curl -s "https://api.github.com/repos/rails/rails/issues" | 
jq -M '.[]' | 
jsontsv -H 'number title user.login:user state' |
table

Outputs this when the terminal width is 72 characters:

--------+--------------------------------------+----------------+-------
 number | title                                | user           | state 
--------+--------------------------------------+----------------+-------
  18290 | Updating guides for Rails 5.0        | lucascaton     | open  
--------+--------------------------------------+----------------+-------
  18288 | Add --skip-action-mailer (or -M) to  | claudiob       | open  
        | rails generate                       |                |       
--------+--------------------------------------+----------------+-------
  18287 | Rails 4.2.0: Scaffold generator      | dldinternet    | open  
        | with --helper=false produced an      |                |       
        | error                                |                |       
--------+--------------------------------------+----------------+-------
  18285 | undefined method 'clear' for         | nPn-           | open  
        | nil:NilClass in                      |                |       
        | actionpack-4.2.0/lib/action_controll |                |       
        | er/test_case.rb                      |                |       
--------+--------------------------------------+----------------+-------
  18283 | Prefer `array?` rather than `array`  | kamipo         | open  
--------+--------------------------------------+----------------+-------
  18279 | Refactoring of add_constraints in    | eileencodes    | open  
        | AssociationScope                     |                |       
--------+--------------------------------------+----------------+-------
  18273 | Rails 3.2.21 (4.x too?):             | jensb          | open  
        | attribute_will_change! with symbol   |                |       
        | parameter causes "multiple           |                |       
        | assignment" error in Postgres        |                |       
--------+--------------------------------------+----------------+-------
  18257 | ActionView::Helpers::TranslationHelp | jcoyne         | open  
        | er.translate makes unsafe values     |                |       
        | html_safe                            |                |       
...

You can use table to pretty-format TSV output for mysql, psql, or sqlite3 as well, especially when you need row cell content to wrap to fit everything nicely on the screen.

Author

License

MIT License