22 lines
682 B
Rust
22 lines
682 B
Rust
//! Initialise a repository and inspect its initial world through `lib_efo`.
|
|
|
|
use std::{env, error::Error, path::PathBuf};
|
|
|
|
use lib_efo::workspace::Workspace;
|
|
|
|
fn main() -> Result<(), Box<dyn Error>> {
|
|
let root = env::args_os()
|
|
.nth(1)
|
|
.map(PathBuf::from)
|
|
.ok_or("usage: cargo run -p lib_efo --example repository -- <empty-directory>")?;
|
|
|
|
let mut workspace = Workspace::initialize(&root, env!("CARGO_PKG_VERSION"))?;
|
|
println!("repository: {}", workspace.root().display());
|
|
println!("current epoch: {}", workspace.head.epoch_id);
|
|
println!(
|
|
"entities: {}",
|
|
workspace.head.iter_all_entities_mut().count()
|
|
);
|
|
Ok(())
|
|
}
|