{"id":13569741,"url":"https://github.com/muesli/mango","last_synced_at":"2025-05-16T12:04:43.885Z","repository":{"id":40046381,"uuid":"447272190","full_name":"muesli/mango","owner":"muesli","description":"mango is a man-page generator for the Go flag, pflag, cobra, coral, and kong packages","archived":false,"fork":false,"pushed_at":"2023-09-04T12:38:29.000Z","size":76,"stargazers_count":259,"open_issues_count":4,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-02T05:55:51.711Z","etag":null,"topics":["cobra","coral","flag","go","kong","man-pages","pflag","self-documenting"],"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/muesli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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},"funding":{"github":"muesli"}},"created_at":"2022-01-12T15:34:12.000Z","updated_at":"2025-03-19T14:49:32.000Z","dependencies_parsed_at":"2024-01-14T03:47:46.490Z","dependency_job_id":"79c8cfcd-e090-45a4-af30-e4a4b727d9ed","html_url":"https://github.com/muesli/mango","commit_stats":{"total_commits":25,"total_committers":4,"mean_commits":6.25,"dds":0.24,"last_synced_commit":"412fe4c69b19b388fc5a931135a55359444e97ee"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muesli%2Fmango","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muesli%2Fmango/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muesli%2Fmango/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muesli%2Fmango/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/muesli","download_url":"https://codeload.github.com/muesli/mango/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247994120,"owners_count":21030050,"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":["cobra","coral","flag","go","kong","man-pages","pflag","self-documenting"],"created_at":"2024-08-01T14:00:43.580Z","updated_at":"2025-04-09T07:04:24.714Z","avatar_url":"https://github.com/muesli.png","language":"Go","funding_links":["https://github.com/sponsors/muesli"],"categories":["Go"],"sub_categories":[],"readme":"# mango\n\n[![Latest Release](https://img.shields.io/github/release/muesli/mango.svg?style=for-the-badge)](https://github.com/muesli/mango/releases)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=for-the-badge)](/LICENSE)\n[![Build Status](https://img.shields.io/github/workflow/status/muesli/mango/build?style=for-the-badge)](https://github.com/muesli/mango/actions)\n[![Go ReportCard](https://goreportcard.com/badge/github.com/muesli/mango?style=for-the-badge)](https://goreportcard.com/report/muesli/mango)\n[![Go Doc](https://img.shields.io/badge/godoc-reference-blue.svg?style=for-the-badge)](https://pkg.go.dev/github.com/muesli/mango)\n\nmango is a man-page generator for the Go flag, pflag, cobra, coral, and kong\npackages. It extracts commands, flags, and arguments from your program and\nenables it to self-document.\n\n## Adapters\n\nCurrently the following adapters exist:\n\n- flag: support for Go's standard flag package\n- [mango-cobra](https://github.com/muesli/mango-cobra): an adapter for [cobra](https://github.com/spf13/cobra)\n- [mango-coral](https://github.com/muesli/mango-coral): an adapter for [coral](https://github.com/muesli/coral)\n- [mango-kong](https://github.com/alecthomas/mango-kong): an adapter for [kong](https://github.com/alecthomas/kong)\n- [mango-pflag](https://github.com/muesli/mango-pflag): an adapter for the [pflag](https://github.com/spf13/pflag) package\n\n## Usage with flag:\n\n```go\nimport (\n    \"flag\"\n    \"fmt\"\n\n    \"github.com/muesli/mango\"\n    \"github.com/muesli/mango/mflag\"\n    \"github.com/muesli/roff\"\n)\n\nvar (\n    one = flag.String(\"one\", \"\", \"first value\")\n    two = flag.String(\"two\", \"\", \"second value\")\n)\n\nfunc main() {\n    flag.Parse()\n\n    manPage := mango.NewManPage(1, \"mango\", \"a man-page generator\").\n        WithLongDescription(\"mango is a man-page generator for Go.\\n\"+\n            \"Features:\\n\"+\n            \"* User-friendly\\n\"+\n            \"* Plugable\").\n        WithSection(\"Copyright\", \"(C) 2022 Christian Muehlhaeuser.\\n\"+\n            \"Released under MIT license.\")\n\n    flag.VisitAll(mflag.FlagVisitor(manPage))\n    fmt.Println(manPage.Build(roff.NewDocument()))\n}\n```\n\nMango will extract all the flags from your app and generate a man-page similar\nto this example:\n\n![mango](/mango.png)\n\n## Usage with pflag:\n\n```go\nimport (\n    \"fmt\"\n\n    \"github.com/muesli/mango\"\n    mpflag \"github.com/muesli/mango-pflag\"\n    \"github.com/muesli/roff\"\n    flag \"github.com/spf13/pflag\"\n)\n\nfunc main() {\n    flag.Parse()\n\n    manPage := mango.NewManPage(1, \"mango\", \"a man-page generator\").\n        WithLongDescription(\"mango is a man-page generator for Go.\").\n        WithSection(\"Copyright\", \"(C) 2022 Christian Muehlhaeuser.\\n\"+\n            \"Released under MIT license.\")\n\n    flag.VisitAll(mpflag.PFlagVisitor(manPage))\n    fmt.Println(manPage.Build(roff.NewDocument()))\n}\n```\n\n## Usage with cobra:\n\n```go\nimport (\n\t\"fmt\"\n\n\tmcobra \"github.com/muesli/mango-cobra\"\n\t\"github.com/muesli/roff\"\n\t\"github.com/spf13/cobra\"\n)\n\nvar (\n    rootCmd = \u0026cobra.Command{\n        Use:   \"mango\",\n        Short: \"A man-page generator\",\n    }\n)\n\nfunc main() {\n    manPage, err := mcobra.NewManPage(1, rootCmd)\n    if err != nil {\n        panic(err)\n    }\n\n    manPage = manPage.WithSection(\"Copyright\", \"(C) 2022 Christian Muehlhaeuser.\\n\"+\n        \"Released under MIT license.\")\n\n    fmt.Println(manPage.Build(roff.NewDocument()))\n}\n```\n\n## Usage with coral:\n\n```go\nimport (\n\t\"fmt\"\n\n\tmcoral \"github.com/muesli/mango-coral\"\n\t\"github.com/muesli/roff\"\n\t\"github.com/muesli/coral\"\n)\n\nvar (\n    rootCmd = \u0026coral.Command{\n        Use:   \"mango\",\n        Short: \"A man-page generator\",\n    }\n)\n\nfunc main() {\n    manPage, err := mcoral.NewManPage(1, rootCmd)\n    if err != nil {\n        panic(err)\n    }\n\n    manPage = manPage.WithSection(\"Copyright\", \"(C) 2022 Christian Muehlhaeuser.\\n\"+\n        \"Released under MIT license.\")\n\n    fmt.Println(manPage.Build(roff.NewDocument()))\n}\n```\n\n## Feedback\n\nGot some feedback or suggestions? Please open an issue or drop me a note!\n\n* [Twitter](https://twitter.com/mueslix)\n* [The Fediverse](https://mastodon.social/@fribbledom)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuesli%2Fmango","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuesli%2Fmango","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuesli%2Fmango/lists"}