// SPDX-FileCopyrightText: edef // SPDX-License-Identifier: OSL-3.0 use { fossil::Directory, prost::Message, std::{ env, io::{self, Write}, path::Path, }, }; fn main() { let store = fossil::Store::open("fossil.db").unwrap(); let mut root = Directory::new(); for name in env::args().skip(1) { let path = Path::new(&name); let name = path .file_name() .and_then(|s| s.to_str()) .expect("invalid path") .to_owned(); root.children.insert(name, store.add_path(path)); } let mut stdout = io::stdout(); stdout.write_all(&root.into_pb().encode_to_vec()).unwrap(); }