summary refs log tree commit diff
path: root/ripple/fossil/src
diff options
context:
space:
mode:
authoredef <edef@unfathomable.blue>2022-05-03 00:33:45 +0000
committeredef <edef@unfathomable.blue>2022-05-03 00:33:45 +0000
commitfb6290d73a5df1ce34c87c07e1e8da23a45641c4 (patch)
tree3c1c402a06ec8e88867abb3a75644e28b3307fc6 /ripple/fossil/src
parent9a531f656e158c9a5e0fab4cebdac6f46b19d919 (diff)
downloadunf-legacy-fb6290d73a5df1ce34c87c07e1e8da23a45641c4.tar.zst
ripple/fossil/add: only accept a single directory arg
This changes it from building an implicit top-level directory
containing all its args, to simply accepting a directory.

Change-Id: Iaf00e07d8568367b9eb27f365e8a2eaac3576974
Diffstat (limited to 'ripple/fossil/src')
-rw-r--r--ripple/fossil/src/bin/add.rs19
1 files changed, 3 insertions, 16 deletions
diff --git a/ripple/fossil/src/bin/add.rs b/ripple/fossil/src/bin/add.rs
index 84e67e2..ba51cd6 100644
--- a/ripple/fossil/src/bin/add.rs
+++ b/ripple/fossil/src/bin/add.rs
@@ -3,18 +3,16 @@
 
 use {
 	clap::StructOpt,
-	fossil::Directory,
 	prost::Message,
 	std::{
 		io::{self, Write},
-		path::{Path, PathBuf},
+		path::PathBuf,
 	},
 };
 
 #[derive(clap::Parser)]
 struct Args {
-	#[clap(name = "PATH")]
-	paths: Vec<PathBuf>,
+	dir: PathBuf,
 	#[clap(long, default_value = "fossil.db")]
 	store: PathBuf,
 }
@@ -23,18 +21,7 @@ fn main() {
 	let args = Args::parse();
 
 	let store = fossil::Store::open(args.store).unwrap();
-	let mut root = Directory::new();
-
-	for name in args.paths {
-		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 root = store.add_directory(args.dir);
 
 	let mut stdout = io::stdout();
 	stdout.write_all(&root.into_pb().encode_to_vec()).unwrap();