Skip to content

ynqa/promkit

Repository files navigation

promkit

ci docs.rs

A toolkit for building your own interactive prompt in Rust.

Getting Started

Put the package in your Cargo.toml.

[dependencies]
promkit = "0.13.0"

Features

  • Cross-platform support for both UNIX and Windows utilizing crossterm
  • Modularized architecture
    • promkit-core
      • Core functionality for terminal rendering and keyed grapheme chunk management
    • promkit-widgets
      • Various UI components (text, listbox, tree, etc.)
    • promkit
      • High-level presets and user interfaces
    • promkit-derive
      • A Derive macro that simplifies interactive form input
  • Rich preset components
    • Readline - Text input with auto-completion
    • Confirm - Yes/no confirmation prompt
    • Password - Password input with masking and validation
    • Form - Manage multiple text input fields
    • Listbox - Single selection interface from a list
    • QuerySelector - Searchable selection interface
    • Checkbox - Multiple selection checkbox interface
    • Tree - Tree display for hierarchical data like file systems
    • JSON - Parse and interactively display JSON data
    • YAML - Parse and interactively display YAML data
    • Text - Static text display

Concept

See here.

Projects using promkit

Examples/Demos

promkit provides presets so that users can try prompts immediately without having to build complex components for specific use cases.

Show you commands, code, and actual demo screens for examples that can be executed immediately below.

Readline

Command
cargo run --bin readline

Code

Confirm

Command
cargo run --bin confirm

Code

Password

Command
cargo run --bin password

Code

Form

Command
cargo run --bin form

Code

Listbox

Command
cargo run --bin listbox

Code

QuerySelector

Command
cargo run --bin query_selector

Code

Checkbox

Command
cargo run --bin checkbox

Code

Tree

Command
cargo run --bin tree

Code

JSON

Command
cargo run --bin json ${PATH_TO_JSON_FILE}

Code

YAML

Command
cargo run --bin yaml ${PATH_TO_YAML_FILE}

Code

Text

Command
cargo run --bin text

Code

License

MIT License

Releases

Packages

Used by

Contributors

Languages