{"id":13410242,"url":"https://github.com/cristalhq/acmd","last_synced_at":"2025-04-05T18:06:43.336Z","repository":{"id":40804392,"uuid":"421867691","full_name":"cristalhq/acmd","owner":"cristalhq","description":"Simple, useful and opinionated CLI package in Go.","archived":false,"fork":false,"pushed_at":"2024-04-26T21:41:31.000Z","size":101,"stargazers_count":123,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T22:16:57.920Z","etag":null,"topics":["cli","command-line","go","golang"],"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/cristalhq.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-27T15:13:31.000Z","updated_at":"2025-03-23T12:03:27.000Z","dependencies_parsed_at":"2023-12-17T11:32:10.618Z","dependency_job_id":"433a25eb-433f-4a3d-9794-85f541a21df9","html_url":"https://github.com/cristalhq/acmd","commit_stats":{"total_commits":79,"total_committers":6,"mean_commits":"13.166666666666666","dds":0.1392405063291139,"last_synced_commit":"efdb16f36cd6341bca248c513de1d6aa46794645"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristalhq%2Facmd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristalhq%2Facmd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristalhq%2Facmd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristalhq%2Facmd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cristalhq","download_url":"https://codeload.github.com/cristalhq/acmd/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247378141,"owners_count":20929296,"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":["cli","command-line","go","golang"],"created_at":"2024-07-30T20:01:05.747Z","updated_at":"2025-04-05T18:06:43.310Z","avatar_url":"https://github.com/cristalhq.png","language":"Go","funding_links":[],"categories":["Command Line","Build Automation","命令行","cli"],"sub_categories":["Standard CLI","标准CLI"],"readme":"# acmd\n\n[![build-img]][build-url]\n[![pkg-img]][pkg-url]\n[![reportcard-img]][reportcard-url]\n[![coverage-img]][coverage-url]\n[![version-img]][version-url]\n\nSimple, useful and opinionated CLI package in Go. For config loader see [cristalhq/aconfig](https://github.com/cristalhq/aconfig)\n\n## Rationale\n\nPopular CLI libraries (or better frameworks) have too large and unclear API, in most cases, you just want to define commands for your CLI application and run them without additional work. This package does this by providing a small API, good defaults and clear code.\n\n## Features\n\n* Simple API.\n* Dependency-free.\n* Clean and tested code.\n* Command aliases.\n* Auto suggesting command.\n* Builtin `help` and `version` commands.\n\nSee [docs][pkg-url] and [GUIDE.md](GUIDE.md) for more details.\n\n## Install\n\nGo version 1.17+\n\n```\ngo get github.com/cristalhq/acmd\n```\n\n## Example\n\n```go\ncmds := []acmd.Command{\n\t{\n\t\tName:        \"now\",\n\t\tDescription: \"prints current time\",\n\t\tExecFunc: func(ctx context.Context, args []string) error {\n\t\t\tfmt.Printf(\"now: %s\\n\", now.Format(\"15:04:05\"))\n\t\t\treturn nil\n\t\t},\n\t},\n\t{\n\t\tName:        \"status\",\n\t\tDescription: \"prints status of the system\",\n\t\tExecFunc: func(ctx context.Context, args []string) error {\n\t\t\t// do something with ctx :)\n\t\t\treturn nil\n\t\t},\n\t},\n}\n\n// all the acmd.Config fields are optional\nr := acmd.RunnerOf(cmds, acmd.Config{\n\tAppName:        \"acmd-example\",\n\tAppDescription: \"Example of acmd package\",\n\tVersion:        \"the best v0.x.y\",\n\t// Context - if nil `signal.Notify` will be used\n\t// Args - if nil `os.Args[1:]` will be used\n\t// Usage - if nil default print will be used\n})\n\nif err := r.Run(); err != nil {\n\tr.Exit(err)\n}\n```\n\nSee examples: [example_test.go](example_test.go).\n\n## License\n\n[MIT License](LICENSE).\n\n[build-img]: https://github.com/cristalhq/acmd/workflows/build/badge.svg\n[build-url]: https://github.com/cristalhq/acmd/actions\n[pkg-img]: https://pkg.go.dev/badge/cristalhq/acmd\n[pkg-url]: https://pkg.go.dev/github.com/cristalhq/acmd\n[reportcard-img]: https://goreportcard.com/badge/cristalhq/acmd\n[reportcard-url]: https://goreportcard.com/report/cristalhq/acmd\n[coverage-img]: https://codecov.io/gh/cristalhq/acmd/branch/main/graph/badge.svg\n[coverage-url]: https://codecov.io/gh/cristalhq/acmd\n[version-img]: https://img.shields.io/github/v/release/cristalhq/acmd\n[version-url]: https://github.com/cristalhq/acmd/releases\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcristalhq%2Facmd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcristalhq%2Facmd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcristalhq%2Facmd/lists"}