1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00

add schema docs for pci-ids

This commit is contained in:
Kelly Brazil
2022-10-21 11:50:06 -07:00
parent 076c197385
commit fdec4f08c0
3 changed files with 95 additions and 21 deletions

View File

@ -9,6 +9,28 @@ This parser converts the pci.ids database file.
https://raw.githubusercontent.com/pciutils/pciids/master/pci.ids
A nested schema allows straightforward queries with tools like `jq`. Hex id
numbers are prefixed with an underscore (`_`) so bracket notation is not
necessary when referencing. For example:
$ cat pci.ids | jc --pci-ids | jq '.vendors._9005._0053._9005._ffff.subsystem_name'
"AIC-7896 SCSI Controller mainboard implementation"
Here are the vendor and class mappings:
jq '.vendors._001c._0001._001c._0005.subsystem_name'
| | | |
| | | subdevice
| | subvendor
| device
vendor
jq '.classes._0c._03._40'
| | |
| | prog_if
| subclass
class
Usage (cli):
$ cat pci.ids | jc --pci-ids
@ -20,21 +42,36 @@ Usage (module):
Schema:
[
{
"pci-id": string,
"bar": boolean,
"baz": integer
"vendors": {
"_<vendor_id>": {
"vendor_name": string,
"_<device_id>": {
"device_name": string,
"_<subvendor_id>": {
"_<subdevice_id": string
}
}
}
},
"classes": {
"_<class_id>": {
"class_name": string,
"_<subclass_id>": {
"subclass_name": string,
"_<prog_if>": string
}
}
}
}
]
Examples:
$ cat pci.ids | jc --pci-id -p
[]
$ cat pci.ids | jc --pci-ids | jq '.vendors._001c._0001._001c._0005.subsystem_name'
"2 Channel CAN Bus SJC1000 (Optically Isolated)"
$ cat pci.ids | jc --pci-id -p -r
[]
$ cat pci.ids | jc --pci-ids | jq '.classes._0c._03._40'
"USB4 Host Interface"
<a id="jc.parsers.pci_ids.parse"></a>

View File

@ -4,6 +4,28 @@ This parser converts the pci.ids database file.
https://raw.githubusercontent.com/pciutils/pciids/master/pci.ids
A nested schema allows straightforward queries with tools like `jq`. Hex id
numbers are prefixed with an underscore (`_`) so bracket notation is not
necessary when referencing. For example:
$ cat pci.ids | jc --pci-ids | jq '.vendors._9005._0053._9005._ffff.subsystem_name'
"AIC-7896 SCSI Controller mainboard implementation"
Here are the vendor and class mappings:
jq '.vendors._001c._0001._001c._0005.subsystem_name'
| | | |
| | | subdevice
| | subvendor
| device
vendor
jq '.classes._0c._03._40'
| | |
| | prog_if
| subclass
class
Usage (cli):
$ cat pci.ids | jc --pci-ids
@ -15,21 +37,36 @@ Usage (module):
Schema:
[
{
"pci-id": string,
"bar": boolean,
"baz": integer
"vendors": {
"_<vendor_id>": {
"vendor_name": string,
"_<device_id>": {
"device_name": string,
"_<subvendor_id>": {
"_<subdevice_id": string
}
}
}
},
"classes": {
"_<class_id>": {
"class_name": string,
"_<subclass_id>": {
"subclass_name": string,
"_<prog_if>": string
}
}
}
}
]
Examples:
$ cat pci.ids | jc --pci-id -p
[]
$ cat pci.ids | jc --pci-ids | jq '.vendors._001c._0001._001c._0005.subsystem_name'
"2 Channel CAN Bus SJC1000 (Optically Isolated)"
$ cat pci.ids | jc --pci-id -p -r
[]
$ cat pci.ids | jc --pci-ids | jq '.classes._0c._03._40'
"USB4 Host Interface"
"""
import re
from typing import Dict

View File

@ -1,4 +1,4 @@
.TH jc 1 2022-10-19 1.22.1 "JSON Convert"
.TH jc 1 2022-10-21 1.22.1 "JSON Convert"
.SH NAME
\fBjc\fP \- JSON Convert JSONifies the output of many CLI tools, file-types, and strings
.SH SYNOPSIS