Skip to main content

parse_labels_json

Function parse_labels_json 

Source
pub fn parse_labels_json(s: &str) -> Result<Vec<RemoteLabel>>
Expand description

Parse the JSON returned by gh label list --json name,color,description. Exposed publicly so unit tests can cover the contract without shelling out. Two normalisations happen here so callers get a uniformly-shaped RemoteLabel:

  • color is lowercased. GitHub serialises hex colours in either case; the diff engine expects the lowercase form, and normalising at the parse boundary means downstream code never has to think about it.
  • description is left as-is. An empty "" from GitHub round-trips as Some(""); the labels-diff module collapses empty strings to None on its own.