Split a `key=value` argument, trim both sides, and parse the value into JSON. Shared by the `named_args` and `raw_args` loops in [`parse_args`].
(key: &str, value: &str, arg: &str)
| 492 | /// Split a `key=value` argument, trim both sides, and parse the value into |
| 493 | /// JSON. Shared by the `named_args` and `raw_args` loops in [`parse_args`]. |
| 494 | fn parse_kv(key: &str, value: &str, arg: &str) -> Result<(String, serde_json::Value)> { |
| 495 | let key = key.trim(); |
| 496 | if key.is_empty() { |
| 497 | anyhow::bail!("Invalid argument '{arg}': key must not be empty"); |
| 498 | } |
| 499 | Ok((key.to_string(), parse_json_value(value.trim()))) |
| 500 | } |
| 501 | |
| 502 | fn parse_args(named_args: &[String], raw_args: &[String]) -> Result<serde_json::Value> { |
| 503 | let mut map = serde_json::Map::new(); |
no test coverage detected