mirror of https://github.com/xvxx/phetch
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.
23 lines
506 B
Rust
23 lines
506 B
Rust
use config;
|
|
|
|
use std::io::{Read, Result};
|
|
|
|
const BOOKMARKS_FILE: &str = "bookmarks.gph";
|
|
|
|
pub fn as_raw_menu() -> String {
|
|
let mut out = format!("i** bookmarks **\r\ni\r\n");
|
|
|
|
config::load(BOOKMARKS_FILE)
|
|
.and_then(|mut reader| reader.read_to_string(&mut out))
|
|
.map_err(|e| {
|
|
out = format!("3{}", e);
|
|
e
|
|
});
|
|
out
|
|
}
|
|
|
|
// save a single history entry
|
|
pub fn save(label: &str, url: &str) -> Result<()> {
|
|
config::append(BOOKMARKS_FILE, label, url)
|
|
}
|