ezmenu

Crates.ioezmenu
lib.rsezmenu
version0.2.9
sourcesrc
created_at2022-02-01 15:02:43.047838
updated_at2022-02-25 18:32:03.767921
descriptionBuilds a CLI menu with simple macros.
homepage
repositoryhttps://github.com/ahbalbk/ezmenu
max_upload_size
id525216
size10,051
Ahmad (ahmadbky)

documentation

https://docs.rs/ezmenu

README

EZMenu

Fast designing menus for your Rust CLI programs with a simple derive.

This crates provides many procedural macros to easily build menus. It uses the ezmenulib library crate in its expansion.

Example

Here is an example of how to use the derive(Menu) macro (it takes the same example as the documentation of the ezmenu library):

use ezmenu::Menu;

#[derive(Menu)]
#[menu(title = "Hello there!")]
struct MyMenu {
    #[menu(msg = "Give your name")]
    name: String,
    #[menu(msg = "Give a number")]
    number: i32,
}

fn main() {
    let MyMenu { name, number } = MyMenu::from_menu();
    println!("values provided: name={}, number={}", name, number);
}

This sample code prints the standard menu like above:

Hello there!
* Give your name: Ahmad
* Give a number: 1000
values provided: name=Ahmad, number=1000

Documentation

You can find all the crate documentation on Docs.rs. You can also check the make-license program example to learn with a practical way.

WIP

This project is still in development. You can check the EZMenu project to look at my todolist :D

Commit count: 12

cargo fmt