{"id":25014285,"url":"https://github.com/gregoryv/cmdline","last_synced_at":"2025-07-22T08:04:54.956Z","repository":{"id":51263749,"uuid":"200509799","full_name":"gregoryv/cmdline","owner":"gregoryv","description":"package cmdline provides a way to parse command line arguments","archived":false,"fork":false,"pushed_at":"2024-12-21T06:02:28.000Z","size":205,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-14T06:38:24.066Z","etag":null,"topics":[],"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/gregoryv.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"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,"zenodo":null}},"created_at":"2019-08-04T15:31:11.000Z","updated_at":"2024-12-21T06:02:31.000Z","dependencies_parsed_at":"2025-04-12T22:07:05.065Z","dependency_job_id":"abb9125b-4bd5-4985-bd5a-b550ee9a790c","html_url":"https://github.com/gregoryv/cmdline","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/gregoryv/cmdline","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregoryv%2Fcmdline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregoryv%2Fcmdline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregoryv%2Fcmdline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregoryv%2Fcmdline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gregoryv","download_url":"https://codeload.github.com/gregoryv/cmdline/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregoryv%2Fcmdline/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266454931,"owners_count":23931349,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-02-05T07:18:59.516Z","updated_at":"2025-07-22T08:04:54.931Z","avatar_url":"https://github.com/gregoryv.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- Generated by doc_test.go, DO NOT EDIT --\u003e\n\n[![Go](https://github.com/gregoryv/cmdline/actions/workflows/go.yml/badge.svg)](https://github.com/gregoryv/cmdline/actions/workflows/go.yml)\n[![Code coverage](https://codecov.io/gh/gregoryv/cmdline/branch/master/graph/badge.svg)](https://codecov.io/gh/gregoryv/cmdline)\n[![Maintainability](https://api.codeclimate.com/v1/badges/d1e0ac639370f6fc982e/maintainability)](https://codeclimate.com/github/gregoryv/cmdline/maintainability)\n\n\nPackage [cmdline](https://pkg.go.dev/pkg/github.com/gregoryv/cmdline) provides a parser for command line arguments.\nThis package is different from the builtin package flag.\n- Options are used when parsing arguments\n- Flag is a boolean option\n- Self documenting options are preferred\n- Multiname options, e.g. -n, --dry-run map to same option\n- Easy way to default to environment variables\n- There are no pointer variations\n- Parsing non option arguments\n- Usage output with optional examples and preface\n\n## Example\n\n    func ExampleNewBasicParser() {\n    \tos.Setenv(\"VERBOSE\", \"yes\")\n    \tvar (\n    \t\tcli\t\t= NewBasicParser()\n    \t\tuid\t\t= cli.Option(\"--uid\", \"Generated if not given\").Int(0)\n    \t\tpassword\t= cli.Option(\"-p, --password, $PASSWORD\").String(\"\")\n    \t\tverbose\t\t= cli.Flag(\"-V, --verbose, $VERBOSE\")\n    \t\trole\t\t= cli.Option(\"-r, --role\").Enum(\"guest\",\n    \t\t\t\"guest\", \"admin\", \"nobody\",\n    \t\t)\n    \t\turl\t= cli.Option(\"--test-host\").Url(\"tcp://example.com:123\")\n    \t\tdur\t= cli.Option(\"--pause\").Duration(\"200ms\")\n    \n    \t\t// parse and name non options\n    \t\tusername\t= cli.NamedArg(\"USERNAME\").String(\"\")\n    \t\tnote\t\t= cli.NamedArg(\"NOTE\").String(\"\")\n    \t)\n    \tcli.Parse()\n    \n    \tif !verbose {\n    \t\tlog.SetOutput(ioutil.Discard)\n    \t}\n    \tfmt.Fprintln(os.Stdout, uid, username, password, note, role, url, dur)\n    }\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregoryv%2Fcmdline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregoryv%2Fcmdline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregoryv%2Fcmdline/lists"}