Compare commits

...

2 commits

Author SHA1 Message Date
f12de31125
chore: bump version 2024-10-30 01:43:34 +01:00
956297b87f
fix: don't inherit fallbacks from parents
just weird
2024-10-30 01:42:41 +01:00
3 changed files with 6 additions and 9 deletions

2
Cargo.lock generated
View file

@ -815,7 +815,7 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2"
[[package]]
name = "postwoman"
version = "0.4.2"
version = "0.4.3"
dependencies = [
"base64",
"chrono",

View file

@ -1,7 +1,7 @@
[package]
name = "postwoman"
description = "API tester and debugger for your CLI "
version = "0.4.2"
version = "0.4.3"
repository = "https://moonlit.technology/alemi/postwoman"
authors = [ "alemi <me@alemi.dev>" ]
license = "GPL-3.0-only"

View file

@ -72,7 +72,7 @@ fn main() {
let mut collections = IndexMap::new();
if !load_collections(&mut collections, args.collection.clone(), &toml::Table::default()) {
if !load_collections(&mut collections, args.collection.clone()) {
return;
}
@ -212,7 +212,7 @@ async fn run_collection_endpoints(
}
}
fn load_collections(store: &mut IndexMap<String, PostWomanCollection>, mut path: std::path::PathBuf, parent_env: &toml::Table) -> bool {
fn load_collections(store: &mut IndexMap<String, PostWomanCollection>, mut path: std::path::PathBuf) -> bool {
let collection_raw = match std::fs::read_to_string(&path) {
Ok(x) => x,
Err(e) => {
@ -221,7 +221,7 @@ fn load_collections(store: &mut IndexMap<String, PostWomanCollection>, mut path:
},
};
let mut collection: PostWomanCollection = match toml::from_str(&collection_raw) {
let collection: PostWomanCollection = match toml::from_str(&collection_raw) {
Ok(x) => x,
Err(e) => {
eprintln!("! error parsing collection {path:?}: {e}");
@ -229,8 +229,6 @@ fn load_collections(store: &mut IndexMap<String, PostWomanCollection>, mut path:
},
};
collection.env.extend(parent_env.iter().map(|(k, v)| (k.clone(), v.clone())));
let name = path.to_string_lossy().replace(".toml", "");
let mut to_include = Vec::new();
@ -242,11 +240,10 @@ fn load_collections(store: &mut IndexMap<String, PostWomanCollection>, mut path:
to_include.push(base);
}
let parent_env = collection.env.clone();
store.insert(name, collection);
for base in to_include {
if !load_collections(store, base, &parent_env) {
if !load_collections(store, base) {
return false;
}
}