From ee5bec00e93bb744c26e0e1ac8f3d10947caf3ae Mon Sep 17 00:00:00 2001 From: Pagwin Date: Wed, 21 Sep 2022 00:46:54 -0400 Subject: [PATCH] project rename and using project name instead of hardcoded value for config dir --- Cargo.lock | 24 ++++++++++++------------ Cargo.toml | 4 ++-- src/main.rs | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 975ecef..cfccb3c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -306,6 +306,18 @@ version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" +[[package]] +name = "ppi" +version = "0.1.0" +dependencies = [ + "clap", + "dirs", + "git2", + "rlua", + "serde", + "toml", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -339,18 +351,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "project_init" -version = "0.1.0" -dependencies = [ - "clap", - "dirs", - "git2", - "rlua", - "serde", - "toml", -] - [[package]] name = "quote" version = "1.0.21" diff --git a/Cargo.toml b/Cargo.toml index e0aa951..bcda6f1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "project_init" +name = "ppi" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -clap = { version = "3.2.22", features = ["derive"] } +clap = { version = "3.2.22", features = ["derive", "cargo"] } dirs = "4.0.0" git2 = "0.15.0" rlua = "0.19.4" diff --git a/src/main.rs b/src/main.rs index cd15104..81e147a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,7 +22,7 @@ pub fn main() { let mut buf = String::new(); let _ = std::fs::File::open( {let mut n = dirs::config_dir().expect("no config dir so edit the source code to make it work buddy"); - n.push("pag-project-init/config.toml"); + n.push(clap::crate_name!().to_owned() + "/config.toml"); n }).expect("error opening file").read_to_string(&mut buf); buf @@ -34,7 +34,7 @@ pub fn main() { { let scripts = scripts.keys().map(String::clone).collect::>(); let skeletons = skeletons.keys().map(String::clone).collect::>(); - if scripts.union(&skeletons).count() > 0 { + if scripts.intersection(&skeletons).count() > 0 { panic!("Overlap between skeletons and scripts"); } }