wowlab_docgen_cli/context/collectors/
package.rs1use serde::Serialize;
2
3use super::{ContextEntry, to_value};
4use crate::RenderCtx;
5
6#[derive(Debug, Serialize)]
8pub struct ScriptEntry {
10 pub name: String,
11 pub command: String,
12}
13
14#[must_use]
16pub fn collect(ctx: &RenderCtx<'_>) -> Vec<ContextEntry> {
17 let scripts: Vec<ScriptEntry> = ctx
18 .metadata
19 .scripts
20 .iter()
21 .map(|s| ScriptEntry {
22 name: s.name.clone(),
23 command: s.command.clone(),
24 })
25 .collect();
26
27 if scripts.is_empty() {
28 return Vec::new();
29 }
30
31 vec![("scripts", to_value(&scripts))]
32}