use anyhow::Result;
pub use registry::Registry;
use std::{path::Path, process::Command};
mod registry;
pub const REPO: &str = "https://github.com/spacejamapp/jam-test-vectors.git";
#[cfg(not(feature = "full"))]
pub const SCALE: &[&str] = &["tiny"];
#[cfg(feature = "full")]
pub const SCALE: &[&str] = &["tiny", "full"];
pub fn run(vectors: &Path, output: &Path) -> Result<()> {
Registry::new(vectors, output).run()
}
pub fn download(target: &Path) -> Result<()> {
if target.exists() {
return Ok(());
}
Command::new("git")
.args([
"clone",
REPO,
target.to_str().expect("target is not a valid path"),
"--depth=1",
])
.status()?;
Ok(())
}
pub fn head(target: &Path) -> Result<String> {
let hash = Command::new("git")
.args(["rev-parse", "HEAD"])
.current_dir(target)
.output()?
.stdout;
Ok(String::from_utf8(hash)?)
}