commit 7a8f17fd9f66a3cbf73be8a0d2fb499aa6524f85
parent c41a9f35197a88d94e859fec7296ce819ee6fc2f
Author: lash <dev@holbrook.no>
Date: Thu, 22 Sep 2022 14:38:30 +0000
Add store path arg
Diffstat:
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/src/main.rs b/src/main.rs
@@ -46,6 +46,14 @@ fn args_setup() -> ArgMatches<'static> {
let mut o = App::new("kitab");
o = o.version("0.0.1");
o = o.author("Louis Holbrook <dev@holbrook.no>");
+
+ o = o.arg(clap::Arg::with_name("store")
+ .short("s")
+ .long("store")
+ .value_name("Store location")
+ .takes_value(true)
+ );
+
let mut o_import = (
SubCommand::with_name("import")
.about("import information from file")
@@ -79,8 +87,7 @@ fn args_setup() -> ArgMatches<'static> {
// );
//
// o_entry = o_entry.arg(clap::Arg::with_name("validators")
-// .short("s")
-// .long("src")
+// .long("validator")
// .value_name("Add given validator engine")
// .multiple(true)
// .takes_value(true)
@@ -102,6 +109,19 @@ fn args_setup() -> ArgMatches<'static> {
// kitab apply <path> - recursively
fn resolve_directory(args: &ArgMatches) -> PathBuf {
+ let r = match args.value_of("store") {
+ Some(v) => {
+ v
+ },
+ _ => {
+ ""
+ },
+ };
+ if r.len() != 0 {
+ return PathBuf::from(r)
+ }
+
+
match BaseDirs::new() {
Some(v) => {
let d = v.data_dir();