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

Function parse_maestro_flow_yaml

packages/server/src/main/maestro.rs:66–87  ·  view source on GitHub ↗
(raw: &str)

Source from the content-addressed store, hash-verified

64}
65
66fn parse_maestro_flow_yaml(raw: &str) -> anyhow::Result<YamlValue> {
67 let mut documents = Vec::new();
68 for document in serde_yaml::Deserializer::from_str(raw) {
69 documents.push(YamlValue::deserialize(document)?);
70 }
71 match documents.len() {
72 0 => Err(anyhow::anyhow!("Maestro flow is empty.")),
73 1 => Ok(documents.remove(0)),
74 _ => {
75 let app_id = documents
76 .first()
77 .and_then(|value| yaml_string_or_field(value, "appId"));
78 let mut commands = documents
79 .pop()
80 .ok_or_else(|| anyhow::anyhow!("Maestro flow is empty."))?;
81 if let Some(app_id) = app_id {
82 fill_empty_launch_app_commands(&mut commands, &app_id);
83 }
84 Ok(commands)
85 }
86 }
87}
88
89fn fill_empty_launch_app_commands(commands: &mut YamlValue, app_id: &str) {
90 let Some(commands) = commands.as_sequence_mut() else {

Callers 2

run_maestro_flowFunction · 0.85

Calls 3

yaml_string_or_fieldFunction · 0.85
removeMethod · 0.65