From 5c544de74b64fc08029d09d12ecde894b5e78078 Mon Sep 17 00:00:00 2001 From: edef Date: Tue, 3 May 2022 00:08:20 +0000 Subject: ripple/fossil: use clap This adds clap to all our binaries. Only add currently takes any args, but previously, the others did not reject args as they should. Change-Id: I6257fb3b218c624ee0124f6ed7313a579db88c4c --- ripple/fossil/src/bin/add.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'ripple/fossil/src/bin/add.rs') diff --git a/ripple/fossil/src/bin/add.rs b/ripple/fossil/src/bin/add.rs index 114f893..7768366 100644 --- a/ripple/fossil/src/bin/add.rs +++ b/ripple/fossil/src/bin/add.rs @@ -2,20 +2,28 @@ // SPDX-License-Identifier: OSL-3.0 use { + clap::StructOpt, fossil::Directory, prost::Message, std::{ - env, io::{self, Write}, - path::Path, + path::{Path, PathBuf}, }, }; +#[derive(clap::Parser)] +struct Args { + #[clap(name = "PATH")] + paths: Vec, +} + fn main() { + let args = Args::parse(); + let store = fossil::Store::open("fossil.db").unwrap(); let mut root = Directory::new(); - for name in env::args().skip(1) { + for name in args.paths { let path = Path::new(&name); let name = path .file_name() -- cgit 1.4.1