{"id":23508729,"url":"https://github.com/lovasko/tablize","last_synced_at":"2025-05-13T15:34:48.269Z","repository":{"id":56879783,"uuid":"79080734","full_name":"lovasko/tablize","owner":"lovasko","description":"CSV Pretty-printing","archived":false,"fork":false,"pushed_at":"2017-08-22T21:54:10.000Z","size":15,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-19T16:18:03.390Z","etag":null,"topics":["ascii","ascii-art","csv","table"],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lovasko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-16T03:47:51.000Z","updated_at":"2017-12-02T16:34:57.000Z","dependencies_parsed_at":"2022-08-20T23:40:12.191Z","dependency_job_id":null,"html_url":"https://github.com/lovasko/tablize","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovasko%2Ftablize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovasko%2Ftablize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovasko%2Ftablize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovasko%2Ftablize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lovasko","download_url":"https://codeload.github.com/lovasko/tablize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253970535,"owners_count":21992516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ascii","ascii-art","csv","table"],"created_at":"2024-12-25T11:31:48.107Z","updated_at":"2025-05-13T15:34:48.222Z","avatar_url":"https://github.com/lovasko.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tablize\n[![Build Status](https://travis-ci.org/lovasko/tablize.svg?branch=master)](https://travis-ci.org/lovasko/tablize)\n\n## Introduction\nThe `tablize` utility can be used to pretty-print tables defined by the\nCSV format. It provides column alignments and visual decoration of the table\nboth horizontally and vertically. To do so, a simple domain-specific language\nwas introduced with its grammar described in the Decoration language section of\nthis document.\n\n## Example\nA simple table defining services and network ports for different hosts in the\nnetwork:\n```\n$ cat config.csv\nhost,service,port\nqa.example.com,apache,443\ntesting.example.com,apache,8080\n*.example.com,apache,80\n```\n\nThe above table can be rendered into the following text:\n```\n$ tablize config.csv -x 'union(outer, only(1))' -y all -a left,left,right\n+---------------------+---------+------+\n| host                | service | port |\n+---------------------+---------+------+\n| qa.example.com      | apache  |  443 |\n| testing.example.com | apache  | 8080 |\n| *.example.com       | apache  |   80 |\n+---------------------+---------+------+\n```\n\n## Build \u0026 install\nThere are two standard ways of obtaining the utility:\n * by cloning the git repository: `git clone https://github.com/lovasko/tablize`\n * by using the central Hackage server: `cabal install tablize`\n\n### Dependencies\nThe build process depends on the following packages from Hackage:\n * `base`\n * `attoparsec`\n * `comma`\n * `optparse-applicative`\n * `tabl`\n * `text`\n\n## Options\nThe command-line interface consists of an optional positional argument that\nspecifies the input file (`stdin` is used if no file is specified) and three\noptional named parameters:\n\n * `-x|--horizontal HDECOR` defines the horizontal decoration, using the custom\n   DSL described below (default: `union(outer, only(1))`)\n\n * `-y|--vertical VDECOR` defines the vertical decoration, using the custom\n   DSL described below (default: `all`)\n\n * `-a|--alignment ALIGN` defines the column alignment starting from the\n   left-most column (default: empty string). Valid alignments are `left`,\n   `centre` and `right`. Alignments are assigned starting from the left side,\n   while all unspecified columns will default to `left`.\n\n\n## Decoration language\nThe decoration language  is used to define the presence of decorative lines\n(separately for horizontal and vertical) within the table. Lines can be used\nto separate sections of the table - always the full length, row or column.\n\nThe decoration is represented by exactly one statement. All statements are\ndescribed below:\n\nThe `all` statement results in all lines (in the relevant orientation) to be\nvisible. Opposite effect can be achieved via the `none` statement that,\nnaturally, makes no decorative lines visible.\n\nThe `inner` and `outer` statements, as the names suggest, provide means of\ndecorating the inner and outer lines of the table respectively. These\nstatements are best used when the number of columns or rows is not known\nbeforehand.\n\nThe `only` statement expects a list of zero or more unsigned integer indices\nseparated by the comma character(leftmost and topmost lines equal to zero)\nthat should be contained in the decoration. An example of the statement is:\n`only(1, 2, 3)`. The opposite statement, `except`, includes all but\nlines specified with indices.\n \nTwo combinators - `union` and `isect` can be used to specify a set union and\nset intersection of zero or more decorations separated by the comma character.\nThe default value for the horizontal decoration is `union(outer, only(1))`,\nresulting in decoration seen in the Example section.\n\nAll whitespace is disregarded as non-relevant and can be used for stylistic\npurposes.\n\n### Examples\nThe following set of examples with operate on a simple 3x3 table filled with\n`o` characters:\n```\n$ cat o.csv\no,o,o\no,o,o\no,o,o\n```\n\n#### Inner lines only\n```\n$ tablize o.csv -x inner -y inner\no | o | o\n--+---+--\no | o | o\n--+---+--\no | o | o\n```\n\n#### Outer lines only\n```\n$ tablize o.csv -x outer -y outer\n+-------+\n| o o o |\n| o o o |\n| o o o |\n+-------+\n```\n\n#### Separating the first column\n```\n$ tablize o.csv -x none -y 'only(1)'\no | o o\no | o o\no | o o\n```\n\n#### Default settings\n```\n$ tablize o.csv -x 'union(outer, only(1))' -y all\n+---+---+---+\n| o | o | o |\n+---+---+---+\n| o | o | o |\n| o | o | o |\n+---+---+---+\n```\n\n#### Separating all rows\n```\n$ tablize o.csv -x all -y none\n-----\no o o\n-----\no o o\n-----\no o o\n-----\n```\n\n## License\nThe source code of the `tablize` utility is licensed under the terms of the\n[2-clause BSD license](LICENSE). Feel free to contact the author if you need a\ndifferent license for your particular use-case.\n\n## Author\nDaniel Lovasko \u003cdaniel.lovasko@gmail.com\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flovasko%2Ftablize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flovasko%2Ftablize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flovasko%2Ftablize/lists"}