add empty-ish config struct

master
Brian Hicks 2020-05-29 17:07:42 -05:00
parent da496e7110
commit bd66ccad02
2 changed files with 34 additions and 0 deletions

View File

@ -2,6 +2,8 @@ use std::path::Path;
use zettel::*;
fn main() {
// println!("{:#?}", Config::load());
match Zettel::in_dir(Path::new("demo")) {
Ok(zettels) => println!(
"{}",

View File

@ -5,6 +5,38 @@ use std::io::ErrorKind;
use std::io::*;
use std::path::Path;
// CONFIG
pub struct Config {
sources: Vec<Source>,
}
pub struct Source {
pub path: std::path::PathBuf,
}
impl Config {
pub fn load() -> Result<Config> {
Ok(Config {
sources: Vec::new(),
})
}
}
impl fmt::Debug for Config {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Config")
.field("sources", &self.sources)
.finish()
}
}
impl fmt::Debug for Source {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Source").field("path", &self.path).finish()
}
}
// ZETTEL
pub struct Zettel {