{"id":17309979,"url":"https://github.com/metafates/go-template","last_synced_at":"2025-04-14T13:55:05.441Z","repository":{"id":103000298,"uuid":"540918406","full_name":"metafates/go-template","owner":"metafates","description":"☄️ Powerful template for Go CLI projects with advanced config management","archived":false,"fork":false,"pushed_at":"2023-05-15T16:06:32.000Z","size":144,"stargazers_count":25,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T02:53:33.644Z","etag":null,"topics":["cli","go","template"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/metafates.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-09-24T17:52:50.000Z","updated_at":"2024-11-28T08:47:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"a1db65db-e81f-4b4b-8240-02d905bc1932","html_url":"https://github.com/metafates/go-template","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metafates%2Fgo-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metafates%2Fgo-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metafates%2Fgo-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metafates%2Fgo-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metafates","download_url":"https://codeload.github.com/metafates/go-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248892333,"owners_count":21178816,"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","go","template"],"created_at":"2024-10-15T12:34:13.629Z","updated_at":"2025-04-14T13:55:05.432Z","avatar_url":"https://github.com/metafates.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go CLI Project Template ☄️\n\nPowerful template for Go CLI applications with advanced config management\n\n\u003cimg width=\"912\" alt=\"Screenshot 2022-10-05 at 11 14 32\" src=\"https://user-images.githubusercontent.com/62389790/194013247-897697ee-4b32-4b5d-9667-462fcc45e161.png\"\u003e\n\n\n## Features\n\n- Advanced config management with [viper](https://github.com/spf13/viper) and\n  useful config commands such as setting config values directly from CLI (like this `config set -k logs.write -v true`),\n  reading env variables and file-based configuration (either TOML or YAML). Also, configuration is self-documented, type `config info` to show every config field available with description for each.\n\n- Cache \u0026 Temp files management with `clear` command\n\n- Polished CLI experience with [cobra](https://github.com/spf13/cobra) + [coloredcobra](https://github.com/ivanpirog/coloredcobra) to make things look pretty\n\n- [Afero](https://github.com/spf13/afero) filesystem for various fs utils, abstractions and in-memory fs for testing.\n  For example, instead of `os.Remove(\"file\")` use `filesystem.Api().Remove(\"file\")`\n\n- Easy to use path management with `where` package\n\n- Logging to file\n\n- Icons!\n\n- Predefined lipgloss colors\n\n## How to use\n\nPress this shiny green button on top\n\n\u003cimg width=\"203\" alt=\"Screenshot 2022-09-30 at 13 37 30\" src=\"https://user-images.githubusercontent.com/62389790/193252456-42b966a7-2679-4868-bf25-d862524733ee.png\"\u003e\n\nThen you would probably want to rename go mod name from `github.com/metafates/go-template` to something else.\nTo do this you could use your IDE refactor features or run [just](https://github.com/casey/just) target.\n\n```shell\njust rename github.com/username/repo\n```\n\nThis will prompt you to type a new name and will replace every occurence of the old go mod name with the new one.\n\n## Further usage\n\n### Changing name of the app\n\nChange the value of the constant `Name` at [app/meta.go](https://github.com/metafates/go-template/blob/main/app/meta.go)\n\n### Changing config file format from TOML from YAML\n\nChange the value of the constant `ConfigFormat` at [config/init.go](https://github.com/metafates/go-template/blob/main/config/init.go)\n\n### Declaring new config fields\n\nFirstly, declare a field key name as a constant inside [key/keys.go](https://github.com/metafates/go-template/blob/main/key/keys.go)\n\nThen put them inside [config/default.go](https://github.com/metafates/go-template/blob/0a71f1da1c51415469067edbfbe4cbb90e06ef13/config/default.go#L8:L23) (take a predefined fields for logging as a reference)\n\nFor example\n\n```go\n// key/keys.go\n\nconst IconType = \"icon.type\"\n```\n\n```go\n// config/default.go\n\n{\n  constant.IconType, // config field key\n  \"emoji\", // default value\n  \"What type of icons to use\", // description\n}\n```\n\n### Accessing config fields\n\nFor the example above it would be `viper.GetString(key.EmojiType)`. See [viper](https://github.com/spf13/viper) for more information\n\n\n## Something is not clear?\n\nPlease, [open an issue](https://github.com/metafates/go-template/issues/new) so I could document it\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetafates%2Fgo-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetafates%2Fgo-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetafates%2Fgo-template/lists"}