authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-07-29 03:58:57 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-07-29 03:58:57 -07:00
loga9b167300ba0c1d87f7cfa3aa9fcb13eea2132e2
tree72cd76df80939b635fcbf3f86a98a79f27d73961
parentbf61c37a36b9801148566e63e0cca4505e9b6547

add README


1 files changed, 39 insertions(+), 0 deletions(-)

README.md created+39
...@@ -0,0 +1,39 @@
1# zig-inquirer
2
3A collection of utilities for prompting information from the user on the CLI
4
5Adapted from https://github.com/SBoudrias/Inquirer.js
6
7## Add me
8```
9zigmod aq add 1/nektro/inquirer
10```
11
12## Run example
13```
14zig build run
15```
16
17## Screenshots
18![image](https://user-images.githubusercontent.com/5464072/127479686-fda8f860-a705-4fd6-9768-a3e1f53a6bc7.png)
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
39MIT