Skip to content

Commit

Permalink
fix string parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaMilosa committed Sep 24, 2024
1 parent 8b197dc commit 30d434c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions rs/cli/src/commands/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ impl FromStr for Filter {
if split.len() != 2 {
anyhow::bail!("Expected `key=value` format, found {}", s)
}

let first = split.first().unwrap();
let last = split.last().unwrap();
Ok(Self {
key: split.first().map(|s| s.to_string()).unwrap(),
value: serde_json::from_str(split.last().unwrap())?,
key: first.to_string(),
value: serde_json::from_str(last).unwrap_or_else(|_| serde_json::Value::String(last.to_string())),
})
}
}
Expand Down

0 comments on commit 30d434c

Please sign in to comment.