{"id":13507628,"url":"https://github.com/codedge-llc/scribe","last_synced_at":"2025-05-14T21:07:24.918Z","repository":{"id":38711625,"uuid":"65634617","full_name":"codedge-llc/scribe","owner":"codedge-llc","description":"Pretty-print tables of Elixir structs and maps.","archived":false,"fork":false,"pushed_at":"2025-01-11T16:23:20.000Z","size":98,"stargazers_count":305,"open_issues_count":3,"forks_count":12,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-15T05:16:40.916Z","etag":null,"topics":["elixir"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/scribe","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codedge-llc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["codedge-llc"]}},"created_at":"2016-08-13T20:00:16.000Z","updated_at":"2025-03-26T07:48:27.000Z","dependencies_parsed_at":"2024-01-05T21:54:16.903Z","dependency_job_id":"801eadae-647b-444e-89a9-dde9c88e42a1","html_url":"https://github.com/codedge-llc/scribe","commit_stats":{"total_commits":64,"total_committers":6,"mean_commits":"10.666666666666666","dds":0.3125,"last_synced_commit":"07d3929530231fa62848d5b315b6813c3425346f"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codedge-llc%2Fscribe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codedge-llc%2Fscribe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codedge-llc%2Fscribe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codedge-llc%2Fscribe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codedge-llc","download_url":"https://codeload.github.com/codedge-llc/scribe/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254227612,"owners_count":22035669,"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":["elixir"],"created_at":"2024-08-01T02:00:37.194Z","updated_at":"2025-05-14T21:07:19.894Z","avatar_url":"https://github.com/codedge-llc.png","language":"Elixir","funding_links":["https://github.com/sponsors/codedge-llc"],"categories":["Command Line Applications"],"sub_categories":[],"readme":"# Scribe\n\n\u003e Pretty-print tables of Elixir structs and maps. Inspired by [hirb](https://github.com/cldwalker/hirb).\n\n[![CI](https://github.com/codedge-llc/scribe/actions/workflows/ci.yml/badge.svg)](https://github.com/codedge-llc/scribe/actions/workflows/ci.yml)\n[![Version](https://img.shields.io/hexpm/v/scribe.svg)](https://hex.pm/packages/scribe)\n[![Total Downloads](https://img.shields.io/hexpm/dt/scribe.svg)](https://hex.pm/packages/scribe)\n[![License](https://img.shields.io/hexpm/l/scribe.svg)](https://github.com/codedge-llc/scribe/blob/main/LICENSE)\n[![Last Updated](https://img.shields.io/github/last-commit/codedge-llc/scribe.svg)](https://github.com/codedge-llc/scribe/commits/main)\n[![Documentation](https://img.shields.io/badge/documentation-gray)](https://hexdocs.pm/scribe/)\n\n## Installation\n\n1. Add `scribe` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:scribe, \"~\u003e 0.11\"}\n  ]\nend\n```\n\n## Usage\n\nPrint a list of maps or structs as a table. Header columns are taken from the\nkeys of the first element.\n\n```elixir\niex(1)\u003e data = [%{key: \"value\", another_key: 123},\n...(1)\u003e %{key: \"test\", another_key: :key}]\niex(2)\u003e Scribe.print(data)\n+----------------+-------------+\n| :another_key   | :key        |\n+----------------+-------------+\n| 123            | \"value\"     |\n| :key           | \"test\"      |\n+----------------+-------------+\n```\n\nUseful for printing large collections, such as results of database queries\n\n```elixir\n# %User{id: nil, email: nil}\n\niex(1)\u003e User |\u003e limit(5) |\u003e Repo.all() |\u003e Scribe.print()\n+-------------+----------------------------+------+\n| :__struct__ | :email                     | :id  |\n+-------------+----------------------------+------+\n| User        | \"myles_fisher@beahan.com\"  | 5171 |\n| User        | \"dawson_bartell@lynch.org\" | 4528 |\n| User        | \"hassan1972@langworth.com\" | 1480 |\n| User        | \"kiera.schulist@koch.com\"  | 2084 |\n| User        | \"cynthia1970@mann.name\"    | 6599 |\n+-------------+----------------------------+------+\n```\n\n## Pagination\n\nScribe uses [pane](https://github.com/codedge-llc/pane) to paginate large tables.\nUse with `Scribe.console/2`.\n\n```elixir\n# %User{id: nil, email: nil, first_name: nil, last_name: nil}\niex(1)\u003e User |\u003e limit(5) |\u003e Repo.all |\u003e Scribe.console\n\n+-------------+------------------------+-------------+-------+------------+\n| :__struct__ | :email                 | :first_name | :id   | :last_name |\n+-------------+------------------------+-------------+-------+------------+\n| User        | \"celestine_satterfield | \"Gene\"      | 9061  | \"Krajcik\"  |\n| User        | \"lynn1978@bednar.org\"  | \"Maeve\"     | 9865  | \"Gerlach\"  |\n| User        | \"melisa1975@hilll.biz\" | \"Theodora\"  | 2262  | \"Wunsch\"   |\n| User        | \"furman.grady@ryan.org | \"Oswaldo\"   | 4977  | \"Simonis\"  |\n| User        | \"caesar_hirthe@reynold | \"Arjun\"     | 3907  | \"Prohaska\" |\n+-------------+------------------------+-------------+-------+------------+\n\n\n[1 of 1] (j)next (k)prev (q)quit\n```\n\n## Printing Custom Tables\n\n`Scribe.print/2` takes a list of of columns on the `:data` options key to\ncustomize output. You can use either the atom key or customize the header\nwith `{\"Custom Title\", :key}`.\n\n```elixir\n# %User{id: nil, email: nil, first_name: nil, last_name: nil}\n\nUser\n|\u003e limit(5)\n|\u003e Repo.all\n|\u003e Scribe.print(data: [{\"ID\", :id}, :first_name, :last_name])\n\n+------+--------------+-------------+\n| \"ID\" | :first_name  | :last_name  |\n+------+--------------+-------------+\n| 9061 | \"Gene\"       | \"Krajcik\"   |\n| 9865 | \"Maeve\"      | \"Gerlach\"   |\n| 2262 | \"Theodora\"   | \"Wunsch\"    |\n| 4977 | \"Oswaldo\"    | \"Simonis\"   |\n| 3907 | \"Arjun\"      | \"Prohaska\"  |\n+------+--------------+-------------+\n```\n\n### Function Columns\n\nYou can specify functions that take the given row's struct or map as its only argument.\n\n```elixir\n# %User{id: nil, email: nil, first_name: nil, last_name: nil}\nresults =\n  User\n  |\u003e limit(5)\n  |\u003e Repo.all\n  |\u003e Scribe.print(data: [{\"ID\", :id}, {\"Full Name\", fn(x) -\u003e \"#{x.last_name}, #{x.first_name}\" end}])\n\n+--------------------------+----------------------------------------------+\n| \"ID\"                     | \"Full Name\"                                  |\n+--------------------------+----------------------------------------------+\n| 9061                     | \"Krajcik, Gene\"                              |\n| 9865                     | \"Gerlach, Maeve\"                             |\n| 2262                     | \"Wunsch, Theodora\"                           |\n| 4977                     | \"Simonis, Oswaldo\"                           |\n| 3907                     | \"Prohaska, Arjun\"                            |\n+--------------------------+----------------------------------------------+\n\n:ok\n```\n\n## Styling Options\n\n### Width\n\nPass a `width` option to define table width.\n\n```elixir\niex\u003e Scribe.print(data, width: 80)\n\n+-------------------+-----------------------------------------------------+\n| :id               | :key                                                |\n+-------------------+-----------------------------------------------------+\n| 910               | \"B1786AC67B4DEB19\"                                  |\n| 313               | \"30CB8A2DE4750070\"                                  |\n| 25                | \"D0859205FC7E7298\"                                  |\n| 647               | \"8F0060AD0BD6AB04\"                                  |\n| 253               | \"65509A684D619182\"                                  |\n+-------------------+-----------------------------------------------------+\n```\n\n### Disable Colors\n\n```elixir\niex\u003e Scribe.print(data, colorize: false)\n```\n\n### Text Alignment\n\nPass an `alignment` option of `:left`, `:center`, or `:right` for text alignment.\nDefaults to `:left`.\n\n```elixir\niex\u003e Scribe.print(data, alignment: :center)\n\n+------------------------------+------------+--------+\n|            :body             |  :current  |  :id   |\n+------------------------------+------------+--------+\n|   \"A rather short string.\"   |    true    |  1234  |\n|   \"A rather short string.\"   |   false    |  2222  |\n|   \"A rather short string.\"   |    true    |  4444  |\n+------------------------------+------------+--------+\n```\n\n```elixir\niex\u003e Scribe.print(data, alignment: :right)\n+------------------------------+------------+--------+\n|                        :body |   :current |    :id |\n+------------------------------+------------+--------+\n|     \"A rather short string.\" |       true |   1234 |\n|     \"A rather short string.\" |      false |   2222 |\n|     \"A rather short string.\" |       true |   4444 |\n+------------------------------+------------+--------+\n```\n\n### Styles\n\nScribe supports five styling formats natively, with support for custom adapters.\n\n_Default_\n\n```elixir\niex\u003e Scribe.print(data, style: Scribe.Style.Default)\n\n+-------+-----------------------------------+------------------------+\n| :id   | :inserted_at                      | :key                   |\n+-------+-----------------------------------+------------------------+\n| 457   | \"2017-03-27 14:42:34.095202Z\"     | \"CEB0E055ECDF6028\"     |\n| 326   | \"2017-03-27 14:42:34.097519Z\"     | \"CF67027F7235B88D\"     |\n| 756   | \"2017-03-27 14:42:34.097553Z\"     | \"DE016DFF477BEDDB\"     |\n| 484   | \"2017-03-27 14:42:34.097572Z\"     | \"9194A82EF4BB0123\"     |\n| 780   | \"2017-03-27 14:42:34.097591Z\"     | \"BF92748B4AAAF14A\"     |\n+-------+-----------------------------------+------------------------+\n```\n\n_Psql_\n\n```elixir\niex\u003e Scribe.print(data, style: Scribe.Style.Psql)\n\n :id   | :inserted_at                      | :key\n-------+-----------------------------------+------------------------\n 700   | \"2017-03-27 14:41:33.411442Z\"     | \"A2FA80D0F6DF9388\"\n 890   | \"2017-03-27 14:41:33.412955Z\"     | \"F95094328A91D950\"\n 684   | \"2017-03-27 14:41:33.412991Z\"     | \"1EAC6B28045ED644\"\n 531   | \"2017-03-27 14:41:33.413015Z\"     | \"DC2377B696355642\"\n 648   | \"2017-03-27 14:41:33.413037Z\"     | \"EA9311B4683A52B3\"\n```\n\n_Github Markdown_\n\n```elixir\niex\u003e Scribe.print(data, style: Scribe.Style.GithubMarkdown)\n\n| :id   | :inserted_at                      | :key                   |\n|-------|-----------------------------------|------------------------|\n| 457   | \"2017-03-27 14:42:34.095202Z\"     | \"CEB0E055ECDF6028\"     |\n| 326   | \"2017-03-27 14:42:34.097519Z\"     | \"CF67027F7235B88D\"     |\n| 756   | \"2017-03-27 14:42:34.097553Z\"     | \"DE016DFF477BEDDB\"     |\n| 484   | \"2017-03-27 14:42:34.097572Z\"     | \"9194A82EF4BB0123\"     |\n| 780   | \"2017-03-27 14:42:34.097591Z\"     | \"BF92748B4AAAF14A\"     |\n```\n\n_Pseudo_\n\n```elixir\niex\u003e Scribe.print(data, style: Scribe.Style.Pseudo)\n\n┌───────┬───────────────────────────────────┬────────────────────────┐\n│ :id   │ :inserted_at                      │ :key                   │\n├───────┼───────────────────────────────────┼────────────────────────┤\n│ 457   │ \"2017-03-27 14:42:34.095202Z\"     │ \"CEB0E055ECDF6028\"     │\n│ 326   │ \"2017-03-27 14:42:34.097519Z\"     │ \"CF67027F7235B88D\"     │\n│ 756   │ \"2017-03-27 14:42:34.097553Z\"     │ \"DE016DFF477BEDDB\"     │\n│ 484   │ \"2017-03-27 14:42:34.097572Z\"     │ \"9194A82EF4BB0123\"     │\n│ 780   │ \"2017-03-27 14:42:34.097591Z\"     │ \"BF92748B4AAAF14A\"     │\n└───────┴───────────────────────────────────┴────────────────────────┘\n```\n\n_NoBorder_\n\n```elixir\niex\u003e Scribe.print(data, style: Scribe.Style.NoBorder)\n\n :id    :inserted_at                       :key\n 457    \"2017-03-27 14:42:34.095202Z\"      \"CEB0E055ECDF6028\"\n 326    \"2017-03-27 14:42:34.097519Z\"      \"CF67027F7235B88D\"\n 756    \"2017-03-27 14:42:34.097553Z\"      \"DE016DFF477BEDDB\"\n 484    \"2017-03-27 14:42:34.097572Z\"      \"9194A82EF4BB0123\"\n 780    \"2017-03-27 14:42:34.097591Z\"      \"BF92748B4AAAF14A\"\n```\n\nSet a default one in your config if you like:\n\n```elixir\nconfig :scribe, style: Scribe.Style.Psql\n```\n\n## Contributing\n\n### Testing\n\nUnit tests can be run with `mix test` or `mix coveralls.html`.\n\n### Formatting\n\nThis project uses Elixir's `mix format` and [Prettier](https://prettier.io) for formatting.\nAdd hooks in your editor of choice to run it after a save. Be sure it respects this project's\n`.formatter.exs`.\n\n### Commits\n\nGit commit subjects use the [Karma style](http://karma-runner.github.io/5.0/dev/git-commit-msg.html).\n\n## License\n\nCopyright (c) 2016-2024 Codedge LLC (https://www.codedge.io/)\n\nThis library is MIT licensed. See the [LICENSE](https://github.com/codedge-llc/scribe/blob/main/LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodedge-llc%2Fscribe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodedge-llc%2Fscribe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodedge-llc%2Fscribe/lists"}