1pub fn parse_available(stderr: &str, item: &str) -> Vec<String> {
13 let marker = format!("Available {}:", item);
14 let mut available = Vec::new();
15 let mut collecting = false;
16
17 for line in stderr.lines() {
18 if collecting {
19 let trimmed = line.trim();
20 if !trimmed.is_empty() {
21 available.push(trimmed.to_string());
22 }
23 }
24 if line.contains(&marker) {
25 collecting = true;
26 }
27 }
28 available
29}
30
31pub fn read_run_history(
33 history_path: &std::path::Path,
34) -> std::collections::HashMap<String, usize> {
35 let mut history = std::collections::HashMap::new();
36 if let Ok(contents) = std::fs::read_to_string(history_path) {
37 for line in contents.lines() {
38 let trimmed = line.trim();
39 if !trimmed.is_empty() {
40 *history.entry(trimmed.to_string()).or_insert(0) += 1;
42 }
43 }
44 }
45 history
46}