canic-cli 0.37.1

Operator CLI for Canic fleet backup and restore workflows
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use canic_host::response_parse::{find_string_field, parse_candid_text_field, response_candid};

pub(super) use canic_host::response_parse::parse_cycle_balance_response;

pub(super) fn parse_canic_metadata_version_response(output: &str) -> Option<String> {
    serde_json::from_str::<serde_json::Value>(output)
        .ok()
        .and_then(|value| {
            find_string_field(&value, "canic_version").or_else(|| {
                response_candid(&value)
                    .and_then(|candid| parse_candid_text_field(candid, "canic_version"))
            })
        })
        .or_else(|| parse_candid_text_field(output, "canic_version"))
}

#[cfg(test)]
mod tests;