-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
22 allow skip input validation (#30)
* removed re-export * removed print if invalid arguments * removed unsued code * reworked input Added: - Multiple Requirements - valid and Invalid Notes - additional notes for shotcuts - default option - support for ALLow_COLOR * update input example to work with the new input struct * fixed text not removing after condition match * update preview image * added documentation
- Loading branch information
Showing
5 changed files
with
431 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,27 @@ | ||
use regex::Regex; | ||
use zenity::menu::input::{valid_path, valid_regex}; | ||
|
||
use zenity::menu::input::{Input, Requirements}; | ||
|
||
fn main() { | ||
println!("Input Preview:"); | ||
println!("\n\nInput Preview:"); | ||
|
||
let path = Input::new("Enter Valid Path:", Requirements::default()).start(); | ||
let path_with_regex = Input::new( | ||
"Enter a Valid .toml file", | ||
Requirements::path() | ||
.set_regex(Regex::new(r"\.toml\z").unwrap()) | ||
.set_note("", "Please Enter a Valid Path to a .toml file"), | ||
) | ||
.start(); | ||
let regex = Input::new( | ||
"Enter Valid Regex (ABC):", | ||
Requirements::regex(Regex::new(r"^ABC$").unwrap()), | ||
) | ||
.allow_force() | ||
.set_default("ABC") | ||
.start(); | ||
|
||
println!( | ||
"\n\nReturn: {}", | ||
valid_regex( | ||
"Enter string:", | ||
Regex::new(r"^\d{3}$").unwrap(), | ||
Some("369"), | ||
false | ||
) | ||
); | ||
println!( | ||
"\n\nPath: {:?}", | ||
valid_path("Enter A Valid Path:", None, true) | ||
); | ||
println!("Existing Path: {:?}", path); | ||
println!("Path with Regex: {:?}", path_with_regex); | ||
println!("Regex: {:?}", regex); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.