From b0ab1188c83b21ec5750f2b4f856b154d8f33820 Mon Sep 17 00:00:00 2001 From: ascendforever Date: Sun, 13 Oct 2024 15:54:38 -0400 Subject: [PATCH] prompt_confirm template --- src/main.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 106e9c3..84a5dab 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,6 @@ extern crate shlex; extern crate structopt; +use std::borrow::Borrow; use std::io::{Read, Write, BufReader, BufRead}; use std::path::{Path,PathBuf}; use std::collections::HashMap; @@ -72,10 +73,10 @@ struct CLIArguments { /// return whether or not user gave confirmation -fn prompt_confirm(run_targets: &Vec>) -> bool { +fn prompt_confirm<'a, T: Borrow<[Y]>, Y: AsRef>(run_targets: &[T]) -> bool { println!("Are you sure you want to link all duplicates in each of these sets of targets?"); for spaths in run_targets { - println!(" {}", shlex::join(spaths.iter().map(|string| string.as_str()))); + println!(" {}", shlex::join(spaths.borrow().iter().map(|s| s.as_ref()))); } print!("> "); std::io::stdout().flush().unwrap_or_else(|_| ());