| ... | ... | @@ -0,0 +1,39 @@ |
| 1 | # zig-inquirer |
| 2 | |
| 3 | A collection of utilities for prompting information from the user on the CLI |
| 4 | |
| 5 | Adapted from https://github.com/SBoudrias/Inquirer.js |
| 6 | |
| 7 | ## Add me |
| 8 | ``` |
| 9 | zigmod aq add 1/nektro/inquirer |
| 10 | ``` |
| 11 | |
| 12 | ## Run example |
| 13 | ``` |
| 14 | zig build run |
| 15 | ``` |
| 16 | |
| 17 | ## Screenshots |
| 18 |  |
| 19 | |
| 20 | ## Usage |
| 21 | - `pub fn answer(comptime prompt: []const u8, value: []const u8) []const u8` |
| 22 | - Prints just the done string. |
| 23 | - `pub fn forEnum(comptime prompt: []const u8, alloc: *std.mem.Allocator, comptime options: enum, default: ?options) !options` |
| 24 | - Accepts an enum and prompts the user to pick on of the fields. |
| 25 | - `pub fn forString(comptime prompt: []const u8, alloc: *std.mem.Allocator, default: ?[]const u8) ![]const u8` |
| 26 | - Base function, asks prompt and returns non-empty answer. |
| 27 | - `pub fn forConfirm(comptime prompt: []const u8, alloc: *std.mem.Allocator) !bool` |
| 28 | - Calls `forEnum` with `y/n` |
| 29 | |
| 30 | ## TODO |
| 31 | - number (current implementation causes compiler crash) |
| 32 | - list with strings |
| 33 | - string password |
| 34 | - long list with autocomplete |
| 35 | - date |
| 36 | - time |
| 37 | |
| 38 | ## License |
| 39 | MIT |