{"id":46064445,"url":"https://github.com/gowww/cli","last_synced_at":"2026-03-01T12:05:49.833Z","repository":{"id":57499497,"uuid":"96939349","full_name":"gowww/cli","owner":"gowww","description":"🖥 Wrap the standard flag package for a cleaner CLI","archived":false,"fork":false,"pushed_at":"2020-09-15T10:55:24.000Z","size":15,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-14T06:02:10.692Z","etag":null,"topics":["cli","command","command-line","console","interface","terminal","tool"],"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/gowww.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-11T21:37:04.000Z","updated_at":"2020-09-15T10:55:26.000Z","dependencies_parsed_at":"2022-08-28T15:21:42.684Z","dependency_job_id":null,"html_url":"https://github.com/gowww/cli","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/gowww/cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gowww%2Fcli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gowww%2Fcli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gowww%2Fcli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gowww%2Fcli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gowww","download_url":"https://codeload.github.com/gowww/cli/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gowww%2Fcli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29969243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T11:43:06.159Z","status":"ssl_error","status_checked_at":"2026-03-01T11:43:03.887Z","response_time":124,"last_error":"SSL_read: 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":["cli","command","command-line","console","interface","terminal","tool"],"created_at":"2026-03-01T12:05:49.229Z","updated_at":"2026-03-01T12:05:49.824Z","avatar_url":"https://github.com/gowww.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [![gowww](https://avatars.githubusercontent.com/u/18078923?s=20)](https://github.com/gowww) cli [![GoDoc](https://godoc.org/github.com/gowww/cli?status.svg)](https://godoc.org/github.com/gowww/cli) [![Build](https://travis-ci.org/gowww/cli.svg?branch=master)](https://travis-ci.org/gowww/cli) [![Coverage](https://coveralls.io/repos/github/gowww/cli/badge.svg?branch=master)](https://coveralls.io/github/gowww/cli?branch=master) [![Go Report](https://goreportcard.com/badge/github.com/gowww/cli)](https://goreportcard.com/report/github.com/gowww/cli) ![Status Testing](https://img.shields.io/badge/status-testing-orange.svg)\n\nPackage [cli](https://godoc.org/github.com/gowww/cli) wraps the standard [flag](https://golang.org/pkg/flag/) package for a cleaner command line interface.\n\n## Installing\n\n1. Get package:\n\n\t```Shell\n\tgo get -u github.com/gowww/cli\n\t```\n\n2. Import it in your code:\n\n\t```Go\n\timport \"github.com/gowww/cli\"\n\t```\n\n## Usage\n\nHenceforth, by \"command\" we mean \"subcommand\" (like the `build` part in `go build`)…\n\nThe order in which you define commands and flags is important!  \nWhen you define a main flag, it will be added to the top-level flag set but also to all commands already defined.\n\nObviously, each command can also define its own flags.\n\nFor the sake of clarity for the developer and ease of use for the final user, the usage pattern is simple and always the same : `program [command] [flags]`. No flags before command, and no commands of commands.\n\n### Example\n\n```Go\npackage main\n\nimport \"github.com/gowww/cli\"\n\nvar (\n\tflagForMain    string // Flag \"-m\"\n\tflagForCommand string // Flag \"-c\"\n\tflagForAll     string // Flag \"-a\"\n)\n\nfunc main() {\n\tcli.SetUsageText(\"Command line interface example.\")\n\n\tcli.String(\u0026flagForMain, \"m\", \"\", \"Example flag for main function.\")\n\n\tcli.Command(\"command\", command, \"Example command.\").\n\t\tString(\u0026flagForCommand, \"c\", \"\", `Example flag for this command only.`)\n\n\tcli.String(\u0026flagForAll, \"a\", \"\", \"Example flag for main function and all commands defined previously.\")\n\n\tcli.Parse()\n}\n\nfunc command() {\n\t// Do the command job.\n}\n```\n\n#### Usage output\n\n##### For `example -help`\n\n```\nCommand line interface example.\n\nUsage:\n\n\texample [command] [flags]\n\nCommands:\n\n\tcommand  Example command.\n\nFlags:\n\n\t-a  Example flag for main function and all commands defined previously.\n\t-m  Example flag for main function.\n```\n\n##### For `example command -help`\n\n```\nExample command.\n\nUsage:\n\n\texample command [flags]\n\nFlags:\n\n\t-a  Example flag for main function and all commands defined previously.\n\t-c  Example flag for this command only.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgowww%2Fcli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgowww%2Fcli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgowww%2Fcli/lists"}