MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / print_list_simulators

Function print_list_simulators

packages/server/src/main.rs:5677–5699  ·  view source on GitHub ↗
(simulators: &Value, format: ListFormat)

Source from the content-addressed store, hash-verified

5675}
5676
5677fn print_list_simulators(simulators: &Value, format: ListFormat) -> anyhow::Result<()> {
5678 match format {
5679 ListFormat::Json => {
5680 println_json(&serde_json::json!({ "simulators": simulators }))?;
5681 }
5682 ListFormat::CompactJson => {
5683 let compact = simulators
5684 .as_array()
5685 .map(|items| {
5686 items
5687 .iter()
5688 .map(compact_simulator_list_entry)
5689 .collect::<Vec<_>>()
5690 })
5691 .unwrap_or_default();
5692 println!(
5693 "{}",
5694 serde_json::to_string(&serde_json::json!({ "simulators": compact }))?
5695 );
5696 }
5697 }
5698 Ok(())
5699}
5700
5701fn compact_simulator_list_entry(simulator: &Value) -> Value {
5702 let mut entry = serde_json::Map::new();

Callers 1

mainFunction · 0.85

Calls 1

println_jsonFunction · 0.85

Tested by

no test coverage detected