MCPcopy Create free account
hub / github.com/csskit/csskit / extract_tree_directories

Function extract_tree_directories

crates/csskit_spec_generator/src/fetch_cached.rs:133–140  ·  view source on GitHub ↗

Extracts directory paths from the GitHub API tree response

(tree_value: &Value)

Source from the content-addressed store, hash-verified

131
132/// Extracts directory paths from the GitHub API tree response
133fn extract_tree_directories(tree_value: &Value) -> Result<Vec<String>> {
134 Ok(serde_json::from_value::<Vec<Value>>(tree_value["tree"].clone())?
135 .into_iter()
136 .filter_map(|item| {
137 if item["type"] == "tree" { serde_json::from_value::<String>(item["path"].clone()).ok() } else { None }
138 })
139 .collect())
140}
141
142/// Parses a spec path in the format "{name}-{version}" into (name, version)
143///

Callers 1

get_spec_versionsFunction · 0.85

Calls 4

collectMethod · 0.80
into_iterMethod · 0.80
cloneMethod · 0.80
okMethod · 0.80

Tested by

no test coverage detected