diff options
| author | 2019-01-17 15:52:56 +0100 | |
|---|---|---|
| committer | 2019-01-17 15:52:56 +0100 | |
| commit | a1efa9ee7adb502d20bdf6a5dad79356a4575eb3 (patch) | |
| tree | 2994696f2fb389b18588eac52eb383275cb810ea /README.md | |
| parent | Refactored the arg iterators to new be static interface implementations (diff) | |
| parent | Update README.md (diff) | |
| download | zig-clap-a1efa9ee7adb502d20bdf6a5dad79356a4575eb3.tar.gz zig-clap-a1efa9ee7adb502d20bdf6a5dad79356a4575eb3.tar.xz zig-clap-a1efa9ee7adb502d20bdf6a5dad79356a4575eb3.zip | |
Merge branch 'master' of github.com:Hejsil/zig-clap
Diffstat (limited to '')
| -rw-r--r-- | README.md | 20 |
1 files changed, 10 insertions, 10 deletions
| @@ -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 | ||
| 18 | The `StreamingClap` is base of all the other parsers. It's a streaming parser that uses an | 18 | The `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 |
| 22 | const params = []clap.Param(u8){ | 22 | const 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 | ||
| 28 | var os_iter = clap.args.OsIterator.init(allocator); | 28 | var 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 |
| 52 | const params = comptime []clap.Param(void){ | 52 | const 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 |
| 80 | const params = comptime []clap.Param(void){ | 80 | const 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 | ||
| 84 | var os_iter = clap.args.OsIterator.init(allocator); | 84 | var 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 | ||
| 109 | Ofc, this limits you to use only parameters that are comptime known. | 109 | Ofc, 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 | ); |