MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / run

Method run

atomic-cli/src/commands/memory/kinds.rs:32–57  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

30
31impl Command for MemoryKinds {
32 fn run(&self) -> CliResult<()> {
33 if self.json {
34 let arr: Vec<serde_json::Value> = MEMORY_KIND_GUIDANCE
35 .iter()
36 .map(|(kind, description)| {
37 serde_json::json!({ "kind": kind, "description": description })
38 })
39 .collect();
40 println!("{}", serde_json::to_string_pretty(&arr).unwrap());
41 return Ok(());
42 }
43
44 let width = MEMORY_KIND_GUIDANCE
45 .iter()
46 .map(|(k, _)| k.len())
47 .max()
48 .unwrap_or(0);
49 println!(
50 "Allowed memory kinds (pick the best fit; create one memory per durable insight):"
51 );
52 println!();
53 for (kind, description) in MEMORY_KIND_GUIDANCE {
54 println!(" {:<width$} {}", kind, description, width = width);
55 }
56 Ok(())
57 }
58}

Callers

nothing calls this directly

Calls 3

collectMethod · 0.45
iterMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected