diff --git a/Cargo.toml b/Cargo.toml index a9995c5..08372c3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zenity" -version = "3.0.1" +version = "3.1.0" authors = ["Arteii "] edition = "2021" license-file = "LICENSE.md" diff --git a/examples/input.rs b/examples/input.rs index 86c69d9..d2485b3 100644 --- a/examples/input.rs +++ b/examples/input.rs @@ -1,8 +1,10 @@ use regex::Regex; -use zenity::menu::input::{valid_regex, valid_path}; +use zenity::menu::input::{valid_path, valid_regex}; fn main() { - println!("\n\nReturn: {}", valid_regex(Regex::new(r"^\d{3}$").unwrap())); + println!( + "\n\nReturn: {}", + valid_regex(Regex::new(r"^\d{3}$").unwrap()) + ); println!("\n\nPath: {:?}", valid_path()); - } diff --git a/examples/selection.rs b/examples/selection.rs index 3d2c5ff..226e8e0 100644 --- a/examples/selection.rs +++ b/examples/selection.rs @@ -1,27 +1,26 @@ // rmeoved for now will work on it soon - // use zenity::menu::selection::{MenuOption, SelectionMenu}; // use zenity::style::{Color, StyledString}; -// +// // fn main() { // let hello_world = MenuOption { // text: StyledString::new("Hello World"), // notes: StyledString::new("bli bla blub"), // }; -// +// // let method2 = MenuOption { // text: StyledString::new("method2 says Hi"), // notes: StyledString::new("No!"), // }; -// +// // let menu = SelectionMenu { // title: StyledString::simple("Selection Menu", Some(Color::Red), None, None), // options: [hello_world.clone(), method2.clone()].to_vec(), // }; -// +// // let selected_option = menu.single(); -// +// // if selected_option == hello_world { // println!("User selected Hello World"); // } else if selected_option == method2 { @@ -29,7 +28,7 @@ // } else { // // handle other cases (shouldn't be any...) // } -// -// +// +// // } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/lib.rs b/src/lib.rs index 152255b..3eb10a7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -80,8 +80,8 @@ pub mod color; pub(crate) mod iterators; +pub mod menu; pub mod progress; pub mod spinner; pub mod style; pub(crate) mod terminal; -pub mod menu; diff --git a/src/menu/input.rs b/src/menu/input.rs index eef4a83..1f29d58 100644 --- a/src/menu/input.rs +++ b/src/menu/input.rs @@ -41,9 +41,9 @@ use std::path::{Path, PathBuf}; use crossterm::{ cursor::MoveTo, event::{Event, KeyCode, KeyEvent}, - ExecutableCommand, execute, terminal::{disable_raw_mode, enable_raw_mode}, + ExecutableCommand, }; use regex::Regex; @@ -185,7 +185,7 @@ fn validate_input(buffer: &str, regex: &Regex, stdout: &mut std::io::Stdout) -> crossterm::terminal::ClearType::CurrentLine, )) .unwrap(); - false + false } } diff --git a/src/terminal.rs b/src/terminal.rs index 09b8174..88b79be 100644 --- a/src/terminal.rs +++ b/src/terminal.rs @@ -8,7 +8,12 @@ pub(crate) mod console_render { pub fn render_line(frame: &Vec, row: u16) { let mut stdout = stdout(); - queue!(stdout, cursor::RestorePosition, cursor::MoveToNextLine(row + 1),).unwrap(); + queue!( + stdout, + cursor::RestorePosition, + cursor::MoveToNextLine(row + 1), + ) + .unwrap(); for content in frame { queue!(stdout, style::Print(content),).unwrap();