promptio

.github/workflows/promptio.yml

A toolkit for building your own interactive command-line tools in Rust, utilizing crossterm.

Getting Started

Put the package in your Cargo.toml.

toml [dependencies] promptio = "0.1.0"

Features

Examples

Readline:

```rust use promptio::{build::Builder, readline, Result};

fn main() -> Result<()> { let mut p = readline::Builder::default().build()?; loop { let (line, exitcode) = p.run()?; if exitcode == 0 { println!("result: {:?}", line); } else { return Ok(()); } } } ```

Select:

```rust use crossterm::style; use promptio::{ build::Builder, edit::{Register, SelectBox}, select, Result, };

fn main() -> Result<()> { let mut selectbox = Box::new(SelectBox::default()); selectbox.registerall((0..100).map(|v| v.tostring()).collect::>()); let mut p = select::Builder::default() .title("Q: What number do you like?") .titlecolor(style::Color::DarkGreen) .selectbox(selectbox) .build()?; let (line, exitcode) = p.run()?; if exit_code == 0 { println!("result: {:?}", line) } Ok(()) } ```