MCPcopy Create free account
hub / github.com/aeroxy/chrome-devtools-cli / parse_kv

Function parse_kv

src/lib.rs:494–500  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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`].
494fn 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
502fn parse_args(named_args: &[String], raw_args: &[String]) -> Result<serde_json::Value> {
503 let mut map = serde_json::Map::new();

Callers 1

parse_argsFunction · 0.85

Calls 2

parse_json_valueFunction · 0.85
is_emptyMethod · 0.80

Tested by

no test coverage detected