From a9b167300ba0c1d87f7cfa3aa9fcb13eea2132e2 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Thu, 29 Jul 2021 03:58:57 -0700 Subject: [PATCH] add README --- README.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..1c063efb0118cc05ffa4ce987104cca4e7babd2d --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +# zig-inquirer + +A collection of utilities for prompting information from the user on the CLI + +Adapted from https://github.com/SBoudrias/Inquirer.js + +## Add me +``` +zigmod aq add 1/nektro/inquirer +``` + +## Run example +``` +zig build run +``` + +## Screenshots +![image](https://user-images.githubusercontent.com/5464072/127479686-fda8f860-a705-4fd6-9768-a3e1f53a6bc7.png) + +## Usage +- `pub fn answer(comptime prompt: []const u8, value: []const u8) []const u8` + - Prints just the done string. +- `pub fn forEnum(comptime prompt: []const u8, alloc: *std.mem.Allocator, comptime options: enum, default: ?options) !options` + - Accepts an enum and prompts the user to pick on of the fields. +- `pub fn forString(comptime prompt: []const u8, alloc: *std.mem.Allocator, default: ?[]const u8) ![]const u8` + - Base function, asks prompt and returns non-empty answer. +- `pub fn forConfirm(comptime prompt: []const u8, alloc: *std.mem.Allocator) !bool` + - Calls `forEnum` with `y/n` + +## TODO +- number (current implementation causes compiler crash) +- list with strings +- string password +- long list with autocomplete +- date +- time + +## License +MIT -- 2.54.0