A simple interactive CLI made in Rust
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-07-05 00:49:50 +08:00
examples update examples 2026-07-05 00:49:50 +08:00
src use loop instead of exiting 2026-07-05 00:49:50 +08:00
.gitignore cargo init 2026-06-30 17:27:59 +08:00
Cargo.lock add colored library, implement input 2026-06-30 17:27:59 +08:00
Cargo.toml add colored library, implement input 2026-06-30 17:27:59 +08:00
LICENSE create readme and license 2026-06-30 17:53:48 +08:00
README.md update examples 2026-07-05 00:49:50 +08:00

dv's interactive cli rs

A simple interactive CLI tool made in Rust.

Usage

First of all, you're gonna need to add dvs-interactive-cli-rs to your Cargo.toml

[dependencies]
dvs-interactive-cli-rs = { git = "https://codeberg.org/dvs/dvs-interactive-cli-rs.git", branch = "main" }

Boolean

use dvs_interactive_cli_rs::boolean;

fn main() {
    let thoughts_about = boolean("What do you think about solar panels?");
    boolean("Do you exist?");
    boolean("What is your purpose?");

    println!("{}", thoughts_about);
}
  • File example; @examples/boolean.rs
  • Arguments;
    • String -> Show a question
  • Return examples;
    • Returns the user's input -> y/Y/n/N -> String

Input

use dvs_interactive_cli_rs::input;

fn main() {
    let how_day = input("How many days are in a week?", &true, "Maybe...");
    input("Do you exist?", &false, "I can if I wanted to");
    input("What are you without the universe?", &false, "");
    input("Input nothing in this one.", &true, "");

    println!("{}", how_day);
}
  • File example; @examples/input.rs
  • Arguments;
    • String -> Show a question
    • Boolean -> Required field (shows a red asterisk *)
    • String -> Shows a placeholder
  • Return examples;
    • Returns the user's input -> Hello, world! -> String

Choices

use dvs_interactive_cli_rs::choices;

fn main() {
    let i_want = choices("What do you want?", ["this one", "that one", "all of them"].as_slice(), &true, &true);
    choices("More of them?", ["yes, this one", "yes, that one", "yes, all of them", "we5y0w3895h"].as_slice(), &false, &true);
    choices("Why?", ["yes, this one", "yes, that one"].as_slice(), &true, &false);
    choices("Okay?", ["yes, this one"].as_slice(), &false, &false);

    for num in i_want {
        println!("{}", num);
    }
}
  • File example; @examples/input.rs
  • Arguments;
    • String -> Show a question
    • Array -> Choices for the user to select
    • Boolean -> Mutli selection
    • Boolean -> Required field (shows a red asterisk *)
  • Return examples;
    • Single option -> [1] -> Vec
    • Multi option -> [1, 2, 3] -> Vec

License

This project is licensed under the MIT license.