-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: external settings file in json
- Loading branch information
Showing
7 changed files
with
264 additions
and
68 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,29 @@ | ||
use prepyrus::{Prepyrus, VerifiedConfig}; | ||
use prepyrus::Prepyrus; | ||
|
||
fn main() { | ||
let args: Vec<String> = std::env::args().collect(); | ||
|
||
let VerifiedConfig { | ||
bib_file, | ||
target_path, | ||
mode, | ||
} = Prepyrus::verify_config(&args); | ||
let _ = run(args).unwrap_or_else(|e| { | ||
eprintln!("Error: {}", e); | ||
std::process::exit(1); | ||
}); | ||
|
||
let all_entries = Prepyrus::get_all_bib_entries(&bib_file).unwrap(); | ||
let mdx_paths = Prepyrus::get_mdx_paths(&target_path).unwrap(); | ||
println!("===Prepyrus completed successfully!"); | ||
} | ||
|
||
fn run(args: Vec<String>) -> Result<(), Box<dyn std::error::Error>> { | ||
let config = Prepyrus::verify_config(&args, None)?; | ||
let all_entries = Prepyrus::get_all_bib_entries(&config.bib_file).unwrap(); | ||
let mdx_paths = | ||
Prepyrus::get_mdx_paths(&config.target_path, Some(config.settings.ignore_paths))?; | ||
|
||
// Phase 1: Verify MDX files | ||
let articles_file_data = Prepyrus::verify(mdx_paths, &all_entries).unwrap(); | ||
let articles_file_data = Prepyrus::verify(mdx_paths, &all_entries)?; | ||
|
||
// Phase 2: Process MDX files (requires mode to be set to "process") | ||
if mode == "process" { | ||
if config.mode == "process" { | ||
Prepyrus::process(articles_file_data); | ||
} | ||
|
||
println!("===Prepyrus completed successfully!"); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.