{"id":35025461,"url":"https://github.com/srdjan/zigcli","last_synced_at":"2026-05-22T19:33:44.100Z","repository":{"id":328497483,"uuid":"1115763642","full_name":"srdjan/zigcli","owner":"srdjan","description":"Advent Of Code 2025: Exploring the \"Safe DSL Surface with an Unsafe Engine Under the Hood\" Pattern in CLI Parsing","archived":false,"fork":false,"pushed_at":"2025-12-13T14:16:04.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-08T12:35:30.686Z","etag":null,"topics":["experimental","fun","zig"],"latest_commit_sha":null,"homepage":"","language":"Zig","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/srdjan.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-13T14:01:30.000Z","updated_at":"2025-12-13T14:16:07.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/srdjan/zigcli","commit_stats":null,"previous_names":["srdjan/zigcli"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/srdjan/zigcli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srdjan%2Fzigcli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srdjan%2Fzigcli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srdjan%2Fzigcli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srdjan%2Fzigcli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/srdjan","download_url":"https://codeload.github.com/srdjan/zigcli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srdjan%2Fzigcli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33362365,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-21T12:23:38.849Z","status":"online","status_checked_at":"2026-05-22T02:00:06.671Z","response_time":265,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["experimental","fun","zig"],"created_at":"2025-12-27T06:20:54.654Z","updated_at":"2026-05-22T19:33:44.091Z","avatar_url":"https://github.com/srdjan.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zigcli — a tiny type-safe Zig embedded DSL for CLI parsing\n\nThis repo is a prototype showing the **\"safe DSL surface / unsafe engine under the hood\"** pattern applied to CLI parsing.\n\n## What you get\n\n- **Typed results**: `parseOutcome()` returns a tagged union of subcommands with strongly typed structs.\n- **No help drift**: help output is derived from the same compile-time spec as parsing.\n- **Good diagnostics**: errors carry token index + token + optional suggestion.\n- **Lists**: repeatable flags like `--tag a --tag b` become slices (`[]const T`).\n- **Arena-owned list storage**: list memory is freed automatically by `Owned.deinit()`.\n\n## Quick start\n\n```bash\nzig build run -- serve --host 127.0.0.1 --port 8080 -vv --tag a --tag b\nzig build run -- gen outdir --force\nzig build run -- serve --help\n```\n\n## Example spec\n\nSee `examples/mytool.zig`.\n\n```zig\nconst cli = @import(\"zigcli\");\n\nconst Mode = enum { fast, slow };\n\nconst App = cli.App(cli.app(.{\n  .name = \"mytool\",\n  .commands = .{\n    cli.cmd(\"serve\", .{\n      .about = \"Run server\",\n      .opts = .{\n        cli.opt.str(\"host\", .{ .long=\"--host\", .default=\"127.0.0.1\" }),\n        cli.opt.u16(\"port\", .{ .long=\"--port\", .short='p', .default=8080 }),\n        cli.opt.count(\"verbose\", .{ .long=\"--verbose\", .short='v' }),\n        cli.opt.listStr(\"tag\", .{ .long=\"--tag\", .short='t' }),\n        cli.opt.enumT(\"mode\", Mode, .{ .long=\"--mode\", .default=.fast }),\n      },\n      .rest = cli.rest.capture(\"extra\"),\n    }),\n  },\n}));\n```\n\n## Notes / limitations (MVP)\n\n- List values preserve order and are backed by an arena.\n- String list elements (`listStr`) store slices pointing into `argv` (owned by `Owned.args`), so they are safe for the lifetime of `Owned`.\n- Suggestions use a small bounded edit-distance with threshold ≤ 2.\n\n## License\n\nMIT (feel free to use/modify).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrdjan%2Fzigcli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrdjan%2Fzigcli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrdjan%2Fzigcli/lists"}