make bemenu case insensitive

This commit is contained in:
Troy 2025-05-22 23:21:06 +01:00
parent f3281d7ae3
commit 8ab8628856
Signed by: troy
GPG key ID: DFC06C02ED3B4711

View file

@ -13,7 +13,7 @@ struct Link {
fn main() -> std::io::Result<()> {
let path = env::args()
.nth(1)
.expect("Usage: select_bookmark <input.md>");
.expect("Usage: select_bookmark <input.md>");
let markdown = fs::read_to_string(path)?;
let parser = Parser::new(&markdown);
@ -78,11 +78,12 @@ fn main() -> std::io::Result<()> {
.collect();
if entries.is_empty() {
println!(" No links found.");
println!("No links found");
return Ok(());
}
let mut child = Command::new("bemenu")
.arg("-i")
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.spawn()
@ -99,10 +100,10 @@ fn main() -> std::io::Result<()> {
let selected = String::from_utf8_lossy(&output.stdout).trim().to_owned();
if let Some((_, url)) = entries.iter().find(|(label, _)| label == &selected) {
println!("🌐 Opening: {}", url);
println!("Opening: {}", url);
open::that(url)?;
} else {
println!("Selection not found or canceled.");
println!("Selection not found or canceled");
}
Ok(())