88
99[ ![ Tests] ( https://img.shields.io/github/actions/workflow/status/habedi/chilli/tests.yml?label=tests&style=flat&labelColor=282c34&logo=github )] ( https://github.com/habedi/chilli/actions/workflows/tests.yml )
1010[ ![ CodeFactor] ( https://img.shields.io/codefactor/grade/github/habedi/chilli?label=code%20quality&style=flat&labelColor=282c34&logo=codefactor )] ( https://www.codefactor.io/repository/github/habedi/chilli )
11- [ ![ Zig Version] ( https://img.shields.io/badge/Zig-0.14 .1-orange?logo=zig&labelColor=282c34 )] ( https://ziglang.org/download/ )
12- [ ![ Docs] ( https://img.shields.io/github/v/tag/habedi/chilli?label= docs&color= blue& style=flat&labelColor=282c34&logo=read-the-docs )] ( https://habedi.github.io/chilli/ )
13- [ ![ Examples] ( https://img.shields.io/github/v/tag/habedi/chilli?label= examples&color= green& style=flat&labelColor=282c34&logo=zig )] ( https://github.com/habedi/chilli/tree/main/examples )
11+ [ ![ Zig Version] ( https://img.shields.io/badge/Zig-0.15 .1-orange?logo=zig&labelColor=282c34 )] ( https://ziglang.org/download/ )
12+ [ ![ Docs] ( https://img.shields.io/badge/ docs-view- blue? style=flat&labelColor=282c34&logo=read-the-docs )] ( https://habedi.github.io/chilli/ )
13+ [ ![ Examples] ( https://img.shields.io/badge/ examples-view- green? style=flat&labelColor=282c34&logo=zig )] ( https://github.com/habedi/chilli/tree/main/examples )
1414[ ![ Release] ( https://img.shields.io/github/release/habedi/chilli.svg?label=release&style=flat&labelColor=282c34&logo=github )] ( https://github.com/habedi/chilli/releases/latest )
1515[ ![ License] ( https://img.shields.io/badge/license-MIT-007ec6?label=license&style=flat&labelColor=282c34&logo=open-source-initiative )] ( https://github.com/habedi/chilli/blob/main/LICENSE )
1616
@@ -47,7 +47,8 @@ Run the following command in the root directory of your project to download Chil
4747zig fetch --save=chilli " https://github.com/habedi/chilli/archive/<branch_or_tag>.tar.gz"
4848```
4949
50- Replace ` <branch_or_tag> ` with the desired branch or tag, like ` main ` or ` v0.1.0 ` .
50+ Replace ` <branch_or_tag> ` with the desired branch or tag, like ` main ` (for the development version) or ` v0.2.0 `
51+ (for the latest release).
5152This command will download Chilli and add it to Zig's global cache and update your project's ` build.zig.zon ` file.
5253
5354#### Adding to Build Script
@@ -61,21 +62,25 @@ pub fn build(b: *std.Build) void {
6162 const target = b.standardTargetOptions(.{});
6263 const optimize = b.standardOptimizeOption(.{});
6364
64- const exe = b.addExecutable(.{
65- .name = "your-cli-app",
66- .root_source_file = b.path("src/main.zig"),
67- .target = target,
68- .optimize = optimize,
69- });
70-
7165 // 1. Get the dependency object from the builder
7266 const chilli_dep = b.dependency("chilli", .{});
7367
74- // 2. Get chilli's top-level module
68+ // 2. Create a module for the dependency
7569 const chilli_module = chilli_dep.module("chilli");
7670
77- // 3. Add the module to your executable so you can @import("chilli")
78- exe.root_module.addImport("chilli", chilli_module);
71+ // 3. Create your executable module and add chilli as import
72+ const exe_module = b.createModule(.{
73+ .root_source_file = b.path("src/main.zig"),
74+ .target = target,
75+ .optimize = optimize,
76+ });
77+ exe_module.addImport("chilli", chilli_module);
78+
79+ // 4. Create executable with the module
80+ const exe = b.addExecutable(.{
81+ .name = "your-cli-app",
82+ .root_module = exe_module,
83+ });
7984
8085 b.installArtifact(exe);
8186}
@@ -136,6 +141,23 @@ pub fn main() anyerror!void {
136141}
137142```
138143
144+ You can now run your CLI application with the ` --help ` flag to see the output below:
145+
146+ ``` bash
147+ $ ./your-cli-app --help
148+ your-cli-app v0.2.0
149+ A new CLI built with Chilli
150+
151+ USAGE:
152+ your-cli-app [FLAGS]
153+
154+ FLAGS:
155+ -n, --name < string> The name to greet [default: World]
156+ --excitement < int> How excited to be [default: 1]
157+ -h, --help Prints help information
158+ -V, --version Prints version information
159+ ```
160+
139161---
140162
141163### Documentation
@@ -147,12 +169,9 @@ from the source code.
147169This will generate HTML documentation in the ` docs/api ` directory, which you can serve locally with ` make serve-docs `
148170and view in your web browser at [ http://localhost:8000 ] ( http://localhost:8000 ) .
149171
150- > [ !NOTE]
151- > To generate the documentation, you need to have Zig (version 0.14.1) and Python 3 installed on your system.
152-
153172### Examples
154173
155- Check out the [ examples] ( examples/README.md ) directory for examples of how Chilli can be used to build a variety of CLI
174+ Check out the [ examples] ( examples/ ) directory for examples of how Chilli can be used to build a variety of CLI
156175applications.
157176
158177### Feature Roadmap
0 commit comments