You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
phetch/src/history.rs

28 lines
632 B
Rust

use config;
5 years ago
const HISTORY_FILE: &str = "history.gph";
pub fn as_raw_menu() -> String {
let mut out = vec![format!("i{}{}:\r\ni", config::DIR, HISTORY_FILE)];
5 years ago
config::load(HISTORY_FILE)
.and_then(|reader| {
let lines = reader.lines();
while let Some(Ok(line)) = lines.next() {
out.insert(1, line);
}
Ok(())
})
.map_err(|e| {
out.push(format!("3{}", e));
e
});
5 years ago
out.join("\r\n")
5 years ago
}
// save a single history entry
pub fn save(label: &str, url: &str) {
config::append(HISTORY_FILE, label, url);
5 years ago
}