diff options
| author | 2024-10-22 17:46:47 +0200 | |
|---|---|---|
| committer | 2024-10-22 17:48:34 +0200 | |
| commit | e73b56aa4bcb7e53144ef96ee978f2a19b32669d (patch) | |
| tree | 0ab5e3d426e25d2ad9d2e0cd0015fc010d9ea182 /example/help.zig | |
| parent | feat: Add `terminating_positional` to `clap.ParseOptions` (diff) | |
| download | zig-clap-e73b56aa4bcb7e53144ef96ee978f2a19b32669d.tar.gz zig-clap-e73b56aa4bcb7e53144ef96ee978f2a19b32669d.tar.xz zig-clap-e73b56aa4bcb7e53144ef96ee978f2a19b32669d.zip | |
refactor: Always access using full namespace
This is my new preferred style of programming Zig :)
Diffstat (limited to 'example/help.zig')
| -rw-r--r-- | example/help.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/example/help.zig b/example/help.zig index 2f063c5..b80ee35 100644 --- a/example/help.zig +++ b/example/help.zig | |||
| @@ -1,6 +1,3 @@ | |||
| 1 | const clap = @import("clap"); | ||
| 2 | const std = @import("std"); | ||
| 3 | |||
| 4 | pub fn main() !void { | 1 | pub fn main() !void { |
| 5 | var gpa = std.heap.GeneralPurposeAllocator(.{}){}; | 2 | var gpa = std.heap.GeneralPurposeAllocator(.{}){}; |
| 6 | defer _ = gpa.deinit(); | 3 | defer _ = gpa.deinit(); |
| @@ -17,9 +14,12 @@ pub fn main() !void { | |||
| 17 | defer res.deinit(); | 14 | defer res.deinit(); |
| 18 | 15 | ||
| 19 | // `clap.help` is a function that can print a simple help message. It can print any `Param` | 16 | // `clap.help` is a function that can print a simple help message. It can print any `Param` |
| 20 | // where `Id` has a `describtion` and `value` method (`Param(Help)` is one such parameter). | 17 | // where `Id` has a `description` and `value` method (`Param(Help)` is one such parameter). |
| 21 | // The last argument contains options as to how `help` should print those parameters. Using | 18 | // The last argument contains options as to how `help` should print those parameters. Using |
| 22 | // `.{}` means the default options. | 19 | // `.{}` means the default options. |
| 23 | if (res.args.help != 0) | 20 | if (res.args.help != 0) |
| 24 | return clap.help(std.io.getStdErr().writer(), clap.Help, ¶ms, .{}); | 21 | return clap.help(std.io.getStdErr().writer(), clap.Help, ¶ms, .{}); |
| 25 | } | 22 | } |
| 23 | |||
| 24 | const clap = @import("clap"); | ||
| 25 | const std = @import("std"); | ||