summary refs log tree commit diff
path: root/ripple/fossil/src/bin/extract.rs
diff options
context:
space:
mode:
authoredef <edef@unfathomable.blue>2022-05-03 15:49:43 +0000
committeredef <edef@unfathomable.blue>2022-05-03 16:06:36 +0000
commit2625ed645c93b708342f9fcc25f2a30e635613c1 (patch)
tree31c427f119e8ed1bfcd2069f5280acd0f36a2b9d /ripple/fossil/src/bin/extract.rs
parentfdf83f8681bb3531f6441f9d0a021ca9dcd36c45 (diff)
downloadunf-legacy-2625ed645c93b708342f9fcc25f2a30e635613c1.tar.zst
ripple/fossil: don't expose protobufs in the frontend
Previously, the CLI took Directory protobufs as input or wrote them as
output. Now we just deal in store hashes.

Change-Id: I5e0f0f33929ede43d971080c33bdb865f1832b2e
Diffstat (limited to 'ripple/fossil/src/bin/extract.rs')
-rw-r--r--ripple/fossil/src/bin/extract.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/ripple/fossil/src/bin/extract.rs b/ripple/fossil/src/bin/extract.rs
index a1e83df..64e27d4 100644
--- a/ripple/fossil/src/bin/extract.rs
+++ b/ripple/fossil/src/bin/extract.rs
@@ -7,7 +7,7 @@ use {
 	prost::Message,
 	std::{
 		fs,
-		io::{self, Read, Write},
+		io::Write,
 		os::unix::{fs::symlink, prelude::OpenOptionsExt},
 		path::{Path, PathBuf},
 	},
@@ -17,6 +17,8 @@ use {
 struct Args {
 	#[clap(long, default_value = "fossil.db")]
 	store: PathBuf,
+	#[clap(parse(try_from_str = fossil::digest_from_str))]
+	root: fossil::Digest,
 }
 
 fn main() {
@@ -24,12 +26,9 @@ fn main() {
 
 	let store = fossil::Store::open(args.store).unwrap();
 	let root = {
-		let mut stdin = io::stdin();
-
-		let mut bytes = Vec::new();
-		stdin.read_to_end(&mut bytes).unwrap();
-
+		let bytes = store.read_blob(args.root);
 		let pb = store::Directory::decode(&*bytes).unwrap();
+
 		Directory::from_pb(pb)
 	};