diff --git a/src/main.rs b/src/main.rs index 8bdcf93..2fea7f9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,4 @@ -use std::{path::Path}; -use std::fs; +use std::{path::Path, fs, env}; use minijinja::Environment; mod render; @@ -48,9 +47,27 @@ fn render_index(out_path: &Path, index: &IndexItem, cur_path: &Path, site_index: } fn main() { + + let mut src_path_str: String = SRC_PATH.to_string(); + let mut out_path_str: String = OUT_PATH.to_string(); - let src_path = Path::new(SRC_PATH); - let out_path = Path::new(OUT_PATH); + let mut i: u8 = 0; + for arg in env::args() { + match i { + 0 => {} + 1 => { + src_path_str = arg; + } + 2 => { + out_path_str = arg; + } + _ => {} + } + i += 1; + } + + let src_path = Path::new(&src_path_str); + let out_path = Path::new(&out_path_str); let index = Renderer::index(src_path).unwrap();