{"id":13817518,"url":"https://github.com/modood/table","last_synced_at":"2025-05-15T20:32:29.358Z","repository":{"id":38441574,"uuid":"96881228","full_name":"modood/table","owner":"modood","description":"Produces a string that represents slice data in a text table, inspired by gajus/table.","archived":false,"fork":false,"pushed_at":"2022-05-27T05:16:50.000Z","size":20,"stargazers_count":141,"open_issues_count":4,"forks_count":26,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-05T16:21:36.410Z","etag":null,"topics":["ascii","format","output","print","sheet","slice","struct","table","text"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/modood.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-07-11T10:26:35.000Z","updated_at":"2025-03-12T03:56:11.000Z","dependencies_parsed_at":"2022-07-29T22:39:48.473Z","dependency_job_id":null,"html_url":"https://github.com/modood/table","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modood%2Ftable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modood%2Ftable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modood%2Ftable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modood%2Ftable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/modood","download_url":"https://codeload.github.com/modood/table/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254418656,"owners_count":22068121,"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","format","output","print","sheet","slice","struct","table","text"],"created_at":"2024-08-04T06:00:47.904Z","updated_at":"2025-05-15T20:32:29.018Z","avatar_url":"https://github.com/modood.png","language":"Go","readme":"table\n=====\n\n[![Build Status](https://travis-ci.org/modood/table.png)](https://travis-ci.org/modood/table)\n[![Coverage Status](https://coveralls.io/repos/github/modood/table/badge.svg?branch=master)](https://coveralls.io/github/modood/table?branch=master)\n[![GoDoc](https://godoc.org/github.com/modood/table?status.svg)](http://godoc.org/github.com/modood/table)\n\nProduces a string that represents slice of structs data in a text table, inspired by gajus/table.\n\n**Features:**\n\n-   No dependency.\n-   Cell content aligned.\n-   Column width self-adaptation\n-   Support type of struct field: int, float, string, bool, slice, struct, map, time.Time and everything.\n-   Support custom table header by declaring optional tag: `table`.(Thanks @skyfireitdiy)\n\nInstallation\n------------\n\n```\n$ go get github.com/modood/table\n```\n\nQuick start\n-----------\n\n```go\npackage main\n\nimport (\n\t\"github.com/modood/table\"\n)\n\ntype House struct {\n\tName  string `table:\"Name\"`\n\tSigil string\n\tMotto string\n}\n\nfunc main() {\n\ths := []House{\n\t\t{\"Stark\", \"direwolf\", \"Winter is coming\"},\n\t\t{\"Targaryen\", \"dragon\", \"Fire and Blood\"},\n\t\t{\"Lannister\", \"lion\", \"Hear Me Roar\"},\n\t}\n\n\t// Output to stdout\n\ttable.Output(hs)\n\n\t// Or just return table string and then do something\n\ts := table.Table(hs)\n\t_ = s\n}\n```\n\noutput:\n```\n┌───────────┬──────────┬──────────────────┐\n│ Name      │ Sigil    │ Motto            │\n├───────────┼──────────┼──────────────────┤\n│ Stark     │ direwolf │ Winter is coming │\n│ Targaryen │ dragon   │ Fire and Blood   │\n│ Lannister │ lion     │ Hear Me Roar     │\n└───────────┴──────────┴──────────────────┘\n```\n\nDocument\n--------\n\n-   `func Output(slice interface{})`\n\n    formats slice of structs data and writes to standard output.(Using box drawing characters)\n\n-   `func OutputA(slice interface{})`\n\n    formats slice of structs data and writes to standard output.(Using standard ascii characters)\n\n-   `func Table(slice interface{}) string`\n\n    formats slice of structs data and returns the resulting string.(Using box drawing characters)\n\n-   `func AsciiTable(slice interface{}) string`\n\n    formats slice of structs data and returns the resulting string.(Using standard ascii characters)\n\n-   compare [box drawing characters](http://unicode.org/charts/PDF/U2500.pdf) with [standard ascii characters](https://ascii.cl/)\n\n    box drawing:\n    ```\n    ┌───────────┬──────────┬──────────────────┐\n    │ Name      │ Sigil    │ Motto            │\n    ├───────────┼──────────┼──────────────────┤\n    │ Stark     │ direwolf │ Winter is coming │\n    │ Targaryen │ dragon   │ Fire and Blood   │\n    │ Lannister │ lion     │ Hear Me Roar     │\n    └───────────┴──────────┴──────────────────┘\n    ```\n\n    standard ascii:\n\n    ```\n    +-----------+----------+------------------+\n    | Name      | Sigil    | Motto            |\n    +-----------+----------+------------------+\n    | Stark     | direwolf | Winter is coming |\n    | Targaryen | dragon   | Fire and Blood   |\n    | Lannister | lion     | Hear Me Roar     |\n    +-----------+----------+------------------+\n    ```\n\n\nContributing\n------------\n\n1.  Fork it\n2.  Create your feature branch (`git checkout -b my-new-feature`)\n3.  Commit your changes (`git commit -am 'Add some feature'`)\n4.  Push to the branch (`git push origin my-new-feature`)\n5.  Create new Pull Request\n\nLicense\n-------\n\nthis repo is released under the [MIT License](http://www.opensource.org/licenses/MIT).\n","funding_links":[],"categories":["Misc"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodood%2Ftable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmodood%2Ftable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodood%2Ftable/lists"}