{"id":47469460,"url":"https://github.com/indiscipline/cozycliparser","last_synced_at":"2026-04-08T07:00:42.592Z","repository":{"id":343542251,"uuid":"1177402281","full_name":"indiscipline/cozycliparser","owner":"indiscipline","description":"CLI parser builder, a thin but useful wrapper over `std/parseopt`","archived":false,"fork":false,"pushed_at":"2026-03-10T19:00:10.000Z","size":71,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-11T00:34:50.180Z","etag":null,"topics":["cli","cli-parser","command-line","command-line-parser","nim"],"latest_commit_sha":null,"homepage":"https://indiscipline.github.io/cozycliparser/","language":"Nim","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/indiscipline.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":"CLA.md"}},"created_at":"2026-03-10T01:51:26.000Z","updated_at":"2026-03-10T18:57:35.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/indiscipline/cozycliparser","commit_stats":null,"previous_names":["indiscipline/cozycliparser"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/indiscipline/cozycliparser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indiscipline%2Fcozycliparser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indiscipline%2Fcozycliparser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indiscipline%2Fcozycliparser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indiscipline%2Fcozycliparser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/indiscipline","download_url":"https://codeload.github.com/indiscipline/cozycliparser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indiscipline%2Fcozycliparser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31544087,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"online","status_checked_at":"2026-04-08T02:00:06.127Z","response_time":54,"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":["cli","cli-parser","command-line","command-line-parser","nim"],"created_at":"2026-03-24T21:00:36.761Z","updated_at":"2026-04-08T07:00:42.567Z","avatar_url":"https://github.com/indiscipline.png","language":"Nim","funding_links":[],"categories":["Development Tools"],"sub_categories":["Command-Line Interface Automation"],"readme":"# Cozy CLI Parser\n[![License](https://img.shields.io/badge/license-GPLv2%2B-blue.svg)](LICENSE)\n\n\u003e Command-Line Parser Builder for Nim.\n\nCozy CLI Parser provides a thin convenience wrapper over `std/parseopt`.\nIt exports a `macro buildParser` which generates a command-line parser\nfrom a set of regular, fully type-checked procedure calls and option-handling closures.\n\n- A single place to declare options, flags and arguments — not\n  three (parser, help text, shortNoVal/longNoVal set and seq).\n- Low-magic implementation: no cryptic compiler errors.\n- Same DIY stdlib approach: parsing only, handling is fully in your control.\n- No idiosyncratic DSL: just regular Nim checked by the compiler.\n- Declaration and handling code are co-located and cannot go out of sync.\n- Slim code, no dependencies beyond `std/[parseopt, strutils, terminal, envvars]`.\n- Colorized help strings.\n\n## Installation\n\n**Relies on Nim devel** (\u003e=2.3.1) due to using\n[recent](https://github.com/nim-lang/Nim/pull/25506) `std/parseopt` changes.\nUp-to-date Nimble should be able to install development nim with\n`nimble install nim@#devel`.\n\nCozy CLI Parser is in the [nimble directory](https://nimble.directory/pkg/cozycliparser), use\n`atlas` or `nimble` to install:\n\n```bash\natlas use cozycliparser\n```\n\n```bash\nnimble install cozycliparser\n```\n\n## Documentation\nThe rendered API documentation and detailed guides are located in the `docs`\ndirectory and are available online at\n[indiscipline.github.io/cozycliparser](https://indiscipline.github.io/cozycliparser).\n\n## Usage example\n\nCall `macro buildParser` with a program name, a help namespace name, a parser\nmode, and a declarative body. The `opt`, `flag`, `arg` and `cmd` routines\nregister options, flags, positional arguments and subcommands along with their\nhandlers — closures passed as the last argument. The handlers are invoked when\nthe parser meets the corresponding input.\n\n\u003c!-- EXAMPLE_START --\u003e\n```nim\nimport cozycliparser\n\ntype Options = object\n  output: string\n  input: string\n  verbose: bool\n  greetName: string = \"world\"\n\nvar options: Options\nbuildParser(parserConfig(helpPrefix = \"Greeter v0.1\\nThis program greets.\"),\n            \"greeter\", \"Cli\", GnuMode):\n  opt('\\0', \"output\", \"Output file\", \"FILE\") do (val: string):\n    options.output = val\n  flag('v', \"verbose\", \"Enable verbose output\") do ():\n    options.verbose = true\n  arg(\"INPUT\", \"Input file\") do (val: string):\n    options.input = val\n  cmd(\"greet\", \"Greets NAME\") do ():\n    arg(\"NAME\", \"Name to greet\") do (val: string):\n      if val != \"\": options.greetName = val\n      echo \"Hello \", options.greetName\n  cmd(\"version\", \"Displays version and quits\") do ():\n    run do ():\n      quit(\"v0.42\", 0)\n\n# HelpText namespace is automatically built and injected in scope:\ndoAssert $Cli.help == \"\"\"Greeter v0.1\nThis program greets.\n\nUsage: greeter [options] INPUT \u003cgreet|version\u003e\n\nArguments:\n  INPUT  Input file\n\nCommands:\n  greet    Greets NAME\n  version  Displays version and quits\n\nOptions:\n  --output=FILE  Output file\n  -v, --verbose  Enable verbose output\n  -h, --help     Show this help and exit\"\"\"\n\n# Display colorized help for the program and subcommands with:\nCli.help.display()\n\nCli.help(\"greet\").display()\n```\n\u003c!-- EXAMPLE_END --\u003e\n\n*By default, a `-h`/`--help` flag is auto-injected at every parser level,\nproviding styled, nested help outputs natively.*\n\nSee [module documentation](https://indiscipline.github.io/cozycliparser) for\ndetails and many more examples.\n\n## TODO:\n\n- [ ] Propose standard library inclusion, close [#12425](https://github.com/nim-lang/Nim/issues/12425).\n\n## Contributing\nThe project is open for contributions.\nSimplifying and reducing loc is preferable to expanding the feature set.\n\n**Important:** In order to facilitate possible standard library inclusion,\nall contributors must agree to the [Contributor License Agreement (CLA)](CLA.md).\nThis guarantees that the Maintainer has the right to\nsubmit the Project's code for inclusion into the Nim language Standard Library.\nWhile your contributions will be distributed under GPL-2.0-or-later for this\nproject, the CLA explicitly grants the Maintainer the right to relicense your\ncontribution under the **MIT License** solely for the purpose of proposing its\ninclusion into the official Nim Standard Library.\n\n## License\nCozy CLI Parser is licensed under GNU General Public License version 2.0 or later.\nSee [`LICENSE`](LICENSE) for full details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findiscipline%2Fcozycliparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Findiscipline%2Fcozycliparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findiscipline%2Fcozycliparser/lists"}