{"id":20355878,"url":"https://github.com/hedzr/cmdr-loaders","last_synced_at":"2026-02-15T05:07:34.291Z","repository":{"id":234866349,"uuid":"789651497","full_name":"hedzr/cmdr-loaders","owner":"hedzr","description":"loaders of the external sources, for cmdr v2","archived":false,"fork":false,"pushed_at":"2026-01-24T10:53:37.000Z","size":307,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-24T21:37:27.591Z","etag":null,"topics":["configuration-files","env","hcl2","hjson","json","nestedtext","toml","yaml"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hedzr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"custom":"https://paypal.me/hezr/3"}},"created_at":"2024-04-21T06:53:51.000Z","updated_at":"2026-01-24T10:52:05.000Z","dependencies_parsed_at":"2024-04-21T08:22:02.257Z","dependency_job_id":"3856dd65-54a3-4967-9cc9-0934bd0df39e","html_url":"https://github.com/hedzr/cmdr-loaders","commit_stats":null,"previous_names":["hedzr/cmdr-loaders"],"tags_count":75,"template":false,"template_full_name":null,"purl":"pkg:github/hedzr/cmdr-loaders","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hedzr%2Fcmdr-loaders","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hedzr%2Fcmdr-loaders/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hedzr%2Fcmdr-loaders/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hedzr%2Fcmdr-loaders/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hedzr","download_url":"https://codeload.github.com/hedzr/cmdr-loaders/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hedzr%2Fcmdr-loaders/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29469953,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T04:35:06.950Z","status":"ssl_error","status_checked_at":"2026-02-15T04:33:41.357Z","response_time":118,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["configuration-files","env","hcl2","hjson","json","nestedtext","toml","yaml"],"created_at":"2024-11-14T23:14:22.493Z","updated_at":"2026-02-15T05:07:34.276Z","avatar_url":"https://github.com/hedzr.png","language":"Go","funding_links":["https://paypal.me/hezr/3"],"categories":[],"sub_categories":[],"readme":"# Loaders for cmdr/v2\n\n![Go](https://github.com/hedzr/cmdr-loaders/workflows/Go/badge.svg)\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/hedzr/cmdr-loaders)\n[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/hedzr/cmdr-loaders.svg?label=release)](https://github.com/hedzr/cmdr-loaders/releases)\n\nLocal configuration file loaders for various file formats, such as YAML, TOML, HCL, and much more.\n\nThis is an addon library especially for [cmdr/v2](https://github.com/hedzr/cmdr).\n\nThe typical app is [cmdr-test/examples/large](https://github.com/hedzr/cmdr-tests/blob/master/examples/large).\n\n![image-20241111141228632](https://cdn.jsdelivr.net/gh/hzimg/blog-pics@master/upgit/2024/11/20241111_1731305562.png)\n\nA tiny app using `cmdr/v2` and `cmdr-loaders` is:\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\tloaders \"github.com/hedzr/cmdr-loaders\"\n\t\"github.com/hedzr/cmdr/v2\"\n\t\"github.com/hedzr/cmdr/v2/cli\"\n\t\"github.com/hedzr/cmdr/v2/examples/common\"\n\t\"github.com/hedzr/cmdr/v2/examples/blueprint/cmd\"\n\t\"github.com/hedzr/cmdr/v2/examples/devmode\"\n\t\"github.com/hedzr/cmdr/v2/pkg/logz\"\n)\n\nconst (\n\tappName = \"blueprint\"\n\tdesc    = `a good blueprint for you.`\n\tversion = cmdr.Version\n\tauthor  = `The Examples Authors`\n)\n\nfunc main() {\n\tctx := context.Background()\t\n\tapp := prepareApp(cmd.Commands...) // define your own commands implementations with cmd/*.go\n\tif err := app.Run(ctx); err != nil {\n\t\tlogz.ErrorContext(ctx, \"Application Error:\", \"err\", err) // stacktrace if in debug mode/build\n\t\tos.Exit(app.SuggestRetCode())\n\t} else if rc := app.SuggestRetCode(); rc != 0 {\n\t\tos.Exit(rc)\n\t}\n}\n\nfunc prepareApp(commands ...cli.CmdAdder) cli.App {\n\treturn loaders.Create(\n\t\tappName, version, author, desc,\n\t\tappend([]cli.Opt{\n\t\t\tcmdr.WithAutoEnvBindings(true),  // default it's false\n\t\t\tcmdr.WithSortInHelpScreen(true), // default it's false\n\t\t\t// cmdr.WithDontGroupInHelpScreen(false), // default it's false\n\t\t\t// cmdr.WithForceDefaultAction(false),\n\t\t})...,\n\t).\n\t\t// importing devmode package and run its init():\n\t\tWith(func(app cli.App) { logz.Debug(\"in dev mode?\", \"mode\", devmode.InDevelopmentMode()) }).\n\t\tWithBuilders(\n\t\t\tcommon.AddHeadLikeFlagWithoutCmd, // add a `--line` option, feel free to remove it.\n\t\t\tcommon.AddToggleGroupFlags,       //\n\t\t\tcommon.AddTypedFlags,             //\n\t\t\tcommon.AddKilobytesFlag,          //\n\t\t\tcommon.AddValidArgsFlag,          //\n\t\t).\n\t\tWithAdders(commands...).\n\t\tBuild()\n}\n```\n\nand `cmd/...` at:\n\n- [cmd/](https://github.com/hedzr/cmdr-tests/blob/master/examples/blueprint/cmd/)\n\nSee also:\n\n- [cmdr/v2](https://github.com/hedzr/cmdr)\n- [blueprint app - cmdr-tests](https://github.com/hedzr/cmdr-tests/blob/master/examples/blueprint/)\n\n## History\n\nSee full list in [CHANGELOG](https://github.com/hedzr/cmdr-loaders/blob/master/CHANGELOG)\n\n## License\n\nApache 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhedzr%2Fcmdr-loaders","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhedzr%2Fcmdr-loaders","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhedzr%2Fcmdr-loaders/lists"}