https://github.com/nektro/zig-inquirer
A collection of utilities for prompting information from the user on the CLI
https://github.com/nektro/zig-inquirer
zig zig-package
Last synced: 4 months ago
JSON representation
A collection of utilities for prompting information from the user on the CLI
- Host: GitHub
- URL: https://github.com/nektro/zig-inquirer
- Owner: nektro
- License: mit
- Created: 2021-07-29T10:59:26.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2025-12-18T02:22:55.000Z (6 months ago)
- Last Synced: 2025-12-21T12:35:42.042Z (6 months ago)
- Topics: zig, zig-package
- Language: Zig
- Homepage:
- Size: 16.6 KB
- Stars: 27
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-zig - zig-inquirer🗒️A collection of utilities for prompting information from the user on the CLI
README
# zig-inquirer

[](https://github.com/nektro/zig-inquirer/blob/master/LICENSE)
[](https://github.com/sponsors/nektro)
[](https://ziglang.org/)
[](https://github.com/nektro/zigmod)
A collection of utilities for prompting information from the user on the CLI
Adapted from https://github.com/SBoudrias/Inquirer.js
## Run example
```
zig build run
```
## Screenshots

## 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