{"id":13410710,"url":"https://github.com/mszostok/version","last_synced_at":"2025-07-28T07:32:14.407Z","repository":{"id":56819502,"uuid":"516885482","full_name":"mszostok/version","owner":"mszostok","description":"🧬 Pure DNA of your CLI!","archived":false,"fork":false,"pushed_at":"2023-07-24T03:24:03.000Z","size":53696,"stargazers_count":95,"open_issues_count":19,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-07-31T20:43:42.454Z","etag":null,"topics":["cobra","debug","go","golang","goreleaser","hacktoberfest","readbuildinfo","runtime","version","versioninfo"],"latest_commit_sha":null,"homepage":"https://version.szostok.io","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/mszostok.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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}},"created_at":"2022-07-22T21:00:02.000Z","updated_at":"2024-07-28T13:39:38.000Z","dependencies_parsed_at":"2024-01-08T14:30:55.271Z","dependency_job_id":"f9b0e2ec-44af-46bf-81ab-86b26fa8041c","html_url":"https://github.com/mszostok/version","commit_stats":{"total_commits":115,"total_committers":2,"mean_commits":57.5,"dds":"0.10434782608695647","last_synced_commit":"b5018659593902b2eb1cab06b02dcc8c97ea6d69"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mszostok%2Fversion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mszostok%2Fversion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mszostok%2Fversion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mszostok%2Fversion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mszostok","download_url":"https://codeload.github.com/mszostok/version/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227877761,"owners_count":17833559,"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","debug","go","golang","goreleaser","hacktoberfest","readbuildinfo","runtime","version","versioninfo"],"created_at":"2024-07-30T20:01:08.563Z","updated_at":"2024-12-03T08:14:40.213Z","avatar_url":"https://github.com/mszostok.png","language":"Go","readme":"```go\nimport \"go.szostok.io/version\"\n```\n\nGo package to present your CLI version in **a classy way**. All magic included!\n\n![](docs/assets/preview.gif)\n\nLike the idea? Give a GitHub star ⭐!\n\n## Quick Start\n\n```bash\ngo get go.szostok.io/version\n```\n\nVisit [`version.szostok.io/quick-start`](https://version.szostok.io/quick-start) for the most popular way of the setup.\n\n## Documentation\n\nVisit [`version.szostok.io`](https://version.szostok.io) for complete documentation about setup and usage.\n\n## Why?\n\nIf you create a new CLI, it's natural that you use a framework such as Cobra, `urfave/cli`, or similar. Each of your CLIs has also an option to show its version. But in this case, we repeat the same stuff: collecting and displaying related information.\n\nThis package aims to solve that problem. To register the version command, simply add:\n\n```go\nextension.NewVersionCobraCmd()\n```\n\nGo 1.18 simplified collecting version-related data, as commit, date, and other data are embedded. You can still override these fields with ldflags, e.g.:\n\n```bash\n-X go.szostok.io/version.version=1.42.0\n```\n\nYou can gain more features, such as upgrade notice, just by adding:\n\n```go\nextension.WithUpgradeNotice(\"repo-owner\", \"repo-name\")\n```\n\n## Functionality\n\n- For Go 1.18+, detect `version`, `commit`, `commitDate`, and `dirtyBuild` automatically\n  - Allow version data overriding via `-ldflags`\n- Print the version in the YAML, JSON, short, and pretty formats\n- Detect and display an upgrade notice if a newer version of your project has been released\n- Automatically disable color output for non-tty output streams\n  - Handle the version and upgrade notices separately\n- Designed in a way that lets you use each component individually\n- Everything can be enabled with a single line of code. For example, use `extension.NewVersionCobraCmd()` to enable the version command for Cobra\n- Customize the output format and behaviour (e.g. timeouts, re-check intervals)\n- Parse any dates and print them in the local date and time format\n- All provided functionality is fully tested to ensure no regression\n- Extend the version info with own fields just by assigning your Go struct\n\u003c!--- - Autodiscover installation method ---\u003e\n\n## \u003cimg src=\"./docs/assets/bell-icon.png\" /\u003e Stay informed\n\nFollow [@m_szostok](https://twitter.com/m_szostok) on Twitter to get the latest news. You can also subscribe for new [`version`](https://github.com/mszostok/version/releases) releases on GitHub, where you can find a detailed changelog for each of them.\n\nFor additional content, check [Mateusz Szostok's blog](https://szostok.io).\n","funding_links":[],"categories":["命令行","Command Line","Build Automation"],"sub_categories":["标准CLI","Standard CLI"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmszostok%2Fversion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmszostok%2Fversion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmszostok%2Fversion/lists"}