1/nektro/inquirer v0.9

A collection of utilities for prompting information from the user on the CLI


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

Usage

  • pub fn answer(writer, reader, comptime prompt: []const u8, value: []const u8) []const u8
    • Prints just the done string.
  • pub fn forEnum(writer, reader, 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(writer, reader, 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(writer, reader, 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

Package Contents

  • .gitattributes
  • licenses.txt
  • zigmod.lock
  • LICENSE
  • build.zig
  • src/lib.zig
  • src/main.zig
  • README.md
  • zig.mod
  • .gitignore

Dependencies

  • git https://github.com/nektro/zig-ansi

History

Published On Tree @ Commit Size
v0.11 Sun, 27 Oct 2024 10:14:09 UTC Tree 9.544 KB
v0.10 Sat, 07 Sep 2024 23:12:44 UTC Tree 9.563 KB
v0.9 Wed, 05 Jun 2024 08:39:30 UTC Tree 9.542 KB
v0.8 Sat, 04 May 2024 20:20:49 UTC Tree 9.631 KB
v0.7 Mon, 20 Mar 2023 18:39:57 UTC Tree 9.507 KB
v0.6 Tue, 15 Nov 2022 18:14:57 UTC Tree 9.502 KB
v0.5 Fri, 24 Dec 2021 19:42:50 UTC Tree 9.501 KB
v0.4 Tue, 03 Aug 2021 21:35:46 UTC Tree 9.505 KB
v0.3 Sun, 01 Aug 2021 18:56:35 UTC Tree 9.273 KB
v0.2 Thu, 29 Jul 2021 11:41:56 UTC Tree 9.211 KB
v0.1 Thu, 29 Jul 2021 11:00:27 UTC Tree 9.008 KB