biblatex bibliography manager written in rust
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.7 KiB

use biblatex::Bibliography;
// use json::*;
// use pubmed;
// use std::fs;
// use std::fs::File;
// use std::io::prelude::*;
use crate::bib_man::check_settings;
// use crate::bib_man::find_doi;
use crate::bib_man::main_menu;
use crate::bib_man::open_bib;
use bib_manager::bib_man;
use std::env;
// use std::io::{self, Read};
use snafu::{ensure, Backtrace, ErrorCompat, ResultExt, Snafu};
use std::path::Path;
fn main() {
// check for settings, set path if needed, load bib from default path
// all happens automatically at startup, not sure how to make this better right now
// let empty_bib: biblatex::Bibliography;
let settings_json = check_settings().unwrap();
let path_string = Path::new(settings_json["default_path"].as_str().unwrap());
let bibliography = match open_bib(path_string) {
Ok(bibliograph) => bibliograph,
Err(e) => {
eprintln!("uh oh, your bib file didn't load :S {}", e);
// handle_err(&empty_bib);
if let Some(backtrace) = ErrorCompat::backtrace(&e) {
println!("{}", backtrace);
};
panic!
}
};
// starting of setting stuff up for custom settings struct, not totally sure if necessary?
// let settings: settings = settings::set_path(String::from(
// settings_json["default_path"].as_str().unwrap(),
// ));
// take command line args, only menu is implemented right now
let args: Vec<String> = env::args().collect();
println!("{:?}", args);
if args.iter().any(|i| i == "menu") {
main_menu(&bibliography);
// } else if args.iter().any(|i| i == "find") {
// find_doi(&bibliography);
}
}