menu_rs

Crates.iomenu_rs
lib.rsmenu_rs
version0.3.1
sourcesrc
created_at2022-12-07 00:07:00.387055
updated_at2023-11-05 14:19:09.144524
descriptionA simple command line menu
homepagehttps://github.com/NFSS10/menu_rs
repositoryhttps://github.com/NFSS10/menu_rs
max_upload_size
id731481
size21,768
Nuno Silva (NFSS10)

documentation

https://docs.rs/menu_rs

README

menu_rs

This is library for Rust that allows the creation of simple and interactable command-line menus.

It's very simple to use, you just create a Menu, adds the option you want it to have with the correspondent action to be run when selected and that's it! You can use the arrow keys to move through the options, ENTER to select an option and ESC to exit the menu.

menu_example

Example

use menu_rs::{Menu, MenuOption};

fn main() {
    fn action_1() {
        println!("Option 1 called!");
    }
    fn action_2() {}
    fn action_3() {}
    fn action_4() {}

    let menu = Menu::new(vec![
        MenuOption::new("Option 1", action_1).hint("Hint for option 1"),
        MenuOption::new("Option 2", action_2),
        MenuOption::new("Option 3", action_3),
        MenuOption::new("Option 4", action_4),
    ]);

    menu.show();
}
Commit count: 28

cargo fmt