Skip to content

Commit

Permalink
add local storage
Browse files Browse the repository at this point in the history
  • Loading branch information
alpaylan committed Oct 5, 2023
1 parent f76e17c commit d810e33
Show file tree
Hide file tree
Showing 7 changed files with 227 additions and 188 deletions.
File renamed without changes.
File renamed without changes.
32 changes: 10 additions & 22 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,39 +30,27 @@ use std::env;
fn main() {
env_logger::init();

let data_schema_path = env::args().nth(1).expect("No data schema path provided");
let schema = fs::read_to_string(data_schema_path).unwrap();
let data_schemas = data_schema::DataSchema::from_json(&schema);

let layout_schema_path = env::args().nth(2).expect("No layout schema path provided");
let schema = fs::read_to_string(layout_schema_path).unwrap();
let layout_schemas = layout_schema::LayoutSchema::from_json(&schema);

let resume_layout_path = env::args().nth(3).expect("No resume layout path provided");
let schema = fs::read_to_string(resume_layout_path).unwrap();
let resume_layouts = resume_layout::ResumeLayout::from_json(&schema);

let resume_path = env::args().nth(4).expect("No resume path provided");
let resume_path = env::args().nth(1).expect("No resume path provided");
let resume = fs::read_to_string(resume_path).unwrap();
let resume_data = resume_data::ResumeData::from_json(&resume);

let resume_layout = resume_layouts
.iter()
.find(|layout| layout.schema_name == resume_data.layout)
.unwrap();
let results_path = env::args().nth(2).expect("No results path provided");

let results_path = env::args().nth(5).expect("No results path provided");
let debug = if let Some(is_debug) = env::args().nth(6) {
let debug = if let Some(is_debug) = env::args().nth(3) {
is_debug == "--debug"
} else {
false
};

let local_storage = if let Some(dir) = env::args().nth(4) {
local_storage::LocalStorage::custom_dir(dir.as_str())
} else {
local_storage::LocalStorage::new()
};

PdfLayout::render(
layout_schemas,
local_storage,
resume_data,
data_schemas,
resume_layout.clone(),
Path::new(results_path.as_str()),
debug,
)
Expand Down
Loading

0 comments on commit d810e33

Please sign in to comment.