project rename and using project name instead of hardcoded value for config dir

This commit is contained in:
Pagwin 2022-09-21 00:46:54 -04:00
parent 5d04294dca
commit ee5bec00e9
3 changed files with 16 additions and 16 deletions

24
Cargo.lock generated
View file

@ -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"

View file

@ -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"

View file

@ -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::<HashSet<String>>();
let skeletons = skeletons.keys().map(String::clone).collect::<HashSet<String>>();
if scripts.union(&skeletons).count() > 0 {
if scripts.intersection(&skeletons).count() > 0 {
panic!("Overlap between skeletons and scripts");
}
}