{"id":30210283,"url":"https://github.com/habedi/chilli","last_synced_at":"2025-08-23T01:34:51.919Z","repository":{"id":308244743,"uuid":"1031942778","full_name":"habedi/chilli","owner":"habedi","description":"A microframework for creating command-line applications in Zig","archived":false,"fork":false,"pushed_at":"2025-08-09T21:21:24.000Z","size":2808,"stargazers_count":29,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-14T08:01:53.101Z","etag":null,"topics":["cli","cli-framework","command-line","zig","zig-library","ziglang"],"latest_commit_sha":null,"homepage":"","language":"Zig","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/habedi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":["habedi"]}},"created_at":"2025-08-04T15:05:32.000Z","updated_at":"2025-08-13T18:35:34.000Z","dependencies_parsed_at":"2025-08-05T00:06:36.217Z","dependency_job_id":"9cf76212-6fc6-45b6-8209-202319f33f48","html_url":"https://github.com/habedi/chilli","commit_stats":null,"previous_names":["habedi/chilli"],"tags_count":3,"template":false,"template_full_name":"habedi/template-zig-project","purl":"pkg:github/habedi/chilli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/habedi%2Fchilli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/habedi%2Fchilli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/habedi%2Fchilli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/habedi%2Fchilli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/habedi","download_url":"https://codeload.github.com/habedi/chilli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/habedi%2Fchilli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271730133,"owners_count":24811041,"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","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"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-framework","command-line","zig","zig-library","ziglang"],"created_at":"2025-08-13T20:01:23.862Z","updated_at":"2025-08-23T01:34:51.862Z","avatar_url":"https://github.com/habedi.png","language":"Zig","readme":"\u003cdiv align=\"center\"\u003e\n  \u003cpicture\u003e\n    \u003cimg alt=\"Chilli Logo\" src=\"logo.svg\" height=\"25%\" width=\"25%\"\u003e\n  \u003c/picture\u003e\n\u003cbr\u003e\n\n\u003ch2\u003eChilli\u003c/h2\u003e\n\n[![Tests](https://img.shields.io/github/actions/workflow/status/habedi/chilli/tests.yml?label=tests\u0026style=flat\u0026labelColor=282c34\u0026logo=github)](https://github.com/habedi/chilli/actions/workflows/tests.yml)\n[![CodeFactor](https://img.shields.io/codefactor/grade/github/habedi/chilli?label=code%20quality\u0026style=flat\u0026labelColor=282c34\u0026logo=codefactor)](https://www.codefactor.io/repository/github/habedi/chilli)\n[![Zig Version](https://img.shields.io/badge/Zig-0.14.1-orange?logo=zig\u0026labelColor=282c34)](https://ziglang.org/download/)\n[![Docs](https://img.shields.io/github/v/tag/habedi/chilli?label=docs\u0026color=blue\u0026style=flat\u0026labelColor=282c34\u0026logo=read-the-docs)](https://habedi.github.io/chilli/)\n[![Examples](https://img.shields.io/github/v/tag/habedi/chilli?label=examples\u0026color=green\u0026style=flat\u0026labelColor=282c34\u0026logo=zig)](https://github.com/habedi/chilli/tree/main/examples)\n[![Release](https://img.shields.io/github/release/habedi/chilli.svg?label=release\u0026style=flat\u0026labelColor=282c34\u0026logo=github)](https://github.com/habedi/chilli/releases/latest)\n[![License](https://img.shields.io/badge/license-MIT-007ec6?label=license\u0026style=flat\u0026labelColor=282c34\u0026logo=open-source-initiative)](https://github.com/habedi/chilli/blob/main/LICENSE)\n\nA microframework for creating command-line applications in Zig\n\n\u003c/div\u003e\n\n---\n\nChilli is a lightweight command-line interface (CLI) framework for the Zig programming language.\nIts goal is to make it easy to create structured, maintainable, and user-friendly CLIs with minimal boilerplate,\nwhile being small and fast, and not getting in the way of your application logic.\n\n### Features\n\n- Provides a simple, low-overhead, declarative API for building CLI applications\n- Supports nested commands, subcommands, and aliases\n- Provides type-safe parsing for flags, positional arguments, and environment variables\n- Supports generating automatic `--help` and `--version` output with custom sections\n- Uses a shared context to pass application state\n- Written in pure Zig with no external dependencies\n\n---\n\n### Getting Started\n\nYou can add Chilli to your project and start using it by following the steps below.\n\n#### Installation\n\nRun the following command in the root directory of your project to download Chilli:\n\n```sh\nzig fetch --save=chilli \"https://github.com/habedi/chilli/archive/\u003cbranch_or_tag\u003e.tar.gz\"\n```\n\nReplace `\u003cbranch_or_tag\u003e` with the desired branch or tag, like `main` or `v0.1.0`.\nThis command will download Chilli and add it to Zig's global cache and update your project's `build.zig.zon` file.\n\n#### Adding to Build Script\n\nNext, modify your `build.zig` file to make Chilli available to your build target as a module.\n\n```zig\nconst std = @import(\"std\");\n\npub fn build(b: *std.Build) void {\n    const target = b.standardTargetOptions(.{});\n    const optimize = b.standardOptimizeOption(.{});\n\n    const exe = b.addExecutable(.{\n        .name = \"your-cli-app\",\n        .root_source_file = b.path(\"src/main.zig\"),\n        .target = target,\n        .optimize = optimize,\n    });\n\n    // 1. Get the dependency object from the builder\n    const chilli_dep = b.dependency(\"chilli\", .{});\n\n    // 2. Get chilli's top-level module\n    const chilli_module = chilli_dep.module(\"chilli\");\n\n    // 3. Add the module to your executable so you can @import(\"chilli\")\n    exe.root_module.addImport(\"chilli\", chilli_module);\n\n    b.installArtifact(exe);\n}\n```\n\n#### Using Chilli in an Application\n\nFinally, you can `@import(\"chilli\")` and start using it in your Zig application.\n\n```zig\nconst std = @import(\"std\");\nconst chilli = @import(\"chilli\");\n\n// A function for our command to execute\nfn greet(ctx: chilli.CommandContext) !void {\n    const name = try ctx.getFlag(\"name\", []const u8);\n    const excitement = try ctx.getFlag(\"excitement\", u32);\n\n    std.print(\"Hello, {s}\", .{name});\n    var i: u32 = 0;\n    while (i \u003c excitement) : (i += 1) {\n        std.print(\"!\", .{});\n    }\n    std.print(\"\\n\", .{});\n}\n\npub fn main() anyerror!void {\n    var gpa = std.heap.GeneralPurposeAllocator(.{}){};\n    defer _ = gpa.deinit();\n    const allocator = gpa.allocator();\n\n    // Create the root command for your application\n    var root_cmd = try chilli.Command.init(allocator, .{\n        .name = \"your-cli-app\",\n        .description = \"A new CLI built with Chilli\",\n        .version = \"v0.1.0\",\n        .exec = greet, // The function to run\n    });\n    defer root_cmd.deinit();\n\n    // Add flags to the command\n    try root_cmd.addFlag(.{\n        .name = \"name\",\n        .shortcut = 'n',\n        .description = \"The name to greet\",\n        .type = .String,\n        .default_value = .{ .String = \"World\" },\n    });\n    try root_cmd.addFlag(.{\n        .name = \"excitement\",\n        .type = .Int,\n        .description = \"How excited to be\",\n        .default_value = .{ .Int = 1 },\n    });\n\n    // Hand control over to the framework\n    try root_cmd.run(null);\n}\n```\n\n---\n\n### Documentation\n\nYou can find the full API documentation for the latest release of Chilli [here](https://habedi.github.io/chilli/).\n\nAlternatively, you can use the `make docs` command to generate the API documentation for the current version of Chilli\nfrom the source code.\nThis will generate HTML documentation in the `docs/api` directory, which you can serve locally with `make serve-docs`\nand view in your web browser at [http://localhost:8000](http://localhost:8000).\n\n\u003e [!NOTE]\n\u003e To generate the documentation, you need to have Zig (version 0.14.1) and Python 3 installed on your system.\n\n### Examples\n\nCheck out the [examples](examples/README.md) directory for examples of how Chilli can be used to build a variety of CLI\napplications.\n\n### Feature Roadmap\n\n-   [x] **Command Structure**\n    -   [x] Nested commands and subcommands\n    -   [x] Command aliases and single-character shortcuts\n    -   [x] Persistent flags (flags on parent commands are available to children)\n\n-   [x] **Argument \u0026 Flag Parsing**\n    -   [x] Long flags (`--verbose`), short flags (`-v`), and grouped boolean flags (`-vf`)\n    -   [x] Positional Arguments (supports required, optional, and variadic)\n    -   [x] Type-safe access for flags and arguments (e.g., `ctx.getFlag(\"count\", i64)`)\n    -   [x] Reading flag values from environment variables\n\n-   [x] **Help \u0026 Usage Output**\n    -   [x] Automatic and context-aware `--help` flag\n    -   [x] Automatic `--version` flag\n    -   [x] Clean, aligned help output for commands, flags, and arguments\n    -   [x] Grouping subcommands into custom sections\n\n-   [x] **Developer Experience**\n    -   [x] Simple, declarative API for building commands\n    -   [x] Named access for all flags and arguments\n    -   [x] Shared context data for passing application state\n    -   [ ] Deprecation notices for commands or flags\n    -   [ ] Built-in TUI components (like spinners and progress bars)\n    -   [ ] Automatic command history and completion\n\n---\n\n### Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to make a contribution.\n\n### License\n\nChilli is licensed under the MIT License (see [LICENSE](LICENSE)).\n\n### Acknowledgements\n\n* The logo is from [SVG Repo](https://www.svgrepo.com/svg/45673/chili-pepper).\n","funding_links":["https://github.com/sponsors/habedi"],"categories":["Zig"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhabedi%2Fchilli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhabedi%2Fchilli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhabedi%2Fchilli/lists"}