From 0291efa989ee92e0e9a3271d95eae3bb631ecaa2 Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Wed, 20 Jan 2021 18:46:01 +0100 Subject: [PATCH] wofi_select works --- src/util.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util.rs b/src/util.rs index 0d78021..1b332db 100644 --- a/src/util.rs +++ b/src/util.rs @@ -38,16 +38,16 @@ where let output = wofi.wait_with_output().expect("Failed to read stdout"); let choice = String::from_utf8_lossy(&output.stdout); - // FIXME: Remove trailing \n from choice. - //println!("choice: {:?}", choice); - map.get(&*choice).copied() + let mut choice = String::from(choice); + choice.pop(); // Remove trailing \n from choice. + map.get(&choice).copied() } #[test] +#[ignore = "interactive test requiring user input"] fn test_wofi_select() { let choices = vec!["a", "b", "c"]; let choice = wofi_select("Choose wisely", &choices); - println!("choice: {:?}", choice); assert!(choice.is_some()); assert!(choices.contains(choice.unwrap())); }