use anyhow::Result;
use std::path::Path;
use rpfm_lib::integrations::{git::*, log::*};
use rpfm_lib::schema::*;
use crate::config::Config;
pub fn update(config: &Config, schema_path: &Path) -> Result<()> {
if config.verbose {
info!("Updating schemas…");
}
let git_integration = GitIntegration::new(schema_path, SCHEMA_REPO, SCHEMA_BRANCH, SCHEMA_REMOTE);
git_integration.update_repo()?;
if config.verbose {
info!("Schemas updated.");
}
Ok(())
}
pub fn to_json(config: &Config, schemas_path: &Path) -> Result<()> {
if config.verbose {
info!("Converting schemas to Json…");
}
let result = Schema::export_to_json(schemas_path).map_err(From::from);
if config.verbose {
info!("Schemas converted to Json.");
}
result
}