Skip to content
jc-rs
GitHub

hosts

--hostsv1.4.0

Converts `/etc/hosts` file content to JSON

fileslurpable
$ cat input.txt | jc-rs --hosts

A real pair

From the reference corpus (centos-7.7/hosts.json). The left pane is the input the fixture ships; the right pane is the corpus's expected JSON. CI compares jc-rs with it field by field under the published differential. Hover a value to see where it came from.

hostscentos-7.7
# comment line
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6 # this is a comment
expected outputjson
Use the Left and Right arrow keys to highlight the matching value in the input.
[
  {
    "ip": "127.0.0.1",
    "hostname": [
      "localhost",
      "localhost.localdomain",
      "localhost4",
      "localhost4.localdomain4"
    ]
  },
  {
    "ip": "::1",
    "hostname": [
      "localhost",
      "localhost.localdomain",
      "localhost6",
      "localhost6.localdomain6"
    ]
  }
]

Fixture coverage

2/2oracle-valid pairs match under the published structural JSON comparison

Magic syntax

not availableThis parser reads a file or a string rather than a command, so there is nothing for jc-rs to run. Pipe it in.

Source: crates/jc-rs-parsers/src/misc/hosts.rs. jc-rs targets the schemas defined by the original Python tool. Fixture coverage above is the measured evidence for this parser; test the inputs your pipeline depends on. Compare