{"id":37177360,"url":"https://github.com/praserx/afmt","last_synced_at":"2026-01-14T20:41:06.816Z","repository":{"id":57499167,"uuid":"145117631","full_name":"praserx/afmt","owner":"praserx","description":"Advanced fmt is extension of standard Golang fmt package. The main feature of afmt is pretty tree print (print structure to tree representation).","archived":true,"fork":false,"pushed_at":"2019-04-30T15:05:47.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-21T06:19:12.823Z","etag":null,"topics":["fmt","golang","pretty-print-tree","print","tree","tree-print","treeprint"],"latest_commit_sha":null,"homepage":"","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/praserx.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":"2018-08-17T12:25:39.000Z","updated_at":"2023-10-10T06:09:05.000Z","dependencies_parsed_at":"2022-08-28T15:21:14.124Z","dependency_job_id":null,"html_url":"https://github.com/praserx/afmt","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/praserx/afmt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praserx%2Fafmt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praserx%2Fafmt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praserx%2Fafmt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praserx%2Fafmt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/praserx","download_url":"https://codeload.github.com/praserx/afmt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praserx%2Fafmt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28434488,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T18:57:19.464Z","status":"ssl_error","status_checked_at":"2026-01-14T18:52:48.501Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["fmt","golang","pretty-print-tree","print","tree","tree-print","treeprint"],"created_at":"2026-01-14T20:41:06.227Z","updated_at":"2026-01-14T20:41:06.805Z","avatar_url":"https://github.com/praserx.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://travis-ci.org/PraserX/afmt.svg?branch=master)\n\n# Advanced formatter\n\nIt is an extension of standard Golang formatter. It contains (or it will contain) some advanced features for command line print. All features are described bellow.\n\n## Features\n\n- Line wrap (`PrintCol`)\n- Tree print (`PrintTree`)\n\n### PrintCol\n\nThe `PrintCol` function (and its derivations) allow wrap text based on integer specification. It means that you can set your stop mark and start print of text on the new line.\n\n```go\nafmt.PrintCol(80, \"This is my longest text ever.\")\n```\n\n### PrintTree\n\nThe TreePrinter expect any type as argument. It use interfaces, which are analyzed and printed. So you can use string, integer, array, structure and etc. The power of TreePrinter is that you can use any structure and TreePrinter prints it for you. There are many settings, which you can use.\n\nThe easiest way is to use function `PrintTree`: \n\n```go\nafmt.PrintTree(myStructure);\n```\n\nOn the other hand you can initialize TreePrinter with your own options:\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"os\"\n    \"github.com/PraserX/afmt\"\n)\n\ntype MyStructure struct {\n    Item1 string\n    Item2 bool\n    Item3 []string\n}\n\nfunc main() {\n    var err error\n    var result string\n\n    str := MyStructure{}\n    str.Item1 = \"Lorem ipsum dolor sit amet\"\n    str.Item2 = false\n    str.Item3 = []string{\"Lorem\", \"ipsum\"}\n\n    tp := afmt.NewTreePrinter()\n\n    if result, err = tp.Print(testValue); err != nil {\n        fmt.Fprintf(os.Stderr, \"Hmm something happened: %s\", err.Error())\n    }\n\n    fmt.Printf(result)\n}\n```\n\nSo as a result you can see something like:\n\n```\nMyStructure:\n├── Item1: Lorem ipsum dolor sit amet\n├── Item2: false\n└── Item3:\n    ├── Lorem\n    └── ipsum\n```\n\n## Planned features\n\n- Text padding\n- Progress bar\n\nIs something missing? Create issue and describe your idea!\n\n## License\n\nThis library is under MIT license.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpraserx%2Fafmt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpraserx%2Fafmt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpraserx%2Fafmt/lists"}