summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md20
1 files changed, 10 insertions, 10 deletions
diff --git a/README.md b/README.md
index 2bc86a6..b64ab2b 100644
--- a/README.md
+++ b/README.md
@@ -15,14 +15,14 @@ A simple and easy to use command line argument parser library for Zig.
15 15
16### `StreamingClap` 16### `StreamingClap`
17 17
18The `StreamingClap` is base of all the other parsers. It's a streaming parser that uses an 18The `StreamingClap` is the base of all the other parsers. It's a streaming parser that uses an
19`args.Iterator` to provide it with arguments lazily. 19`args.Iterator` to provide it with arguments lazily.
20 20
21```rust 21```rust
22const params = []clap.Param(u8){ 22const params = []clap.Param(u8){
23 clap.Param(void).flag('h', false, clap.Names.prefix("help")), 23 clap.Param(u8).flag('h', clap.Names.both("help")),
24 clap.Param(void).option('n', true, clap.Names.prefix("number")), 24 clap.Param(u8).option('n', clap.Names.both("number")),
25 clap.Param(void).positional('f'), 25 clap.Param(u8).positional('f'),
26}; 26};
27 27
28var os_iter = clap.args.OsIterator.init(allocator); 28var os_iter = clap.args.OsIterator.init(allocator);
@@ -50,8 +50,8 @@ them available through three functions (`flag`, `option`, `positionals`).
50 50
51```rust 51```rust
52const params = comptime []clap.Param(void){ 52const params = comptime []clap.Param(void){
53 clap.Param(void).flag({}, false, clap.Names.prefix("help")), 53 clap.Param(void).flag({}, clap.Names.both("help")),
54 clap.Param(void).option({}, true, clap.Names.prefix("number")), 54 clap.Param(void).option({}, clap.Names.both("number")),
55 clap.Param(void).positional({}), 55 clap.Param(void).positional({}),
56}; 56};
57 57
@@ -78,7 +78,7 @@ program can take:
78 78
79```rust 79```rust
80const params = comptime []clap.Param(void){ 80const params = comptime []clap.Param(void){
81 clap.Param(void).init({}, false, clap.Names.prefix("help")), 81 clap.Param(void).flag({}, clap.Names.both("help")),
82}; 82};
83 83
84var os_iter = clap.args.OsIterator.init(allocator); 84var os_iter = clap.args.OsIterator.init(allocator);
@@ -106,7 +106,7 @@ zig-clap/example/comptime-clap.zig:41:18: note: called from here
106 ^ 106 ^
107``` 107```
108 108
109Ofc, this limits you to use only parameters that are comptime known. 109Ofc, this limits you to parameters that are comptime known.
110 110
111### `help` 111### `help`
112 112
@@ -123,11 +123,11 @@ try clap.help(
123 []clap.Param([]const u8){ 123 []clap.Param([]const u8){
124 clap.Param([]const u8).flag( 124 clap.Param([]const u8).flag(
125 "Display this help and exit.", 125 "Display this help and exit.",
126 clap.Names.prefix("help"), 126 clap.Names.both("help"),
127 ), 127 ),
128 clap.Param([]const u8).flag( 128 clap.Param([]const u8).flag(
129 "Output version information and exit.", 129 "Output version information and exit.",
130 clap.Names.prefix("version"), 130 clap.Names.both("version"),
131 ), 131 ),
132 }, 132 },
133); 133);