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

update markdown processor settings

This commit is contained in:
Kelly Brazil
2022-01-25 18:03:34 -08:00
parent 75cd84ce8a
commit 386f6c317e
89 changed files with 9348 additions and 9735 deletions

View File

@ -4,16 +4,16 @@
cd jc cd jc
echo Building docs for: package echo Building docs for: package
pydoc-markdown -m jc > ../docs/readme.md pydoc-markdown -m jc '{"processors": [{"type":"filter"},{"type":"pydocmd"}]}' > ../docs/readme.md
echo Building docs for: lib echo Building docs for: lib
pydoc-markdown -m jc.lib > ../docs/lib.md pydoc-markdown -m jc.lib '{"processors": [{"type":"filter"},{"type":"pydocmd"}]}' > ../docs/lib.md
echo Building docs for: utils echo Building docs for: utils
pydoc-markdown -m jc.utils > ../docs/utils.md pydoc-markdown -m jc.utils '{"processors": [{"type":"filter"},{"type":"pydocmd"}]}' > ../docs/utils.md
echo Building docs for: universal parser echo Building docs for: universal parser
pydoc-markdown -m jc.parsers.universal > ../docs/parsers/universal.md pydoc-markdown -m jc.parsers.universal '{"processors": [{"type":"filter"},{"type":"pydocmd"}]}' > ../docs/parsers/universal.md
# a bit of inception here... jc is being used to help # a bit of inception here... jc is being used to help
# automate the generation of its own documentation. :) # automate the generation of its own documentation. :)
@ -36,7 +36,7 @@ do
echo "Building docs for: ${parser_name}" echo "Building docs for: ${parser_name}"
echo "[Home](https://kellyjonbrazil.github.io/jc/)" > ../docs/parsers/"${parser_name}".md echo "[Home](https://kellyjonbrazil.github.io/jc/)" > ../docs/parsers/"${parser_name}".md
pydoc-markdown -m jc.parsers."${parser_name}" >> ../docs/parsers/"${parser_name}".md pydoc-markdown -m jc.parsers."${parser_name}" '{"processors": [{"type":"filter"},{"type":"pydocmd"}]}' >> ../docs/parsers/"${parser_name}".md
echo "## Parser Information" >> ../docs/parsers/"${parser_name}".md echo "## Parser Information" >> ../docs/parsers/"${parser_name}".md
echo "Compatibility: ${compatible}" >> ../docs/parsers/"${parser_name}".md echo "Compatibility: ${compatible}" >> ../docs/parsers/"${parser_name}".md
echo >> ../docs/parsers/"${parser_name}".md echo >> ../docs/parsers/"${parser_name}".md

View File

@ -20,12 +20,11 @@ Parse the string data using the supplied parser module.
This function provides a high-level API to simplify parser use. This This function provides a high-level API to simplify parser use. This
function will call built-in parsers and custom plugin parsers. function will call built-in parsers and custom plugin parsers.
**Example**: Example:
>>> import jc >>> import jc
>>> jc.parse('date', 'Tue Jan 18 10:23:07 PST 2022') >>> jc.parse('date', 'Tue Jan 18 10:23:07 PST 2022')
- `{'year'` - 2022, 'month': 'Jan', 'month_num': 1, 'day'...} {'year': 2022, 'month': 'Jan', 'month_num': 1, 'day'...}
To get a list of available parser module names, use `parser_mod_list()` To get a list of available parser module names, use `parser_mod_list()`
or `plugin_parser_mod_list()`. `plugin_parser_mod_list()` is a subset or `plugin_parser_mod_list()`. `plugin_parser_mod_list()` is a subset
@ -49,29 +48,25 @@ function will call built-in parsers and custom plugin parsers.
>>> import my_custom_parser >>> import my_custom_parser
>>> my_custom_parser.parse('command_data') >>> my_custom_parser.parse('command_data')
Parameters:
**Arguments**: parser_mod_name: (string) name of the parser module. This
- `parser_mod_name` - (string) name of the parser module. This
function will accept module_name, function will accept module_name,
cli-name, and --argument-name cli-name, and --argument-name
variants of the module name. variants of the module name.
- `data` - (string or data to parse (string for normal data: (string or data to parse (string for normal
iterator) parsers, iterator of strings for iterator) parsers, iterator of strings for
streaming parsers) streaming parsers)
- `raw` - (boolean) output preprocessed JSON if True raw: (boolean) output preprocessed JSON if True
- `quiet` - (boolean) suppress warning messages if True quiet: (boolean) suppress warning messages if True
- `ignore_exceptions` - (boolean) ignore parsing exceptions if True ignore_exceptions: (boolean) ignore parsing exceptions if True
(streaming parsers only) (streaming parsers only)
Returns:
**Returns**:
Standard Parsers: Dictionary or List of Dictionaries Standard Parsers: Dictionary or List of Dictionaries
Streaming Parsers: Generator Object containing Dictionaries Streaming Parsers: Generator Object containing Dictionaries

View File

@ -62,90 +62,89 @@ string
} }
] ]
**Examples**: Examples:
$ acpi -V | jc --acpi -p $ acpi -V | jc --acpi -p
[ [
{ {
- `"type"` - "Battery", "type": "Battery",
- `"id"` - 0, "id": 0,
- `"state"` - "Charging", "state": "Charging",
- `"charge_percent"` - 71, "charge_percent": 71,
- `"until_charged"` - "00:29:20", "until_charged": "00:29:20",
- `"design_capacity_mah"` - 2110, "design_capacity_mah": 2110,
- `"last_full_capacity"` - 2271, "last_full_capacity": 2271,
- `"last_full_capacity_percent"` - 100, "last_full_capacity_percent": 100,
- `"until_charged_hours"` - 0, "until_charged_hours": 0,
- `"until_charged_minutes"` - 29, "until_charged_minutes": 29,
- `"until_charged_seconds"` - 20, "until_charged_seconds": 20,
- `"until_charged_total_seconds"` - 1760 "until_charged_total_seconds": 1760
}, },
{ {
- `"type"` - "Adapter", "type": "Adapter",
- `"id"` - 0, "id": 0,
- `"on-line"` - true "on-line": true
}, },
{ {
- `"type"` - "Thermal", "type": "Thermal",
- `"id"` - 0, "id": 0,
- `"mode"` - "ok", "mode": "ok",
- `"temperature"` - 46.0, "temperature": 46.0,
- `"temperature_unit"` - "C", "temperature_unit": "C",
- `"trip_points"` - [ "trip_points": [
{ {
- `"id"` - 0, "id": 0,
- `"switches_to_mode"` - "critical", "switches_to_mode": "critical",
- `"temperature"` - 127.0, "temperature": 127.0,
- `"temperature_unit"` - "C" "temperature_unit": "C"
}, },
{ {
- `"id"` - 1, "id": 1,
- `"switches_to_mode"` - "hot", "switches_to_mode": "hot",
- `"temperature"` - 127.0, "temperature": 127.0,
- `"temperature_unit"` - "C" "temperature_unit": "C"
} }
] ]
}, },
{ {
- `"type"` - "Cooling", "type": "Cooling",
- `"id"` - 0, "id": 0,
- `"messages"` - [ "messages": [
"Processor 0 of 10" "Processor 0 of 10"
] ]
}, },
{ {
- `"type"` - "Cooling", "type": "Cooling",
- `"id"` - 1, "id": 1,
- `"messages"` - [ "messages": [
"Processor 0 of 10" "Processor 0 of 10"
] ]
}, },
{ {
- `"type"` - "Cooling", "type": "Cooling",
- `"id"` - 2, "id": 2,
- `"messages"` - [ "messages": [
"x86_pkg_temp no state information available" "x86_pkg_temp no state information available"
] ]
}, },
{ {
- `"type"` - "Cooling", "type": "Cooling",
- `"id"` - 3, "id": 3,
- `"messages"` - [ "messages": [
"Processor 0 of 10" "Processor 0 of 10"
] ]
}, },
{ {
- `"type"` - "Cooling", "type": "Cooling",
- `"id"` - 4, "id": 4,
- `"messages"` - [ "messages": [
"intel_powerclamp no state information available" "intel_powerclamp no state information available"
] ]
}, },
{ {
- `"type"` - "Cooling", "type": "Cooling",
- `"id"` - 5, "id": 5,
- `"messages"` - [ "messages": [
"Processor 0 of 10" "Processor 0 of 10"
] ]
} }
@ -154,80 +153,80 @@ string
$ acpi -V | jc --acpi -p -r $ acpi -V | jc --acpi -p -r
[ [
{ {
- `"type"` - "Battery", "type": "Battery",
- `"id"` - "0", "id": "0",
- `"state"` - "Charging", "state": "Charging",
- `"charge_percent"` - "71", "charge_percent": "71",
- `"until_charged"` - "00:29:20", "until_charged": "00:29:20",
- `"design_capacity_mah"` - "2110", "design_capacity_mah": "2110",
- `"last_full_capacity"` - "2271", "last_full_capacity": "2271",
- `"last_full_capacity_percent"` - "100" "last_full_capacity_percent": "100"
}, },
{ {
- `"type"` - "Adapter", "type": "Adapter",
- `"id"` - "0", "id": "0",
- `"on-line"` - true "on-line": true
}, },
{ {
- `"type"` - "Thermal", "type": "Thermal",
- `"id"` - "0", "id": "0",
- `"mode"` - "ok", "mode": "ok",
- `"temperature"` - "46.0", "temperature": "46.0",
- `"temperature_unit"` - "C", "temperature_unit": "C",
- `"trip_points"` - [ "trip_points": [
{ {
- `"id"` - "0", "id": "0",
- `"switches_to_mode"` - "critical", "switches_to_mode": "critical",
- `"temperature"` - "127.0", "temperature": "127.0",
- `"temperature_unit"` - "C" "temperature_unit": "C"
}, },
{ {
- `"id"` - "1", "id": "1",
- `"switches_to_mode"` - "hot", "switches_to_mode": "hot",
- `"temperature"` - "127.0", "temperature": "127.0",
- `"temperature_unit"` - "C" "temperature_unit": "C"
} }
] ]
}, },
{ {
- `"type"` - "Cooling", "type": "Cooling",
- `"id"` - "0", "id": "0",
- `"messages"` - [ "messages": [
"Processor 0 of 10" "Processor 0 of 10"
] ]
}, },
{ {
- `"type"` - "Cooling", "type": "Cooling",
- `"id"` - "1", "id": "1",
- `"messages"` - [ "messages": [
"Processor 0 of 10" "Processor 0 of 10"
] ]
}, },
{ {
- `"type"` - "Cooling", "type": "Cooling",
- `"id"` - "2", "id": "2",
- `"messages"` - [ "messages": [
"x86_pkg_temp no state information available" "x86_pkg_temp no state information available"
] ]
}, },
{ {
- `"type"` - "Cooling", "type": "Cooling",
- `"id"` - "3", "id": "3",
- `"messages"` - [ "messages": [
"Processor 0 of 10" "Processor 0 of 10"
] ]
}, },
{ {
- `"type"` - "Cooling", "type": "Cooling",
- `"id"` - "4", "id": "4",
- `"messages"` - [ "messages": [
"intel_powerclamp no state information available" "intel_powerclamp no state information available"
] ]
}, },
{ {
- `"type"` - "Cooling", "type": "Cooling",
- `"id"` - "5", "id": "5",
- `"messages"` - [ "messages": [
"Processor 0 of 10" "Processor 0 of 10"
] ]
} }
@ -253,16 +252,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -45,45 +45,44 @@ Schema:
"channel": string "channel": string
} }
**Examples**: Examples:
$ airport -I | jc --airport -p $ airport -I | jc --airport -p
{ {
- `"agrctlrssi"` - -66, "agrctlrssi": -66,
- `"agrextrssi"` - 0, "agrextrssi": 0,
- `"agrctlnoise"` - -90, "agrctlnoise": -90,
- `"agrextnoise"` - 0, "agrextnoise": 0,
- `"state"` - "running", "state": "running",
- `"op_mode"` - "station", "op_mode": "station",
- `"lasttxrate"` - 195, "lasttxrate": 195,
- `"maxrate"` - 867, "maxrate": 867,
- `"lastassocstatus"` - 0, "lastassocstatus": 0,
- `"802_11_auth"` - "open", "802_11_auth": "open",
- `"link_auth"` - "wpa2-psk", "link_auth": "wpa2-psk",
- `"bssid"` - "3c:37:86:15:ad:f9", "bssid": "3c:37:86:15:ad:f9",
- `"ssid"` - "SnazzleDazzle", "ssid": "SnazzleDazzle",
- `"mcs"` - 0, "mcs": 0,
- `"channel"` - "48,80" "channel": "48,80"
} }
$ airport -I | jc --airport -p -r $ airport -I | jc --airport -p -r
{ {
- `"agrctlrssi"` - "-66", "agrctlrssi": "-66",
- `"agrextrssi"` - "0", "agrextrssi": "0",
- `"agrctlnoise"` - "-90", "agrctlnoise": "-90",
- `"agrextnoise"` - "0", "agrextnoise": "0",
- `"state"` - "running", "state": "running",
- `"op_mode"` - "station", "op_mode": "station",
- `"lasttxrate"` - "195", "lasttxrate": "195",
- `"maxrate"` - "867", "maxrate": "867",
- `"lastassocstatus"` - "0", "lastassocstatus": "0",
- `"802_11_auth"` - "open", "802_11_auth": "open",
- `"link_auth"` - "wpa2-psk", "link_auth": "wpa2-psk",
- `"bssid"` - "3c:37:86:15:ad:f9", "bssid": "3c:37:86:15:ad:f9",
- `"ssid"` - "SnazzleDazzle", "ssid": "SnazzleDazzle",
- `"mcs"` - "0", "mcs": "0",
- `"channel"` - "48,80" "channel": "48,80"
} }
<a id="jc.parsers.airport.info"></a> <a id="jc.parsers.airport.info"></a>
@ -106,16 +105,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
Dictionary. Raw or processed structured data. Dictionary. Raw or processed structured data.

View File

@ -41,41 +41,40 @@ string,
} }
] ]
**Examples**: Examples:
$ airport -s | jc --airport-s -p $ airport -s | jc --airport-s -p
[ [
{ {
- `"ssid"` - "DIRECT-4A-HP OfficeJet 3830", "ssid": "DIRECT-4A-HP OfficeJet 3830",
- `"bssid"` - "00:67:eb:2a:a7:3b", "bssid": "00:67:eb:2a:a7:3b",
- `"rssi"` - -90, "rssi": -90,
- `"channel"` - "6", "channel": "6",
- `"ht"` - true, "ht": true,
- `"cc"` - "--", "cc": "--",
- `"security"` - [ "security": [
"WPA2(PSK/AES/AES)" "WPA2(PSK/AES/AES)"
] ]
}, },
{ {
- `"ssid"` - "Latitude38", "ssid": "Latitude38",
- `"bssid"` - "c0:ff:d5:d2:7a:f3", "bssid": "c0:ff:d5:d2:7a:f3",
- `"rssi"` - -85, "rssi": -85,
- `"channel"` - "11", "channel": "11",
- `"ht"` - true, "ht": true,
- `"cc"` - "US", "cc": "US",
- `"security"` - [ "security": [
"WPA2(PSK/AES/AES)" "WPA2(PSK/AES/AES)"
] ]
}, },
{ {
- `"ssid"` - "xfinitywifi", "ssid": "xfinitywifi",
- `"bssid"` - "6e:e3:0e:b8:45:99", "bssid": "6e:e3:0e:b8:45:99",
- `"rssi"` - -83, "rssi": -83,
- `"channel"` - "11", "channel": "11",
- `"ht"` - true, "ht": true,
- `"cc"` - "US", "cc": "US",
- `"security"` - [ "security": [
"NONE" "NONE"
] ]
}, },
@ -85,31 +84,31 @@ string,
$ airport -s | jc --airport -p -r $ airport -s | jc --airport -p -r
[ [
{ {
- `"ssid"` - "DIRECT-F3-HP ENVY 5660 series", "ssid": "DIRECT-F3-HP ENVY 5660 series",
- `"bssid"` - "b0:5a:da:6f:0a:d4", "bssid": "b0:5a:da:6f:0a:d4",
- `"rssi"` - "-93", "rssi": "-93",
- `"channel"` - "1", "channel": "1",
- `"ht"` - "Y", "ht": "Y",
- `"cc"` - "--", "cc": "--",
- `"security"` - "WPA2(PSK/AES/AES)" "security": "WPA2(PSK/AES/AES)"
}, },
{ {
- `"ssid"` - "YouAreInfected-5", "ssid": "YouAreInfected-5",
- `"bssid"` - "5c:e3:0e:c2:85:da", "bssid": "5c:e3:0e:c2:85:da",
- `"rssi"` - "-85", "rssi": "-85",
- `"channel"` - "36", "channel": "36",
- `"ht"` - "Y", "ht": "Y",
- `"cc"` - "US", "cc": "US",
- `"security"` - "WPA(PSK/AES,TKIP/TKIP) WPA2(PSK/AES,TKIP/TKIP)" "security": "WPA(PSK/AES,TKIP/TKIP) WPA2(PSK/AES,TKIP/TKIP)"
}, },
{ {
- `"ssid"` - "YuanFamily", "ssid": "YuanFamily",
- `"bssid"` - "5c:e3:0e:b8:5f:9a", "bssid": "5c:e3:0e:b8:5f:9a",
- `"rssi"` - "-84", "rssi": "-84",
- `"channel"` - "11", "channel": "11",
- `"ht"` - "Y", "ht": "Y",
- `"cc"` - "US", "cc": "US",
- `"security"` - "WPA(PSK/AES,TKIP/TKIP) WPA2(PSK/AES,TKIP/TKIP)" "security": "WPA(PSK/AES,TKIP/TKIP) WPA2(PSK/AES,TKIP/TKIP)"
}, },
... ...
] ]
@ -134,16 +133,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -40,86 +40,85 @@ Schema:
} }
] ]
**Examples**: Examples:
$ arp | jc --arp -p $ arp | jc --arp -p
[ [
{ {
- `"address"` - "192.168.71.254", "address": "192.168.71.254",
- `"hwtype"` - "ether", "hwtype": "ether",
- `"hwaddress"` - "00:50:56:f0:98:26", "hwaddress": "00:50:56:f0:98:26",
- `"flags_mask"` - "C", "flags_mask": "C",
- `"iface"` - "ens33" "iface": "ens33"
}, },
{ {
- `"address"` - "gateway", "address": "gateway",
- `"hwtype"` - "ether", "hwtype": "ether",
- `"hwaddress"` - "00:50:56:f7:4a:fc", "hwaddress": "00:50:56:f7:4a:fc",
- `"flags_mask"` - "C", "flags_mask": "C",
- `"iface"` - "ens33" "iface": "ens33"
} }
] ]
$ arp | jc --arp -p -r $ arp | jc --arp -p -r
[ [
{ {
- `"address"` - "gateway", "address": "gateway",
- `"hwtype"` - "ether", "hwtype": "ether",
- `"hwaddress"` - "00:50:56:f7:4a:fc", "hwaddress": "00:50:56:f7:4a:fc",
- `"flags_mask"` - "C", "flags_mask": "C",
- `"iface"` - "ens33" "iface": "ens33"
}, },
{ {
- `"address"` - "192.168.71.254", "address": "192.168.71.254",
- `"hwtype"` - "ether", "hwtype": "ether",
- `"hwaddress"` - "00:50:56:fe:7a:b4", "hwaddress": "00:50:56:fe:7a:b4",
- `"flags_mask"` - "C", "flags_mask": "C",
- `"iface"` - "ens33" "iface": "ens33"
} }
] ]
$ arp -a | jc --arp -p $ arp -a | jc --arp -p
[ [
{ {
- `"name"` - null, "name": null,
- `"address"` - "192.168.71.254", "address": "192.168.71.254",
- `"hwtype"` - "ether", "hwtype": "ether",
- `"hwaddress"` - "00:50:56:f0:98:26", "hwaddress": "00:50:56:f0:98:26",
- `"iface"` - "ens33" "iface": "ens33"
- `"permanent"` - false, "permanent": false,
- `"expires"` - 1182 "expires": 1182
}, },
{ {
- `"name"` - "gateway", "name": "gateway",
- `"address"` - "192.168.71.2", "address": "192.168.71.2",
- `"hwtype"` - "ether", "hwtype": "ether",
- `"hwaddress"` - "00:50:56:f7:4a:fc", "hwaddress": "00:50:56:f7:4a:fc",
- `"iface"` - "ens33" "iface": "ens33"
- `"permanent"` - false, "permanent": false,
- `"expires"` - 110 "expires": 110
} }
] ]
$ arp -a | jc --arp -p -r $ arp -a | jc --arp -p -r
[ [
{ {
- `"name"` - "?", "name": "?",
- `"address"` - "192.168.71.254", "address": "192.168.71.254",
- `"hwtype"` - "ether", "hwtype": "ether",
- `"hwaddress"` - "00:50:56:fe:7a:b4", "hwaddress": "00:50:56:fe:7a:b4",
- `"iface"` - "ens33" "iface": "ens33"
- `"permanent"` - false, "permanent": false,
- `"expires"` - "1182" "expires": "1182"
}, },
{ {
- `"name"` - "_gateway", "name": "_gateway",
- `"address"` - "192.168.71.2", "address": "192.168.71.2",
- `"hwtype"` - "ether", "hwtype": "ether",
- `"hwaddress"` - "00:50:56:f7:4a:fc", "hwaddress": "00:50:56:f7:4a:fc",
- `"iface"` - "ens33" "iface": "ens33"
- `"permanent"` - false, "permanent": false,
- `"expires"` - "110" "expires": "110"
} }
] ]
@ -143,16 +142,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -59,70 +59,69 @@ Schema:
} }
] ]
**Examples**: Examples:
$ blkid | jc --blkid -p $ blkid | jc --blkid -p
[ [
{ {
- `"device"` - "/dev/sda1", "device": "/dev/sda1",
- `"uuid"` - "05d927ab-5875-49e4-ada1-7f46cb32c932", "uuid": "05d927ab-5875-49e4-ada1-7f46cb32c932",
- `"type"` - "xfs" "type": "xfs"
}, },
{ {
- `"device"` - "/dev/sda2", "device": "/dev/sda2",
- `"uuid"` - "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM", "uuid": "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM",
- `"type"` - "LVM2_member" "type": "LVM2_member"
}, },
{ {
- `"device"` - "/dev/mapper/centos-root", "device": "/dev/mapper/centos-root",
- `"uuid"` - "07d718ff-950c-4e5b-98f0-42a1147c77d9", "uuid": "07d718ff-950c-4e5b-98f0-42a1147c77d9",
- `"type"` - "xfs" "type": "xfs"
}, },
{ {
- `"device"` - "/dev/mapper/centos-swap", "device": "/dev/mapper/centos-swap",
- `"uuid"` - "615eb89a-bcbf-46fd-80e3-c483ff5c931f", "uuid": "615eb89a-bcbf-46fd-80e3-c483ff5c931f",
- `"type"` - "swap" "type": "swap"
} }
] ]
$ sudo blkid -o udev -ip /dev/sda2 | jc --blkid -p $ sudo blkid -o udev -ip /dev/sda2 | jc --blkid -p
[ [
{ {
- `"id_fs_uuid"` - "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM", "id_fs_uuid": "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM",
- `"id_fs_uuid_enc"` - "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM", "id_fs_uuid_enc": "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM",
- `"id_fs_version"` - "LVM2\\x20001", "id_fs_version": "LVM2\\x20001",
- `"id_fs_type"` - "LVM2_member", "id_fs_type": "LVM2_member",
- `"id_fs_usage"` - "raid", "id_fs_usage": "raid",
- `"id_iolimit_minimum_io_size"` - 512, "id_iolimit_minimum_io_size": 512,
- `"id_iolimit_physical_sector_size"` - 512, "id_iolimit_physical_sector_size": 512,
- `"id_iolimit_logical_sector_size"` - 512, "id_iolimit_logical_sector_size": 512,
- `"id_part_entry_scheme"` - "dos", "id_part_entry_scheme": "dos",
- `"id_part_entry_type"` - "0x8e", "id_part_entry_type": "0x8e",
- `"id_part_entry_number"` - 2, "id_part_entry_number": 2,
- `"id_part_entry_offset"` - 2099200, "id_part_entry_offset": 2099200,
- `"id_part_entry_size"` - 39843840, "id_part_entry_size": 39843840,
- `"id_part_entry_disk"` - "8:0" "id_part_entry_disk": "8:0"
} }
] ]
$ sudo blkid -ip /dev/sda1 | jc --blkid -p -r $ sudo blkid -ip /dev/sda1 | jc --blkid -p -r
[ [
{ {
- `"devname"` - "/dev/sda1", "devname": "/dev/sda1",
- `"uuid"` - "05d927bb-5875-49e3-ada1-7f46cb31c932", "uuid": "05d927bb-5875-49e3-ada1-7f46cb31c932",
- `"type"` - "xfs", "type": "xfs",
- `"usage"` - "filesystem", "usage": "filesystem",
- `"minimum_io_size"` - "512", "minimum_io_size": "512",
- `"physical_sector_size"` - "512", "physical_sector_size": "512",
- `"logical_sector_size"` - "512", "logical_sector_size": "512",
- `"part_entry_scheme"` - "dos", "part_entry_scheme": "dos",
- `"part_entry_type"` - "0x83", "part_entry_type": "0x83",
- `"part_entry_flags"` - "0x80", "part_entry_flags": "0x80",
- `"part_entry_number"` - "1", "part_entry_number": "1",
- `"part_entry_offset"` - "2048", "part_entry_offset": "2048",
- `"part_entry_size"` - "2097152", "part_entry_size": "2097152",
- `"part_entry_disk"` - "8:0" "part_entry_disk": "8:0"
} }
] ]
@ -146,16 +145,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -37,25 +37,24 @@ Schema:
} }
] ]
**Examples**: Examples:
$ cksum * | jc --cksum -p $ cksum * | jc --cksum -p
[ [
{ {
- `"filename"` - "__init__.py", "filename": "__init__.py",
- `"checksum"` - 4294967295, "checksum": 4294967295,
- `"blocks"` - 0 "blocks": 0
}, },
{ {
- `"filename"` - "airport.py", "filename": "airport.py",
- `"checksum"` - 2208551092, "checksum": 2208551092,
- `"blocks"` - 3745 "blocks": 3745
}, },
{ {
- `"filename"` - "airport_s.py", "filename": "airport_s.py",
- `"checksum"` - 1113817598, "checksum": 1113817598,
- `"blocks"` - 4572 "blocks": 4572
}, },
... ...
] ]
@ -80,16 +79,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -59,122 +59,121 @@ string
] ]
} }
**Examples**: Examples:
$ crontab -l | jc --crontab -p $ crontab -l | jc --crontab -p
{ {
- `"variables"` - [ "variables": [
{ {
- `"name"` - "MAILTO", "name": "MAILTO",
- `"value"` - "root" "value": "root"
}, },
{ {
- `"name"` - "PATH", "name": "PATH",
- `"value"` - "/sbin:/bin:/usr/sbin:/usr/bin" "value": "/sbin:/bin:/usr/sbin:/usr/bin"
}, },
{ {
- `"name"` - "SHELL", "name": "SHELL",
- `"value"` - "/bin/bash" "value": "/bin/bash"
} }
], ],
- `"schedule"` - [ "schedule": [
{ {
- `"minute"` - [ "minute": [
"5" "5"
], ],
- `"hour"` - [ "hour": [
"10-11", "10-11",
"22" "22"
], ],
- `"day_of_month"` - [ "day_of_month": [
"*" "*"
], ],
- `"month"` - [ "month": [
"*" "*"
], ],
- `"day_of_week"` - [ "day_of_week": [
"*" "*"
], ],
- `"command"` - "/var/www/devdaily.com/bin/mk-new-links.php" "command": "/var/www/devdaily.com/bin/mk-new-links.php"
}, },
{ {
- `"minute"` - [ "minute": [
"30" "30"
], ],
- `"hour"` - [ "hour": [
"4/2" "4/2"
], ],
- `"day_of_month"` - [ "day_of_month": [
"*" "*"
], ],
- `"month"` - [ "month": [
"*" "*"
], ],
- `"day_of_week"` - [ "day_of_week": [
"*" "*"
], ],
- `"command"` - "/var/www/devdaily.com/bin/create-all-backups.sh" "command": "/var/www/devdaily.com/bin/create-all-backups.sh"
}, },
{ {
- `"occurrence"` - "yearly", "occurrence": "yearly",
- `"command"` - "/home/maverick/bin/annual-maintenance" "command": "/home/maverick/bin/annual-maintenance"
}, },
{ {
- `"occurrence"` - "reboot", "occurrence": "reboot",
- `"command"` - "/home/cleanup" "command": "/home/cleanup"
}, },
{ {
- `"occurrence"` - "monthly", "occurrence": "monthly",
- `"command"` - "/home/maverick/bin/tape-backup" "command": "/home/maverick/bin/tape-backup"
} }
] ]
} }
$ cat /etc/crontab | jc --crontab -p -r $ cat /etc/crontab | jc --crontab -p -r
{ {
- `"variables"` - [ "variables": [
{ {
- `"name"` - "MAILTO", "name": "MAILTO",
- `"value"` - "root" "value": "root"
}, },
{ {
- `"name"` - "PATH", "name": "PATH",
- `"value"` - "/sbin:/bin:/usr/sbin:/usr/bin" "value": "/sbin:/bin:/usr/sbin:/usr/bin"
}, },
{ {
- `"name"` - "SHELL", "name": "SHELL",
- `"value"` - "/bin/bash" "value": "/bin/bash"
} }
], ],
- `"schedule"` - [ "schedule": [
{ {
- `"minute"` - "5", "minute": "5",
- `"hour"` - "10-11,22", "hour": "10-11,22",
- `"day_of_month"` - "*", "day_of_month": "*",
- `"month"` - "*", "month": "*",
- `"day_of_week"` - "*", "day_of_week": "*",
- `"command"` - "/var/www/devdaily.com/bin/mk-new-links.php" "command": "/var/www/devdaily.com/bin/mk-new-links.php"
}, },
{ {
- `"minute"` - "30", "minute": "30",
- `"hour"` - "4/2", "hour": "4/2",
- `"day_of_month"` - "*", "day_of_month": "*",
- `"month"` - "*", "month": "*",
- `"day_of_week"` - "*", "day_of_week": "*",
- `"command"` - "/var/www/devdaily.com/bin/create-all-backups.sh" "command": "/var/www/devdaily.com/bin/create-all-backups.sh"
}, },
{ {
- `"occurrence"` - "yearly", "occurrence": "yearly",
- `"command"` - "/home/maverick/bin/annual-maintenance" "command": "/home/maverick/bin/annual-maintenance"
}, },
{ {
- `"occurrence"` - "reboot", "occurrence": "reboot",
- `"command"` - "/home/cleanup" "command": "/home/cleanup"
}, },
{ {
- `"occurrence"` - "monthly", "occurrence": "monthly",
- `"command"` - "/home/maverick/bin/tape-backup" "command": "/home/maverick/bin/tape-backup"
} }
] ]
} }
@ -199,16 +198,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
Dictionary. Raw or processed structured data. Dictionary. Raw or processed structured data.

View File

@ -57,121 +57,120 @@ string
] ]
} }
**Examples**: Examples:
$ cat /etc/crontab | jc --crontab-u -p $ cat /etc/crontab | jc --crontab-u -p
{ {
- `"variables"` - [ "variables": [
{ {
- `"name"` - "PATH", "name": "PATH",
- `"value"` - "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sb..." "value": "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sb..."
}, },
{ {
- `"name"` - "SHELL", "name": "SHELL",
- `"value"` - "/bin/sh" "value": "/bin/sh"
} }
], ],
- `"schedule"` - [ "schedule": [
{ {
- `"minute"` - [ "minute": [
"25" "25"
], ],
- `"hour"` - [ "hour": [
"6" "6"
], ],
- `"day_of_month"` - [ "day_of_month": [
"*" "*"
], ],
- `"month"` - [ "month": [
"*" "*"
], ],
- `"day_of_week"` - [ "day_of_week": [
"*" "*"
], ],
- `"user"` - "root", "user": "root",
- `"command"` - "test -x /usr/sbin/anacron || ( cd / && run-parts ..." "command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
}, },
{ {
- `"minute"` - [ "minute": [
"47" "47"
], ],
- `"hour"` - [ "hour": [
"6" "6"
], ],
- `"day_of_month"` - [ "day_of_month": [
"*" "*"
], ],
- `"month"` - [ "month": [
"*" "*"
], ],
- `"day_of_week"` - [ "day_of_week": [
"7" "7"
], ],
- `"user"` - "root", "user": "root",
- `"command"` - "test -x /usr/sbin/anacron || ( cd / && run-parts ..." "command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
}, },
{ {
- `"minute"` - [ "minute": [
"52" "52"
], ],
- `"hour"` - [ "hour": [
"6" "6"
], ],
- `"day_of_month"` - [ "day_of_month": [
"1" "1"
], ],
- `"month"` - [ "month": [
"*" "*"
], ],
- `"day_of_week"` - [ "day_of_week": [
"*" "*"
], ],
- `"user"` - "root", "user": "root",
- `"command"` - "test -x /usr/sbin/anacron || ( cd / && run-parts ..." "command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
} }
] ]
} }
$ cat /etc/crontab | jc --crontab-u -p -r $ cat /etc/crontab | jc --crontab-u -p -r
{ {
- `"variables"` - [ "variables": [
{ {
- `"name"` - "PATH", "name": "PATH",
- `"value"` - "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/..." "value": "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/..."
}, },
{ {
- `"name"` - "SHELL", "name": "SHELL",
- `"value"` - "/bin/sh" "value": "/bin/sh"
} }
], ],
- `"schedule"` - [ "schedule": [
{ {
- `"minute"` - "25", "minute": "25",
- `"hour"` - "6", "hour": "6",
- `"day_of_month"` - "*", "day_of_month": "*",
- `"month"` - "*", "month": "*",
- `"day_of_week"` - "*", "day_of_week": "*",
- `"user"` - "root", "user": "root",
- `"command"` - "test -x /usr/sbin/anacron || ( cd / && run-parts ..." "command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
}, },
{ {
- `"minute"` - "47", "minute": "47",
- `"hour"` - "6", "hour": "6",
- `"day_of_month"` - "*", "day_of_month": "*",
- `"month"` - "*", "month": "*",
- `"day_of_week"` - "7", "day_of_week": "7",
- `"user"` - "root", "user": "root",
- `"command"` - "test -x /usr/sbin/anacron || ( cd / && run-parts ..." "command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
}, },
{ {
- `"minute"` - "52", "minute": "52",
- `"hour"` - "6", "hour": "6",
- `"day_of_month"` - "1", "day_of_month": "1",
- `"month"` - "*", "month": "*",
- `"day_of_week"` - "*", "day_of_week": "*",
- `"user"` - "root", "user": "root",
- `"command"` - "test -x /usr/sbin/anacron || ( cd / && run-parts ..." "command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
} }
] ]
} }
@ -196,16 +195,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
Dictionary. Raw or processed structured data. Dictionary. Raw or processed structured data.

View File

@ -35,8 +35,7 @@ https://docs.python.org/3/library/csv.html
} }
] ]
**Examples**: Examples:
$ cat homes.csv $ cat homes.csv
"Sell", "List", "Living", "Rooms", "Beds", "Baths", "Age", "Acres"... "Sell", "List", "Living", "Rooms", "Beds", "Baths", "Age", "Acres"...
@ -48,37 +47,37 @@ https://docs.python.org/3/library/csv.html
$ cat homes.csv | jc --csv -p $ cat homes.csv | jc --csv -p
[ [
{ {
- `"Sell"` - "142", "Sell": "142",
- `"List"` - "160", "List": "160",
- `"Living"` - "28", "Living": "28",
- `"Rooms"` - "10", "Rooms": "10",
- `"Beds"` - "5", "Beds": "5",
- `"Baths"` - "3", "Baths": "3",
- `"Age"` - "60", "Age": "60",
- `"Acres"` - "0.28", "Acres": "0.28",
- `"Taxes"` - "3167" "Taxes": "3167"
}, },
{ {
- `"Sell"` - "175", "Sell": "175",
- `"List"` - "180", "List": "180",
- `"Living"` - "18", "Living": "18",
- `"Rooms"` - "8", "Rooms": "8",
- `"Beds"` - "4", "Beds": "4",
- `"Baths"` - "1", "Baths": "1",
- `"Age"` - "12", "Age": "12",
- `"Acres"` - "0.43", "Acres": "0.43",
- `"Taxes"` - "4033" "Taxes": "4033"
}, },
{ {
- `"Sell"` - "129", "Sell": "129",
- `"List"` - "132", "List": "132",
- `"Living"` - "13", "Living": "13",
- `"Rooms"` - "6", "Rooms": "6",
- `"Beds"` - "3", "Beds": "3",
- `"Baths"` - "1", "Baths": "1",
- `"Age"` - "41", "Age": "41",
- `"Acres"` - "0.33", "Acres": "0.33",
- `"Taxes"` - "1471" "Taxes": "1471"
}, },
... ...
] ]
@ -103,16 +102,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -53,8 +53,7 @@ https://docs.python.org/3/library/csv.html
} }
} }
**Examples**: Examples:
$ cat homes.csv $ cat homes.csv
"Sell", "List", "Living", "Rooms", "Beds", "Baths", "Age", "Acres"... "Sell", "List", "Living", "Rooms", "Beds", "Baths", "Age", "Acres"...
@ -89,25 +88,20 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False)
Main text parsing generator function. Returns an iterator object. Main text parsing generator function. Returns an iterator object.
**Arguments**: Parameters:
data: (iterable) line-based text data to parse
- `data` - (iterable) line-based text data to parse
(e.g. sys.stdin or str.splitlines()) (e.g. sys.stdin or str.splitlines())
- `raw` - (boolean) unprocessed output if True raw: (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True quiet: (boolean) suppress warning messages if True
- `ignore_exceptions` - (boolean) ignore parsing exceptions if True ignore_exceptions: (boolean) ignore parsing exceptions if True
**Yields**:
Yields:
Dictionary. Raw or processed structured data. Dictionary. Raw or processed structured data.
Returns:
**Returns**:
Iterator object Iterator object

View File

@ -57,30 +57,29 @@ Schema:
[1] timezone-aware timestamp. Only available if timezone field is UTC [1] timezone-aware timestamp. Only available if timezone field is UTC
[2] if true, all fields are correctly based on UTC [2] if true, all fields are correctly based on UTC
**Examples**: Examples:
$ date | jc --date -p $ date | jc --date -p
{ {
- `"year"` - 2021, "year": 2021,
- `"month"` - "Mar", "month": "Mar",
- `"month_num"` - 3, "month_num": 3,
- `"day"` - 25, "day": 25,
- `"weekday"` - "Thu", "weekday": "Thu",
- `"weekday_num"` - 4, "weekday_num": 4,
- `"hour"` - 2, "hour": 2,
- `"hour_24"` - 2, "hour_24": 2,
- `"minute"` - 2, "minute": 2,
- `"second"` - 26, "second": 26,
- `"period"` - "AM", "period": "AM",
- `"timezone"` - "UTC", "timezone": "UTC",
- `"utc_offset"` - "+0000", "utc_offset": "+0000",
- `"day_of_year"` - 84, "day_of_year": 84,
- `"week_of_year"` - 12, "week_of_year": 12,
- `"iso"` - "2021-03-25T02:02:26+00:00", "iso": "2021-03-25T02:02:26+00:00",
- `"epoch"` - 1616662946, "epoch": 1616662946,
- `"epoch_utc"` - 1616637746, "epoch_utc": 1616637746,
- `"timezone_aware"` - true "timezone_aware": true
} }
<a id="jc.parsers.date.info"></a> <a id="jc.parsers.date.info"></a>
@ -103,16 +102,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
Dictionary. Raw or processed structured data. Dictionary. Raw or processed structured data.

View File

@ -42,34 +42,33 @@ Schema:
} }
] ]
**Examples**: Examples:
$ df | jc --df -p $ df | jc --df -p
[ [
{ {
- `"filesystem"` - "devtmpfs", "filesystem": "devtmpfs",
- `"1k_blocks"` - 1918820, "1k_blocks": 1918820,
- `"used"` - 0, "used": 0,
- `"available"` - 1918820, "available": 1918820,
- `"use_percent"` - 0, "use_percent": 0,
- `"mounted_on"` - "/dev" "mounted_on": "/dev"
}, },
{ {
- `"filesystem"` - "tmpfs", "filesystem": "tmpfs",
- `"1k_blocks"` - 1930668, "1k_blocks": 1930668,
- `"used"` - 0, "used": 0,
- `"available"` - 1930668, "available": 1930668,
- `"use_percent"` - 0, "use_percent": 0,
- `"mounted_on"` - "/dev/shm" "mounted_on": "/dev/shm"
}, },
{ {
- `"filesystem"` - "tmpfs", "filesystem": "tmpfs",
- `"1k_blocks"` - 1930668, "1k_blocks": 1930668,
- `"used"` - 11800, "used": 11800,
- `"available"` - 1918868, "available": 1918868,
- `"use_percent"` - 1, "use_percent": 1,
- `"mounted_on"` - "/run" "mounted_on": "/run"
}, },
... ...
] ]
@ -77,28 +76,28 @@ Schema:
$ df | jc --df -p -r $ df | jc --df -p -r
[ [
{ {
- `"filesystem"` - "devtmpfs", "filesystem": "devtmpfs",
- `"1k_blocks"` - "1918820", "1k_blocks": "1918820",
- `"used"` - "0", "used": "0",
- `"available"` - "1918820", "available": "1918820",
- `"use_percent"` - "0%", "use_percent": "0%",
- `"mounted_on"` - "/dev" "mounted_on": "/dev"
}, },
{ {
- `"filesystem"` - "tmpfs", "filesystem": "tmpfs",
- `"1k_blocks"` - "1930668", "1k_blocks": "1930668",
- `"used"` - "0", "used": "0",
- `"available"` - "1930668", "available": "1930668",
- `"use_percent"` - "0%", "use_percent": "0%",
- `"mounted_on"` - "/dev/shm" "mounted_on": "/dev/shm"
}, },
{ {
- `"filesystem"` - "tmpfs", "filesystem": "tmpfs",
- `"1k_blocks"` - "1930668", "1k_blocks": "1930668",
- `"used"` - "11800", "used": "11800",
- `"available"` - "1918868", "available": "1918868",
- `"use_percent"` - "1%", "use_percent": "1%",
- `"mounted_on"` - "/run" "mounted_on": "/run"
}, },
... ...
] ]
@ -123,16 +122,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -113,216 +113,215 @@ string
[0] naive timestamp if "when" field is parsable, else null [0] naive timestamp if "when" field is parsable, else null
[1] timezone aware timestamp availabe for UTC, else null [1] timezone aware timestamp availabe for UTC, else null
**Examples**: Examples:
$ dig example.com | jc --dig -p $ dig example.com | jc --dig -p
[ [
{ {
- `"id"` - 2951, "id": 2951,
- `"opcode"` - "QUERY", "opcode": "QUERY",
- `"status"` - "NOERROR", "status": "NOERROR",
- `"flags"` - [ "flags": [
"qr", "qr",
"rd", "rd",
"ra" "ra"
], ],
- `"query_num"` - 1, "query_num": 1,
- `"answer_num"` - 1, "answer_num": 1,
- `"authority_num"` - 0, "authority_num": 0,
- `"additional_num"` - 1, "additional_num": 1,
- `"opt_pseudosection"` - { "opt_pseudosection": {
- `"edns"` - { "edns": {
- `"version"` - 0, "version": 0,
- `"flags"` - [], "flags": [],
- `"udp"` - 4096 "udp": 4096
} }
}, },
- `"question"` - { "question": {
- `"name"` - "example.com.", "name": "example.com.",
- `"class"` - "IN", "class": "IN",
- `"type"` - "A" "type": "A"
}, },
- `"answer"` - [ "answer": [
{ {
- `"name"` - "example.com.", "name": "example.com.",
- `"class"` - "IN", "class": "IN",
- `"type"` - "A", "type": "A",
- `"ttl"` - 39302, "ttl": 39302,
- `"data"` - "93.184.216.34" "data": "93.184.216.34"
} }
], ],
- `"query_time"` - 49, "query_time": 49,
- `"server"` - "2600:1700:bab0:d40::1#53(2600:1700:bab0:d40::1)", "server": "2600:1700:bab0:d40::1#53(2600:1700:bab0:d40::1)",
- `"when"` - "Fri Apr 16 16:05:10 PDT 2021", "when": "Fri Apr 16 16:05:10 PDT 2021",
- `"rcvd"` - 56, "rcvd": 56,
- `"when_epoch"` - 1618614310, "when_epoch": 1618614310,
- `"when_epoch_utc"` - null "when_epoch_utc": null
} }
] ]
$ dig cnn.com www.cnn.com @205.251.194.64 | jc --dig -p -r $ dig cnn.com www.cnn.com @205.251.194.64 | jc --dig -p -r
[ [
{ {
- `"id"` - "46052", "id": "46052",
- `"opcode"` - "QUERY", "opcode": "QUERY",
- `"status"` - "NOERROR", "status": "NOERROR",
- `"flags"` - [ "flags": [
"qr", "qr",
"rd", "rd",
"ra" "ra"
], ],
- `"query_num"` - "1", "query_num": "1",
- `"answer_num"` - "1", "answer_num": "1",
- `"authority_num"` - "0", "authority_num": "0",
- `"additional_num"` - "1", "additional_num": "1",
- `"opt_pseudosection"` - { "opt_pseudosection": {
- `"edns"` - { "edns": {
- `"version"` - "0", "version": "0",
- `"flags"` - [], "flags": [],
- `"udp"` - "4096" "udp": "4096"
} }
}, },
- `"question"` - { "question": {
- `"name"` - "example.com.", "name": "example.com.",
- `"class"` - "IN", "class": "IN",
- `"type"` - "A" "type": "A"
}, },
- `"answer"` - [ "answer": [
{ {
- `"name"` - "example.com.", "name": "example.com.",
- `"class"` - "IN", "class": "IN",
- `"type"` - "A", "type": "A",
- `"ttl"` - "40426", "ttl": "40426",
- `"data"` - "93.184.216.34" "data": "93.184.216.34"
} }
], ],
- `"query_time"` - "48 msec", "query_time": "48 msec",
- `"server"` - "2600:1700:bab0:d40::1#53(2600:1700:bab0:d40::1)", "server": "2600:1700:bab0:d40::1#53(2600:1700:bab0:d40::1)",
- `"when"` - "Fri Apr 16 16:06:12 PDT 2021", "when": "Fri Apr 16 16:06:12 PDT 2021",
- `"rcvd"` - "56" "rcvd": "56"
} }
] ]
$ dig -x 1.1.1.1 | jc --dig -p $ dig -x 1.1.1.1 | jc --dig -p
[ [
{ {
- `"id"` - 20785, "id": 20785,
- `"opcode"` - "QUERY", "opcode": "QUERY",
- `"status"` - "NOERROR", "status": "NOERROR",
- `"flags"` - [ "flags": [
"qr", "qr",
"rd", "rd",
"ra" "ra"
], ],
- `"query_num"` - 1, "query_num": 1,
- `"answer_num"` - 1, "answer_num": 1,
- `"authority_num"` - 0, "authority_num": 0,
- `"additional_num"` - 1, "additional_num": 1,
- `"opt_pseudosection"` - { "opt_pseudosection": {
- `"edns"` - { "edns": {
- `"version"` - 0, "version": 0,
- `"flags"` - [], "flags": [],
- `"udp"` - 4096 "udp": 4096
} }
}, },
- `"question"` - { "question": {
- `"name"` - "1.1.1.1.in-addr.arpa.", "name": "1.1.1.1.in-addr.arpa.",
- `"class"` - "IN", "class": "IN",
- `"type"` - "PTR" "type": "PTR"
}, },
- `"answer"` - [ "answer": [
{ {
- `"name"` - "1.1.1.1.in-addr.arpa.", "name": "1.1.1.1.in-addr.arpa.",
- `"class"` - "IN", "class": "IN",
- `"type"` - "PTR", "type": "PTR",
- `"ttl"` - 1800, "ttl": 1800,
- `"data"` - "one.one.one.one." "data": "one.one.one.one."
} }
], ],
- `"query_time"` - 40, "query_time": 40,
- `"server"` - "2600:1700:bab0:d40::1#53(2600:1700:bab0:d40::1)", "server": "2600:1700:bab0:d40::1#53(2600:1700:bab0:d40::1)",
- `"when"` - "Sat Apr 17 14:50:50 PDT 2021", "when": "Sat Apr 17 14:50:50 PDT 2021",
- `"rcvd"` - 78, "rcvd": 78,
- `"when_epoch"` - 1618696250, "when_epoch": 1618696250,
- `"when_epoch_utc"` - null "when_epoch_utc": null
} }
] ]
$ dig -x 1.1.1.1 | jc --dig -p -r $ dig -x 1.1.1.1 | jc --dig -p -r
[ [
{ {
- `"id"` - "32644", "id": "32644",
- `"opcode"` - "QUERY", "opcode": "QUERY",
- `"status"` - "NOERROR", "status": "NOERROR",
- `"flags"` - [ "flags": [
"qr", "qr",
"rd", "rd",
"ra" "ra"
], ],
- `"query_num"` - "1", "query_num": "1",
- `"answer_num"` - "1", "answer_num": "1",
- `"authority_num"` - "0", "authority_num": "0",
- `"additional_num"` - "1", "additional_num": "1",
- `"opt_pseudosection"` - { "opt_pseudosection": {
- `"edns"` - { "edns": {
- `"version"` - "0", "version": "0",
- `"flags"` - [], "flags": [],
- `"udp"` - "4096" "udp": "4096"
} }
}, },
- `"question"` - { "question": {
- `"name"` - "1.1.1.1.in-addr.arpa.", "name": "1.1.1.1.in-addr.arpa.",
- `"class"` - "IN", "class": "IN",
- `"type"` - "PTR" "type": "PTR"
}, },
- `"answer"` - [ "answer": [
{ {
- `"name"` - "1.1.1.1.in-addr.arpa.", "name": "1.1.1.1.in-addr.arpa.",
- `"class"` - "IN", "class": "IN",
- `"type"` - "PTR", "type": "PTR",
- `"ttl"` - "1800", "ttl": "1800",
- `"data"` - "one.one.one.one." "data": "one.one.one.one."
} }
], ],
- `"query_time"` - "52 msec", "query_time": "52 msec",
- `"server"` - "2600:1700:bab0:d40::1#53(2600:1700:bab0:d40::1)", "server": "2600:1700:bab0:d40::1#53(2600:1700:bab0:d40::1)",
- `"when"` - "Sat Apr 17 14:51:46 PDT 2021", "when": "Sat Apr 17 14:51:46 PDT 2021",
- `"rcvd"` - "78" "rcvd": "78"
} }
] ]
$ dig +noall +answer cnn.com | jc --dig -p $ dig +noall +answer cnn.com | jc --dig -p
[ [
{ {
- `"answer"` - [ "answer": [
{ {
- `"name"` - "cnn.com.", "name": "cnn.com.",
- `"class"` - "IN", "class": "IN",
- `"type"` - "A", "type": "A",
- `"ttl"` - 60, "ttl": 60,
- `"data"` - "151.101.193.67" "data": "151.101.193.67"
}, },
{ {
- `"name"` - "cnn.com.", "name": "cnn.com.",
- `"class"` - "IN", "class": "IN",
- `"type"` - "A", "type": "A",
- `"ttl"` - 60, "ttl": 60,
- `"data"` - "151.101.65.67" "data": "151.101.65.67"
}, },
{ {
- `"name"` - "cnn.com.", "name": "cnn.com.",
- `"class"` - "IN", "class": "IN",
- `"type"` - "A", "type": "A",
- `"ttl"` - 60, "ttl": 60,
- `"data"` - "151.101.1.67" "data": "151.101.1.67"
}, },
{ {
- `"name"` - "cnn.com.", "name": "cnn.com.",
- `"class"` - "IN", "class": "IN",
- `"type"` - "A", "type": "A",
- `"ttl"` - 60, "ttl": 60,
- `"data"` - "151.101.129.67" "data": "151.101.129.67"
} }
] ]
} }
@ -348,16 +347,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -45,46 +45,45 @@ Schema:
} }
] ]
**Examples**: Examples:
C:> dir | jc --dir -p C:> dir | jc --dir -p
[ [
{ {
- `"date"` - "03/24/2021", "date": "03/24/2021",
- `"time"` - "03:15 PM", "time": "03:15 PM",
- `"dir"` - true, "dir": true,
- `"size"` - null, "size": null,
- `"filename"` - ".", "filename": ".",
- `"parent"` - "C:\\Program Files\\Internet Explorer", "parent": "C:\\Program Files\\Internet Explorer",
- `"epoch"` - 1616624100 "epoch": 1616624100
}, },
{ {
- `"date"` - "03/24/2021", "date": "03/24/2021",
- `"time"` - "03:15 PM", "time": "03:15 PM",
- `"dir"` - true, "dir": true,
- `"size"` - null, "size": null,
- `"filename"` - "..", "filename": "..",
- `"parent"` - "C:\\Program Files\\Internet Explorer", "parent": "C:\\Program Files\\Internet Explorer",
- `"epoch"` - 1616624100 "epoch": 1616624100
}, },
{ {
- `"date"` - "12/07/2019", "date": "12/07/2019",
- `"time"` - "02:49 AM", "time": "02:49 AM",
- `"dir"` - true, "dir": true,
- `"size"` - null, "size": null,
- `"filename"` - "en-US", "filename": "en-US",
- `"parent"` - "C:\\Program Files\\Internet Explorer", "parent": "C:\\Program Files\\Internet Explorer",
- `"epoch"` - 1575715740 "epoch": 1575715740
}, },
{ {
- `"date"` - "12/07/2019", "date": "12/07/2019",
- `"time"` - "02:09 AM", "time": "02:09 AM",
- `"dir"` - false, "dir": false,
- `"size"` - 54784, "size": 54784,
- `"filename"` - "ExtExport.exe", "filename": "ExtExport.exe",
- `"parent"` - "C:\\Program Files\\Internet Explorer", "parent": "C:\\Program Files\\Internet Explorer",
- `"epoch"` - 1575713340 "epoch": 1575713340
}, },
... ...
] ]
@ -92,36 +91,36 @@ Schema:
C:> dir | jc --dir -p -r C:> dir | jc --dir -p -r
[ [
{ {
- `"date"` - "03/24/2021", "date": "03/24/2021",
- `"time"` - "03:15 PM", "time": "03:15 PM",
- `"dir"` - true, "dir": true,
- `"size"` - null, "size": null,
- `"filename"` - ".", "filename": ".",
- `"parent"` - "C:\\Program Files\\Internet Explorer" "parent": "C:\\Program Files\\Internet Explorer"
}, },
{ {
- `"date"` - "03/24/2021", "date": "03/24/2021",
- `"time"` - "03:15 PM", "time": "03:15 PM",
- `"dir"` - true, "dir": true,
- `"size"` - null, "size": null,
- `"filename"` - "..", "filename": "..",
- `"parent"` - "C:\\Program Files\\Internet Explorer" "parent": "C:\\Program Files\\Internet Explorer"
}, },
{ {
- `"date"` - "12/07/2019", "date": "12/07/2019",
- `"time"` - "02:49 AM", "time": "02:49 AM",
- `"dir"` - true, "dir": true,
- `"size"` - null, "size": null,
- `"filename"` - "en-US", "filename": "en-US",
- `"parent"` - "C:\\Program Files\\Internet Explorer" "parent": "C:\\Program Files\\Internet Explorer"
}, },
{ {
- `"date"` - "12/07/2019", "date": "12/07/2019",
- `"time"` - "02:09 AM", "time": "02:09 AM",
- `"dir"` - false, "dir": false,
- `"size"` - "54,784", "size": "54,784",
- `"filename"` - "ExtExport.exe", "filename": "ExtExport.exe",
- `"parent"` - "C:\\Program Files\\Internet Explorer" "parent": "C:\\Program Files\\Internet Explorer"
}, },
... ...
] ]
@ -146,16 +145,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -40,24 +40,23 @@ string,
} }
] ]
**Examples**: Examples:
# dmidecode | jc --dmidecode -p # dmidecode | jc --dmidecode -p
[ [
{ {
- `"handle"` - "0x0000", "handle": "0x0000",
- `"type"` - 0, "type": 0,
- `"bytes"` - 24, "bytes": 24,
- `"description"` - "BIOS Information", "description": "BIOS Information",
- `"values"` - { "values": {
- `"vendor"` - "Phoenix Technologies LTD", "vendor": "Phoenix Technologies LTD",
- `"version"` - "6.00", "version": "6.00",
- `"release_date"` - "04/13/2018", "release_date": "04/13/2018",
- `"address"` - "0xEA490", "address": "0xEA490",
- `"runtime_size"` - "88944 bytes", "runtime_size": "88944 bytes",
- `"rom_size"` - "64 kB", "rom_size": "64 kB",
- `"characteristics"` - [ "characteristics": [
"ISA is supported", "ISA is supported",
"PCI is supported", "PCI is supported",
"PC Card (PCMCIA) is supported", "PC Card (PCMCIA) is supported",
@ -80,8 +79,8 @@ string,
"Function key-initiated network boot is supported", "Function key-initiated network boot is supported",
"Targeted content distribution is supported" "Targeted content distribution is supported"
], ],
- `"bios_revision"` - "4.6", "bios_revision": "4.6",
- `"firmware_revision"` - "0.0" "firmware_revision": "0.0"
} }
}, },
... ...
@ -90,18 +89,18 @@ string,
# dmidecode | jc --dmidecode -p -r # dmidecode | jc --dmidecode -p -r
[ [
{ {
- `"handle"` - "0x0000", "handle": "0x0000",
- `"type"` - "0", "type": "0",
- `"bytes"` - "24", "bytes": "24",
- `"description"` - "BIOS Information", "description": "BIOS Information",
- `"values"` - { "values": {
- `"vendor"` - "Phoenix Technologies LTD", "vendor": "Phoenix Technologies LTD",
- `"version"` - "6.00", "version": "6.00",
- `"release_date"` - "04/13/2018", "release_date": "04/13/2018",
- `"address"` - "0xEA490", "address": "0xEA490",
- `"runtime_size"` - "88944 bytes", "runtime_size": "88944 bytes",
- `"rom_size"` - "64 kB", "rom_size": "64 kB",
- `"characteristics"` - [ "characteristics": [
"ISA is supported", "ISA is supported",
"PCI is supported", "PCI is supported",
"PC Card (PCMCIA) is supported", "PC Card (PCMCIA) is supported",
@ -124,8 +123,8 @@ string,
"Function key-initiated network boot is supported", "Function key-initiated network boot is supported",
"Targeted content distribution is supported" "Targeted content distribution is supported"
], ],
- `"bios_revision"` - "4.6", "bios_revision": "4.6",
- `"firmware_revision"` - "0.0" "firmware_revision": "0.0"
} }
}, },
... ...
@ -151,16 +150,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -43,56 +43,55 @@ Schema:
} }
] ]
**Examples**: Examples:
$ dpkg -l | jc --dpkg-l -p $ dpkg -l | jc --dpkg-l -p
[ [
{ {
- `"codes"` - "ii", "codes": "ii",
- `"name"` - "accountsservice", "name": "accountsservice",
- `"version"` - "0.6.45-1ubuntu1.3", "version": "0.6.45-1ubuntu1.3",
- `"architecture"` - "amd64", "architecture": "amd64",
- `"description"` - "query and manipulate user account information", "description": "query and manipulate user account information",
- `"desired"` - "install", "desired": "install",
- `"status"` - "installed" "status": "installed"
}, },
{ {
- `"codes"` - "rc", "codes": "rc",
- `"name"` - "acl", "name": "acl",
- `"version"` - "2.2.52-3build1", "version": "2.2.52-3build1",
- `"architecture"` - "amd64", "architecture": "amd64",
- `"description"` - "Access control list utilities", "description": "Access control list utilities",
- `"desired"` - "remove", "desired": "remove",
- `"status"` - "config-files" "status": "config-files"
}, },
{ {
- `"codes"` - "uWR", "codes": "uWR",
- `"name"` - "acpi", "name": "acpi",
- `"version"` - "1.7-1.1", "version": "1.7-1.1",
- `"architecture"` - "amd64", "architecture": "amd64",
- `"description"` - "displays information on ACPI devices", "description": "displays information on ACPI devices",
- `"desired"` - "unknown", "desired": "unknown",
- `"status"` - "trigger await", "status": "trigger await",
- `"error"` - "reinstall required" "error": "reinstall required"
}, },
{ {
- `"codes"` - "rh", "codes": "rh",
- `"name"` - "acpid", "name": "acpid",
- `"version"` - "1:2.0.28-1ubuntu1", "version": "1:2.0.28-1ubuntu1",
- `"architecture"` - "amd64", "architecture": "amd64",
- `"description"` - "Advanced Configuration and Power Interface...", "description": "Advanced Configuration and Power Interface...",
- `"desired"` - "remove", "desired": "remove",
- `"status"` - "half installed" "status": "half installed"
}, },
{ {
- `"codes"` - "pn", "codes": "pn",
- `"name"` - "adduser", "name": "adduser",
- `"version"` - "3.116ubuntu1", "version": "3.116ubuntu1",
- `"architecture"` - "all", "architecture": "all",
- `"description"` - "add and remove users and groups", "description": "add and remove users and groups",
- `"desired"` - "purge", "desired": "purge",
- `"status"` - "not installed" "status": "not installed"
}, },
... ...
] ]
@ -100,39 +99,39 @@ Schema:
$ dpkg -l | jc --dpkg-l -p -r $ dpkg -l | jc --dpkg-l -p -r
[ [
{ {
- `"codes"` - "ii", "codes": "ii",
- `"name"` - "accountsservice", "name": "accountsservice",
- `"version"` - "0.6.45-1ubuntu1.3", "version": "0.6.45-1ubuntu1.3",
- `"architecture"` - "amd64", "architecture": "amd64",
- `"description"` - "query and manipulate user account information" "description": "query and manipulate user account information"
}, },
{ {
- `"codes"` - "rc", "codes": "rc",
- `"name"` - "acl", "name": "acl",
- `"version"` - "2.2.52-3build1", "version": "2.2.52-3build1",
- `"architecture"` - "amd64", "architecture": "amd64",
- `"description"` - "Access control list utilities" "description": "Access control list utilities"
}, },
{ {
- `"codes"` - "uWR", "codes": "uWR",
- `"name"` - "acpi", "name": "acpi",
- `"version"` - "1.7-1.1", "version": "1.7-1.1",
- `"architecture"` - "amd64", "architecture": "amd64",
- `"description"` - "displays information on ACPI devices" "description": "displays information on ACPI devices"
}, },
{ {
- `"codes"` - "rh", "codes": "rh",
- `"name"` - "acpid", "name": "acpid",
- `"version"` - "1:2.0.28-1ubuntu1", "version": "1:2.0.28-1ubuntu1",
- `"architecture"` - "amd64", "architecture": "amd64",
- `"description"` - "Advanced Configuration and Power Interface..." "description": "Advanced Configuration and Power Interface..."
}, },
{ {
- `"codes"` - "pn", "codes": "pn",
- `"name"` - "adduser", "name": "adduser",
- `"version"` - "3.116ubuntu1", "version": "3.116ubuntu1",
- `"architecture"` - "all", "architecture": "all",
- `"description"` - "add and remove users and groups" "description": "add and remove users and groups"
}, },
... ...
] ]
@ -157,16 +156,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -32,34 +32,33 @@ Schema:
} }
] ]
**Examples**: Examples:
$ du /usr | jc --du -p $ du /usr | jc --du -p
[ [
{ {
- `"size"` - 104608, "size": 104608,
- `"name"` - "/usr/bin" "name": "/usr/bin"
}, },
{ {
- `"size"` - 56, "size": 56,
- `"name"` - "/usr/standalone/firmware/iBridge1_1Customer.bundle/..." "name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
}, },
{ {
- `"size"` - 0, "size": 0,
- `"name"` - "/usr/standalone/firmware/iBridge1_1Customer.bundle/..." "name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
}, },
{ {
- `"size"` - 0, "size": 0,
- `"name"` - "/usr/standalone/firmware/iBridge1_1Customer.bundle/..." "name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
}, },
{ {
- `"size"` - 0, "size": 0,
- `"name"` - "/usr/standalone/firmware/iBridge1_1Customer.bundle/..." "name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
}, },
{ {
- `"size"` - 1008, "size": 1008,
- `"name"` - "/usr/standalone/firmware/iBridge1_1Customer.bundle/..." "name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
}, },
... ...
] ]
@ -67,28 +66,28 @@ Schema:
$ du /usr | jc --du -p -r $ du /usr | jc --du -p -r
[ [
{ {
- `"size"` - "104608", "size": "104608",
- `"name"` - "/usr/bin" "name": "/usr/bin"
}, },
{ {
- `"size"` - "56", "size": "56",
- `"name"` - "/usr/standalone/firmware/iBridge1_1Customer.bundle/..." "name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
}, },
{ {
- `"size"` - "0", "size": "0",
- `"name"` - "/usr/standalone/firmware/iBridge1_1Customer.bundle/..." "name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
}, },
{ {
- `"size"` - "0", "size": "0",
- `"name"` - "/usr/standalone/firmware/iBridge1_1Customer.bundle/..." "name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
}, },
{ {
- `"size"` - "0", "size": "0",
- `"name"` - "/usr/standalone/firmware/iBridge1_1Customer.bundle/..." "name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
}, },
{ {
- `"size"` - "1008", "size": "1008",
- `"name"` - "/usr/standalone/firmware/iBridge1_1Customer.bundle/..." "name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
}, },
... ...
] ]
@ -113,16 +112,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -37,45 +37,44 @@ Schema:
} }
] ]
**Examples**: Examples:
$ env | jc --env -p $ env | jc --env -p
[ [
{ {
- `"name"` - "XDG_SESSION_ID", "name": "XDG_SESSION_ID",
- `"value"` - "1" "value": "1"
}, },
{ {
- `"name"` - "HOSTNAME", "name": "HOSTNAME",
- `"value"` - "localhost.localdomain" "value": "localhost.localdomain"
}, },
{ {
- `"name"` - "TERM", "name": "TERM",
- `"value"` - "vt220" "value": "vt220"
}, },
{ {
- `"name"` - "SHELL", "name": "SHELL",
- `"value"` - "/bin/bash" "value": "/bin/bash"
}, },
{ {
- `"name"` - "HISTSIZE", "name": "HISTSIZE",
- `"value"` - "1000" "value": "1000"
}, },
... ...
] ]
$ env | jc --env -p -r $ env | jc --env -p -r
{ {
- `"TERM"` - "xterm-256color", "TERM": "xterm-256color",
- `"SHELL"` - "/bin/bash", "SHELL": "/bin/bash",
- `"USER"` - "root", "USER": "root",
- `"PATH"` - "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin", "PATH": "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",
- `"PWD"` - "/root", "PWD": "/root",
- `"LANG"` - "en_US.UTF-8", "LANG": "en_US.UTF-8",
- `"HOME"` - "/root", "HOME": "/root",
- `"LOGNAME"` - "root", "LOGNAME": "root",
- `"_"` - "/usr/bin/env" "_": "/usr/bin/env"
} }
<a id="jc.parsers.env.info"></a> <a id="jc.parsers.env.info"></a>
@ -98,16 +97,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
Dictionary of raw structured data or Dictionary of raw structured data or
List of Dictionaries of processed structured data List of Dictionaries of processed structured data

View File

@ -32,38 +32,37 @@ Schema:
} }
] ]
**Examples**: Examples:
$ file * | jc --file -p $ file * | jc --file -p
[ [
{ {
- `"filename"` - "Applications", "filename": "Applications",
- `"type"` - "directory" "type": "directory"
}, },
{ {
- `"filename"` - "another file with spaces", "filename": "another file with spaces",
- `"type"` - "empty" "type": "empty"
}, },
{ {
- `"filename"` - "argstest.py", "filename": "argstest.py",
- `"type"` - "Python script text executable, ASCII text" "type": "Python script text executable, ASCII text"
}, },
{ {
- `"filename"` - "blkid-p.out", "filename": "blkid-p.out",
- `"type"` - "ASCII text" "type": "ASCII text"
}, },
{ {
- `"filename"` - "blkid-pi.out", "filename": "blkid-pi.out",
- `"type"` - "ASCII text, with very long lines" "type": "ASCII text, with very long lines"
}, },
{ {
- `"filename"` - "cd_catalog.xml", "filename": "cd_catalog.xml",
- `"type"` - "XML 1.0 document text, ASCII text, with CRLF line ..." "type": "XML 1.0 document text, ASCII text, with CRLF line ..."
}, },
{ {
- `"filename"` - "centosserial.sh", "filename": "centosserial.sh",
- `"type"` - "Bourne-Again shell script text executable, UTF-8 ..." "type": "Bourne-Again shell script text executable, UTF-8 ..."
}, },
... ...
] ]
@ -88,16 +87,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -43,35 +43,34 @@ Schema:
} }
] ]
**Examples**: Examples:
$ finger | jc --finger -p $ finger | jc --finger -p
[ [
{ {
- `"login"` - "jdoe", "login": "jdoe",
- `"name"` - "John Doe", "name": "John Doe",
- `"tty"` - "tty1", "tty": "tty1",
- `"idle"` - "14d", "idle": "14d",
- `"login_time"` - "Mar 22 21:14", "login_time": "Mar 22 21:14",
- `"tty_writeable"` - false, "tty_writeable": false,
- `"idle_minutes"` - 0, "idle_minutes": 0,
- `"idle_hours"` - 0, "idle_hours": 0,
- `"idle_days"` - 14, "idle_days": 14,
- `"total_idle_minutes"` - 20160 "total_idle_minutes": 20160
}, },
{ {
- `"login"` - "jdoe", "login": "jdoe",
- `"name"` - "John Doe", "name": "John Doe",
- `"tty"` - "pts/0", "tty": "pts/0",
- `"idle"` - null, "idle": null,
- `"login_time"` - "Apr 5 15:33", "login_time": "Apr 5 15:33",
- `"details"` - "(192.168.1.22)", "details": "(192.168.1.22)",
- `"tty_writeable"` - true, "tty_writeable": true,
- `"idle_minutes"` - 0, "idle_minutes": 0,
- `"idle_hours"` - 0, "idle_hours": 0,
- `"idle_days"` - 0, "idle_days": 0,
- `"total_idle_minutes"` - 0 "total_idle_minutes": 0
}, },
... ...
] ]
@ -79,19 +78,19 @@ Schema:
$ finger | jc --finger -p -r $ finger | jc --finger -p -r
[ [
{ {
- `"login"` - "jdoe", "login": "jdoe",
- `"name"` - "John Doe", "name": "John Doe",
- `"tty"` - "*tty1", "tty": "*tty1",
- `"idle"` - "14d", "idle": "14d",
- `"login_time"` - "Mar 22 21:14" "login_time": "Mar 22 21:14"
}, },
{ {
- `"login"` - "jdoe", "login": "jdoe",
- `"name"` - "John Doe", "name": "John Doe",
- `"tty"` - "pts/0", "tty": "pts/0",
- `"idle"` - null, "idle": null,
- `"login_time"` - "Apr 5 15:33", "login_time": "Apr 5 15:33",
- `"details"` - "(192.168.1.22)" "details": "(192.168.1.22)"
}, },
... ...
] ]
@ -116,16 +115,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -37,44 +37,43 @@ Schema:
} }
] ]
**Examples**: Examples:
$ free | jc --free -p $ free | jc --free -p
[ [
{ {
- `"type"` - "Mem", "type": "Mem",
- `"total"` - 3861340, "total": 3861340,
- `"used"` - 220508, "used": 220508,
- `"free"` - 3381972, "free": 3381972,
- `"shared"` - 11800, "shared": 11800,
- `"buff_cache"` - 258860, "buff_cache": 258860,
- `"available"` - 3397784 "available": 3397784
}, },
{ {
- `"type"` - "Swap", "type": "Swap",
- `"total"` - 2097148, "total": 2097148,
- `"used"` - 0, "used": 0,
- `"free"` - 2097148 "free": 2097148
} }
] ]
$ free | jc --free -p -r $ free | jc --free -p -r
[ [
{ {
- `"type"` - "Mem", "type": "Mem",
- `"total"` - "2017300", "total": "2017300",
- `"used"` - "213104", "used": "213104",
- `"free"` - "1148452", "free": "1148452",
- `"shared"` - "1176", "shared": "1176",
- `"buff_cache"` - "655744", "buff_cache": "655744",
- `"available"` - "1622204" "available": "1622204"
}, },
{ {
- `"type"` - "Swap", "type": "Swap",
- `"total"` - "2097148", "total": "2097148",
- `"used"` - "0", "used": "0",
- `"free"` - "2097148" "free": "2097148"
} }
] ]
@ -98,16 +97,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -32,62 +32,61 @@ Schema:
} }
] ]
**Examples**: Examples:
$ cat /etc/fstab | jc --fstab -p $ cat /etc/fstab | jc --fstab -p
[ [
{ {
- `"fs_spec"` - "/dev/mapper/centos-root", "fs_spec": "/dev/mapper/centos-root",
- `"fs_file"` - "/", "fs_file": "/",
- `"fs_vfstype"` - "xfs", "fs_vfstype": "xfs",
- `"fs_mntops"` - "defaults", "fs_mntops": "defaults",
- `"fs_freq"` - 0, "fs_freq": 0,
- `"fs_passno"` - 0 "fs_passno": 0
}, },
{ {
- `"fs_spec"` - "UUID=05d927bb-5875-49e3-ada1-7f46cb31c932", "fs_spec": "UUID=05d927bb-5875-49e3-ada1-7f46cb31c932",
- `"fs_file"` - "/boot", "fs_file": "/boot",
- `"fs_vfstype"` - "xfs", "fs_vfstype": "xfs",
- `"fs_mntops"` - "defaults", "fs_mntops": "defaults",
- `"fs_freq"` - 0, "fs_freq": 0,
- `"fs_passno"` - 0 "fs_passno": 0
}, },
{ {
- `"fs_spec"` - "/dev/mapper/centos-swap", "fs_spec": "/dev/mapper/centos-swap",
- `"fs_file"` - "swap", "fs_file": "swap",
- `"fs_vfstype"` - "swap", "fs_vfstype": "swap",
- `"fs_mntops"` - "defaults", "fs_mntops": "defaults",
- `"fs_freq"` - 0, "fs_freq": 0,
- `"fs_passno"` - 0 "fs_passno": 0
} }
] ]
$ cat /etc/fstab | jc --fstab -p -r $ cat /etc/fstab | jc --fstab -p -r
[ [
{ {
- `"fs_spec"` - "/dev/mapper/centos-root", "fs_spec": "/dev/mapper/centos-root",
- `"fs_file"` - "/", "fs_file": "/",
- `"fs_vfstype"` - "xfs", "fs_vfstype": "xfs",
- `"fs_mntops"` - "defaults", "fs_mntops": "defaults",
- `"fs_freq"` - "0", "fs_freq": "0",
- `"fs_passno"` - "0" "fs_passno": "0"
}, },
{ {
- `"fs_spec"` - "UUID=05d927bb-5875-49e3-ada1-7f46cb31c932", "fs_spec": "UUID=05d927bb-5875-49e3-ada1-7f46cb31c932",
- `"fs_file"` - "/boot", "fs_file": "/boot",
- `"fs_vfstype"` - "xfs", "fs_vfstype": "xfs",
- `"fs_mntops"` - "defaults", "fs_mntops": "defaults",
- `"fs_freq"` - "0", "fs_freq": "0",
- `"fs_passno"` - "0" "fs_passno": "0"
}, },
{ {
- `"fs_spec"` - "/dev/mapper/centos-swap", "fs_spec": "/dev/mapper/centos-swap",
- `"fs_file"` - "swap", "fs_file": "swap",
- `"fs_vfstype"` - "swap", "fs_vfstype": "swap",
- `"fs_mntops"` - "defaults", "fs_mntops": "defaults",
- `"fs_freq"` - "0", "fs_freq": "0",
- `"fs_passno"` - "0" "fs_passno": "0"
} }
] ]
@ -111,16 +110,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -32,36 +32,35 @@ string
} }
] ]
**Examples**: Examples:
$ cat /etc/group | jc --group -p $ cat /etc/group | jc --group -p
[ [
{ {
- `"group_name"` - "nobody", "group_name": "nobody",
- `"password"` - "*", "password": "*",
- `"gid"` - -2, "gid": -2,
- `"members"` - [] "members": []
}, },
{ {
- `"group_name"` - "nogroup", "group_name": "nogroup",
- `"password"` - "*", "password": "*",
- `"gid"` - -1, "gid": -1,
- `"members"` - [] "members": []
}, },
{ {
- `"group_name"` - "wheel", "group_name": "wheel",
- `"password"` - "*", "password": "*",
- `"gid"` - 0, "gid": 0,
- `"members"` - [ "members": [
"root" "root"
] ]
}, },
{ {
- `"group_name"` - "certusers", "group_name": "certusers",
- `"password"` - "*", "password": "*",
- `"gid"` - 29, "gid": 29,
- `"members"` - [ "members": [
"root", "root",
"_jabber", "_jabber",
"_postfix", "_postfix",
@ -76,34 +75,34 @@ string
$ cat /etc/group | jc --group -p -r $ cat /etc/group | jc --group -p -r
[ [
{ {
- `"group_name"` - "nobody", "group_name": "nobody",
- `"password"` - "*", "password": "*",
- `"gid"` - "-2", "gid": "-2",
- `"members"` - [ "members": [
"" ""
] ]
}, },
{ {
- `"group_name"` - "nogroup", "group_name": "nogroup",
- `"password"` - "*", "password": "*",
- `"gid"` - "-1", "gid": "-1",
- `"members"` - [ "members": [
"" ""
] ]
}, },
{ {
- `"group_name"` - "wheel", "group_name": "wheel",
- `"password"` - "*", "password": "*",
- `"gid"` - "0", "gid": "0",
- `"members"` - [ "members": [
"root" "root"
] ]
}, },
{ {
- `"group_name"` - "certusers", "group_name": "certusers",
- `"password"` - "*", "password": "*",
- `"gid"` - "29", "gid": "29",
- `"members"` - [ "members": [
"root", "root",
"_jabber", "_jabber",
"_postfix", "_postfix",
@ -135,16 +134,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -34,22 +34,21 @@ string
} }
] ]
**Examples**: Examples:
$ cat /etc/gshadow | jc --gshadow -p $ cat /etc/gshadow | jc --gshadow -p
[ [
{ {
- `"group_name"` - "root", "group_name": "root",
- `"password"` - "*", "password": "*",
- `"administrators"` - [], "administrators": [],
- `"members"` - [] "members": []
}, },
{ {
- `"group_name"` - "adm", "group_name": "adm",
- `"password"` - "*", "password": "*",
- `"administrators"` - [], "administrators": [],
- `"members"` - [ "members": [
"syslog", "syslog",
"joeuser" "joeuser"
] ]
@ -60,22 +59,22 @@ string
$ cat /etc/gshadow | jc --gshadow -p -r $ cat /etc/gshadow | jc --gshadow -p -r
[ [
{ {
- `"group_name"` - "root", "group_name": "root",
- `"password"` - "*", "password": "*",
- `"administrators"` - [ "administrators": [
"" ""
], ],
- `"members"` - [ "members": [
"" ""
] ]
}, },
{ {
- `"group_name"` - "adm", "group_name": "adm",
- `"password"` - "*", "password": "*",
- `"administrators"` - [ "administrators": [
"" ""
], ],
- `"members"` - [ "members": [
"syslog", "syslog",
"joeuser" "joeuser"
] ]
@ -103,16 +102,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -28,18 +28,17 @@ Schema:
} }
] ]
**Examples**: Examples:
$ hash | jc --hash -p $ hash | jc --hash -p
[ [
{ {
- `"hits"` - 2, "hits": 2,
- `"command"` - "/bin/cat" "command": "/bin/cat"
}, },
{ {
- `"hits"` - 1, "hits": 1,
- `"command"` - "/bin/ls" "command": "/bin/ls"
} }
] ]
@ -63,16 +62,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -42,34 +42,33 @@ Schema:
} }
] ]
**Examples**: Examples:
$ md5sum * | jc --hashsum -p $ md5sum * | jc --hashsum -p
[ [
{ {
- `"filename"` - "devtoolset-3-gcc-4.9.2-6.el7.x86_64.rpm", "filename": "devtoolset-3-gcc-4.9.2-6.el7.x86_64.rpm",
- `"hash"` - "65fc958c1add637ec23c4b137aecf3d3" "hash": "65fc958c1add637ec23c4b137aecf3d3"
}, },
{ {
- `"filename"` - "digout", "filename": "digout",
- `"hash"` - "5b9312ee5aff080927753c63a347707d" "hash": "5b9312ee5aff080927753c63a347707d"
}, },
{ {
- `"filename"` - "dmidecode.out", "filename": "dmidecode.out",
- `"hash"` - "716fd11c2ac00db109281f7110b8fb9d" "hash": "716fd11c2ac00db109281f7110b8fb9d"
}, },
{ {
- `"filename"` - "file with spaces in the name", "filename": "file with spaces in the name",
- `"hash"` - "d41d8cd98f00b204e9800998ecf8427e" "hash": "d41d8cd98f00b204e9800998ecf8427e"
}, },
{ {
- `"filename"` - "id-centos.out", "filename": "id-centos.out",
- `"hash"` - "4295be239a14ad77ef3253103de976d2" "hash": "4295be239a14ad77ef3253103de976d2"
}, },
{ {
- `"filename"` - "ifcfg.json", "filename": "ifcfg.json",
- `"hash"` - "01fda0d9ba9a75618b072e64ff512b43" "hash": "01fda0d9ba9a75618b072e64ff512b43"
}, },
... ...
] ]
@ -94,16 +93,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -74,35 +74,34 @@ string # 'Unspecified' is null
} }
] ]
**Examples**: Examples:
$ hciconfig -a | jc --hciconfig -p $ hciconfig -a | jc --hciconfig -p
[ [
{ {
- `"device"` - "hci0", "device": "hci0",
- `"type"` - "Primary", "type": "Primary",
- `"bus"` - "USB", "bus": "USB",
- `"bd_address"` - "00:1A:7D:DA:71:13", "bd_address": "00:1A:7D:DA:71:13",
- `"acl_mtu"` - 310, "acl_mtu": 310,
- `"acl_mtu_packets"` - 10, "acl_mtu_packets": 10,
- `"sco_mtu"` - 64, "sco_mtu": 64,
- `"sco_mtu_packets"` - 8, "sco_mtu_packets": 8,
- `"state"` - [ "state": [
"UP", "UP",
"RUNNING" "RUNNING"
], ],
- `"rx_bytes"` - 13905869, "rx_bytes": 13905869,
- `"rx_acl"` - 0, "rx_acl": 0,
- `"rx_sco"` - 0, "rx_sco": 0,
- `"rx_events"` - 393300, "rx_events": 393300,
- `"rx_errors"` - 0, "rx_errors": 0,
- `"tx_bytes"` - 62629, "tx_bytes": 62629,
- `"tx_acl"` - 0, "tx_acl": 0,
- `"tx_sco"` - 0, "tx_sco": 0,
- `"tx_commands"` - 3893, "tx_commands": 3893,
- `"tx_errors"` - 0, "tx_errors": 0,
- `"features"` - [ "features": [
"0xff", "0xff",
"0xff", "0xff",
"0x8f", "0x8f",
@ -112,7 +111,7 @@ string # 'Unspecified' is null
"0x5b", "0x5b",
"0x87" "0x87"
], ],
- `"packet_type"` - [ "packet_type": [
"DM1", "DM1",
"DM3", "DM3",
"DM5", "DM5",
@ -123,49 +122,49 @@ string # 'Unspecified' is null
"HV2", "HV2",
"HV3" "HV3"
], ],
- `"link_policy"` - [ "link_policy": [
"RSWITCH", "RSWITCH",
"HOLD", "HOLD",
"SNIFF", "SNIFF",
"PARK" "PARK"
], ],
- `"link_mode"` - [ "link_mode": [
"SLAVE", "SLAVE",
"ACCEPT" "ACCEPT"
], ],
- `"name"` - "CSR8510 A10", "name": "CSR8510 A10",
- `"class"` - "0x000000", "class": "0x000000",
- `"service_classes"` - null, "service_classes": null,
- `"device_class"` - "Miscellaneous", "device_class": "Miscellaneous",
- `"hci_version"` - "4.0 (0x6)", "hci_version": "4.0 (0x6)",
- `"hci_revision"` - "0x22bb", "hci_revision": "0x22bb",
- `"lmp_version"` - "4.0 (0x6)", "lmp_version": "4.0 (0x6)",
- `"lmp_subversion"` - "0x22bb", "lmp_subversion": "0x22bb",
- `"manufacturer"` - "Cambridge Silicon Radio (10)" "manufacturer": "Cambridge Silicon Radio (10)"
}, },
{ {
- `"device"` - "hci1", "device": "hci1",
- `"type"` - "Primary", "type": "Primary",
- `"bus"` - "USB", "bus": "USB",
- `"bd_address"` - "00:1A:7D:DA:71:13", "bd_address": "00:1A:7D:DA:71:13",
- `"acl_mtu"` - 310, "acl_mtu": 310,
- `"acl_mtu_packets"` - 10, "acl_mtu_packets": 10,
- `"sco_mtu"` - 64, "sco_mtu": 64,
- `"sco_mtu_packets"` - 8, "sco_mtu_packets": 8,
- `"state"` - [ "state": [
"DOWN" "DOWN"
], ],
- `"rx_bytes"` - 4388363, "rx_bytes": 4388363,
- `"rx_acl"` - 0, "rx_acl": 0,
- `"rx_sco"` - 0, "rx_sco": 0,
- `"rx_events"` - 122021, "rx_events": 122021,
- `"rx_errors"` - 0, "rx_errors": 0,
- `"tx_bytes"` - 52350, "tx_bytes": 52350,
- `"tx_acl"` - 0, "tx_acl": 0,
- `"tx_sco"` - 0, "tx_sco": 0,
- `"tx_commands"` - 3480, "tx_commands": 3480,
- `"tx_errors"` - 2, "tx_errors": 2,
- `"features"` - [ "features": [
"0xff", "0xff",
"0xff", "0xff",
"0x8f", "0x8f",
@ -175,7 +174,7 @@ string # 'Unspecified' is null
"0x5b", "0x5b",
"0x87" "0x87"
], ],
- `"packet_type"` - [ "packet_type": [
"DM1", "DM1",
"DM3", "DM3",
"DM5", "DM5",
@ -186,13 +185,13 @@ string # 'Unspecified' is null
"HV2", "HV2",
"HV3" "HV3"
], ],
- `"link_policy"` - [ "link_policy": [
"RSWITCH", "RSWITCH",
"HOLD", "HOLD",
"SNIFF", "SNIFF",
"PARK" "PARK"
], ],
- `"link_mode"` - [ "link_mode": [
"SLAVE", "SLAVE",
"ACCEPT" "ACCEPT"
] ]
@ -202,29 +201,29 @@ string # 'Unspecified' is null
$ hciconfig -a | jc --hciconfig -p -r $ hciconfig -a | jc --hciconfig -p -r
[ [
{ {
- `"device"` - "hci0", "device": "hci0",
- `"type"` - "Primary", "type": "Primary",
- `"bus"` - "USB", "bus": "USB",
- `"bd_address"` - "00:1A:7D:DA:71:13", "bd_address": "00:1A:7D:DA:71:13",
- `"acl_mtu"` - "310", "acl_mtu": "310",
- `"acl_mtu_packets"` - "10", "acl_mtu_packets": "10",
- `"sco_mtu"` - "64", "sco_mtu": "64",
- `"sco_mtu_packets"` - "8", "sco_mtu_packets": "8",
- `"state"` - [ "state": [
"UP", "UP",
"RUNNING" "RUNNING"
], ],
- `"rx_bytes"` - "13905869", "rx_bytes": "13905869",
- `"rx_acl"` - "0", "rx_acl": "0",
- `"rx_sco"` - "0", "rx_sco": "0",
- `"rx_events"` - "393300", "rx_events": "393300",
- `"rx_errors"` - "0", "rx_errors": "0",
- `"tx_bytes"` - "62629", "tx_bytes": "62629",
- `"tx_acl"` - "0", "tx_acl": "0",
- `"tx_sco"` - "0", "tx_sco": "0",
- `"tx_commands"` - "3893", "tx_commands": "3893",
- `"tx_errors"` - "0", "tx_errors": "0",
- `"features"` - [ "features": [
"0xff", "0xff",
"0xff", "0xff",
"0x8f", "0x8f",
@ -234,7 +233,7 @@ string # 'Unspecified' is null
"0x5b", "0x5b",
"0x87" "0x87"
], ],
- `"packet_type"` - [ "packet_type": [
"DM1", "DM1",
"DM3", "DM3",
"DM5", "DM5",
@ -245,51 +244,51 @@ string # 'Unspecified' is null
"HV2", "HV2",
"HV3" "HV3"
], ],
- `"link_policy"` - [ "link_policy": [
"RSWITCH", "RSWITCH",
"HOLD", "HOLD",
"SNIFF", "SNIFF",
"PARK" "PARK"
], ],
- `"link_mode"` - [ "link_mode": [
"SLAVE", "SLAVE",
"ACCEPT" "ACCEPT"
], ],
- `"name"` - "CSR8510 A10", "name": "CSR8510 A10",
- `"class"` - "0x000000", "class": "0x000000",
- `"service_classes"` - [ "service_classes": [
"Unspecified" "Unspecified"
], ],
- `"device_class"` - "Miscellaneous", "device_class": "Miscellaneous",
- `"hci_version"` - "4.0 (0x6)", "hci_version": "4.0 (0x6)",
- `"hci_revision"` - "0x22bb", "hci_revision": "0x22bb",
- `"lmp_version"` - "4.0 (0x6)", "lmp_version": "4.0 (0x6)",
- `"lmp_subversion"` - "0x22bb", "lmp_subversion": "0x22bb",
- `"manufacturer"` - "Cambridge Silicon Radio (10)" "manufacturer": "Cambridge Silicon Radio (10)"
}, },
{ {
- `"device"` - "hci1", "device": "hci1",
- `"type"` - "Primary", "type": "Primary",
- `"bus"` - "USB", "bus": "USB",
- `"bd_address"` - "00:1A:7D:DA:71:13", "bd_address": "00:1A:7D:DA:71:13",
- `"acl_mtu"` - "310", "acl_mtu": "310",
- `"acl_mtu_packets"` - "10", "acl_mtu_packets": "10",
- `"sco_mtu"` - "64", "sco_mtu": "64",
- `"sco_mtu_packets"` - "8", "sco_mtu_packets": "8",
- `"state"` - [ "state": [
"DOWN" "DOWN"
], ],
- `"rx_bytes"` - "4388363", "rx_bytes": "4388363",
- `"rx_acl"` - "0", "rx_acl": "0",
- `"rx_sco"` - "0", "rx_sco": "0",
- `"rx_events"` - "122021", "rx_events": "122021",
- `"rx_errors"` - "0", "rx_errors": "0",
- `"tx_bytes"` - "52350", "tx_bytes": "52350",
- `"tx_acl"` - "0", "tx_acl": "0",
- `"tx_sco"` - "0", "tx_sco": "0",
- `"tx_commands"` - "3480", "tx_commands": "3480",
- `"tx_errors"` - "2", "tx_errors": "2",
- `"features"` - [ "features": [
"0xff", "0xff",
"0xff", "0xff",
"0x8f", "0x8f",
@ -299,7 +298,7 @@ string # 'Unspecified' is null
"0x5b", "0x5b",
"0x87" "0x87"
], ],
- `"packet_type"` - [ "packet_type": [
"DM1", "DM1",
"DM3", "DM3",
"DM5", "DM5",
@ -310,13 +309,13 @@ string # 'Unspecified' is null
"HV2", "HV2",
"HV3" "HV3"
], ],
- `"link_policy"` - [ "link_policy": [
"RSWITCH", "RSWITCH",
"HOLD", "HOLD",
"SNIFF", "SNIFF",
"PARK" "PARK"
], ],
- `"link_mode"` - [ "link_mode": [
"SLAVE", "SLAVE",
"ACCEPT" "ACCEPT"
] ]
@ -343,16 +342,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -36,36 +36,35 @@ Schema:
} }
] ]
**Examples**: Examples:
$ history | jc --history -p $ history | jc --history -p
[ [
{ {
- `"line"` - 118, "line": 118,
- `"command"` - "sleep 100" "command": "sleep 100"
}, },
{ {
- `"line"` - 119, "line": 119,
- `"command"` - "ls /bin" "command": "ls /bin"
}, },
{ {
- `"line"` - 120, "line": 120,
- `"command"` - "echo \"hello\"" "command": "echo \"hello\""
}, },
{ {
- `"line"` - 121, "line": 121,
- `"command"` - "docker images" "command": "docker images"
}, },
... ...
] ]
$ history | jc --history -p -r $ history | jc --history -p -r
{ {
- `"118"` - "sleep 100", "118": "sleep 100",
- `"119"` - "ls /bin", "119": "ls /bin",
- `"120"` - "echo \"hello\"", "120": "echo \"hello\"",
- `"121"` - "docker images", "121": "docker images",
... ...
} }
@ -89,16 +88,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
Dictionary of raw structured data or Dictionary of raw structured data or
List of Dictionaries of processed structured data List of Dictionaries of processed structured data

View File

@ -30,51 +30,50 @@ string
} }
] ]
**Examples**: Examples:
$ cat /etc/hosts | jc --hosts -p $ cat /etc/hosts | jc --hosts -p
[ [
{ {
- `"ip"` - "127.0.0.1", "ip": "127.0.0.1",
- `"hostname"` - [ "hostname": [
"localhost" "localhost"
] ]
}, },
{ {
- `"ip"` - "127.0.1.1", "ip": "127.0.1.1",
- `"hostname"` - [ "hostname": [
"root-ubuntu" "root-ubuntu"
] ]
}, },
{ {
- `"ip"` - "::1", "ip": "::1",
- `"hostname"` - [ "hostname": [
"ip6-localhost", "ip6-localhost",
"ip6-loopback" "ip6-loopback"
] ]
}, },
{ {
- `"ip"` - "fe00::0", "ip": "fe00::0",
- `"hostname"` - [ "hostname": [
"ip6-localnet" "ip6-localnet"
] ]
}, },
{ {
- `"ip"` - "ff00::0", "ip": "ff00::0",
- `"hostname"` - [ "hostname": [
"ip6-mcastprefix" "ip6-mcastprefix"
] ]
}, },
{ {
- `"ip"` - "ff02::1", "ip": "ff02::1",
- `"hostname"` - [ "hostname": [
"ip6-allnodes" "ip6-allnodes"
] ]
}, },
{ {
- `"ip"` - "ff02::2", "ip": "ff02::2",
- `"hostname"` - [ "hostname": [
"ip6-allrouters" "ip6-allrouters"
] ]
} }
@ -100,16 +99,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -52,62 +52,61 @@ Schema:
} }
} }
**Examples**: Examples:
$ id | jc --id -p $ id | jc --id -p
{ {
- `"uid"` - { "uid": {
- `"id"` - 1000, "id": 1000,
- `"name"` - "joeuser" "name": "joeuser"
}, },
- `"gid"` - { "gid": {
- `"id"` - 1000, "id": 1000,
- `"name"` - "joeuser" "name": "joeuser"
}, },
- `"groups"` - [ "groups": [
{ {
- `"id"` - 1000, "id": 1000,
- `"name"` - "joeuser" "name": "joeuser"
}, },
{ {
- `"id"` - 10, "id": 10,
- `"name"` - "wheel" "name": "wheel"
} }
], ],
- `"context"` - { "context": {
- `"user"` - "unconfined_u", "user": "unconfined_u",
- `"role"` - "unconfined_r", "role": "unconfined_r",
- `"type"` - "unconfined_t", "type": "unconfined_t",
- `"level"` - "s0-s0:c0.c1023" "level": "s0-s0:c0.c1023"
} }
} }
$ id | jc --id -p -r $ id | jc --id -p -r
{ {
- `"uid"` - { "uid": {
- `"id"` - "1000", "id": "1000",
- `"name"` - "joeuser" "name": "joeuser"
}, },
- `"gid"` - { "gid": {
- `"id"` - "1000", "id": "1000",
- `"name"` - "joeuser" "name": "joeuser"
}, },
- `"groups"` - [ "groups": [
{ {
- `"id"` - "1000", "id": "1000",
- `"name"` - "joeuser" "name": "joeuser"
}, },
{ {
- `"id"` - "10", "id": "10",
- `"name"` - "wheel" "name": "wheel"
} }
], ],
- `"context"` - { "context": {
- `"user"` - "unconfined_u", "user": "unconfined_u",
- `"role"` - "unconfined_r", "role": "unconfined_r",
- `"type"` - "unconfined_t", "type": "unconfined_t",
- `"level"` - "s0-s0:c0.c1023" "level": "s0-s0:c0.c1023"
} }
} }
@ -131,16 +130,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
Dictionary. Raw or processed structured data. Dictionary. Raw or processed structured data.

View File

@ -60,135 +60,134 @@ string
} }
] ]
**Examples**: Examples:
$ ifconfig | jc --ifconfig -p $ ifconfig | jc --ifconfig -p
[ [
{ {
- `"name"` - "ens33", "name": "ens33",
- `"flags"` - 4163, "flags": 4163,
- `"state"` - [ "state": [
"UP", "UP",
"BROADCAST", "BROADCAST",
"RUNNING", "RUNNING",
"MULTICAST" "MULTICAST"
], ],
- `"mtu"` - 1500, "mtu": 1500,
- `"ipv4_addr"` - "192.168.71.137", "ipv4_addr": "192.168.71.137",
- `"ipv4_mask"` - "255.255.255.0", "ipv4_mask": "255.255.255.0",
- `"ipv4_bcast"` - "192.168.71.255", "ipv4_bcast": "192.168.71.255",
- `"ipv6_addr"` - "fe80::c1cb:715d:bc3e:b8a0", "ipv6_addr": "fe80::c1cb:715d:bc3e:b8a0",
- `"ipv6_mask"` - 64, "ipv6_mask": 64,
- `"ipv6_scope"` - "0x20", "ipv6_scope": "0x20",
- `"mac_addr"` - "00:0c:29:3b:58:0e", "mac_addr": "00:0c:29:3b:58:0e",
- `"type"` - "Ethernet", "type": "Ethernet",
- `"rx_packets"` - 8061, "rx_packets": 8061,
- `"rx_bytes"` - 1514413, "rx_bytes": 1514413,
- `"rx_errors"` - 0, "rx_errors": 0,
- `"rx_dropped"` - 0, "rx_dropped": 0,
- `"rx_overruns"` - 0, "rx_overruns": 0,
- `"rx_frame"` - 0, "rx_frame": 0,
- `"tx_packets"` - 4502, "tx_packets": 4502,
- `"tx_bytes"` - 866622, "tx_bytes": 866622,
- `"tx_errors"` - 0, "tx_errors": 0,
- `"tx_dropped"` - 0, "tx_dropped": 0,
- `"tx_overruns"` - 0, "tx_overruns": 0,
- `"tx_carrier"` - 0, "tx_carrier": 0,
- `"tx_collisions"` - 0, "tx_collisions": 0,
- `"metric"` - null "metric": null
}, },
{ {
- `"name"` - "lo", "name": "lo",
- `"flags"` - 73, "flags": 73,
- `"state"` - [ "state": [
"UP", "UP",
"LOOPBACK", "LOOPBACK",
"RUNNING" "RUNNING"
], ],
- `"mtu"` - 65536, "mtu": 65536,
- `"ipv4_addr"` - "127.0.0.1", "ipv4_addr": "127.0.0.1",
- `"ipv4_mask"` - "255.0.0.0", "ipv4_mask": "255.0.0.0",
- `"ipv4_bcast"` - null, "ipv4_bcast": null,
- `"ipv6_addr"` - "::1", "ipv6_addr": "::1",
- `"ipv6_mask"` - 128, "ipv6_mask": 128,
- `"ipv6_scope"` - "0x10", "ipv6_scope": "0x10",
- `"mac_addr"` - null, "mac_addr": null,
- `"type"` - "Local Loopback", "type": "Local Loopback",
- `"rx_packets"` - 73, "rx_packets": 73,
- `"rx_bytes"` - 6009, "rx_bytes": 6009,
- `"rx_errors"` - 0, "rx_errors": 0,
- `"rx_dropped"` - 0, "rx_dropped": 0,
- `"rx_overruns"` - 0, "rx_overruns": 0,
- `"rx_frame"` - 0, "rx_frame": 0,
- `"tx_packets"` - 73, "tx_packets": 73,
- `"tx_bytes"` - 6009, "tx_bytes": 6009,
- `"tx_errors"` - 0, "tx_errors": 0,
- `"tx_dropped"` - 0, "tx_dropped": 0,
- `"tx_overruns"` - 0, "tx_overruns": 0,
- `"tx_carrier"` - 0, "tx_carrier": 0,
- `"tx_collisions"` - 0, "tx_collisions": 0,
- `"metric"` - null "metric": null
} }
] ]
$ ifconfig | jc --ifconfig -p -r $ ifconfig | jc --ifconfig -p -r
[ [
{ {
- `"name"` - "ens33", "name": "ens33",
- `"flags"` - "4163", "flags": "4163",
- `"state"` - "UP,BROADCAST,RUNNING,MULTICAST", "state": "UP,BROADCAST,RUNNING,MULTICAST",
- `"mtu"` - "1500", "mtu": "1500",
- `"ipv4_addr"` - "192.168.71.137", "ipv4_addr": "192.168.71.137",
- `"ipv4_mask"` - "255.255.255.0", "ipv4_mask": "255.255.255.0",
- `"ipv4_bcast"` - "192.168.71.255", "ipv4_bcast": "192.168.71.255",
- `"ipv6_addr"` - "fe80::c1cb:715d:bc3e:b8a0", "ipv6_addr": "fe80::c1cb:715d:bc3e:b8a0",
- `"ipv6_mask"` - "64", "ipv6_mask": "64",
- `"ipv6_scope"` - "0x20", "ipv6_scope": "0x20",
- `"mac_addr"` - "00:0c:29:3b:58:0e", "mac_addr": "00:0c:29:3b:58:0e",
- `"type"` - "Ethernet", "type": "Ethernet",
- `"rx_packets"` - "8061", "rx_packets": "8061",
- `"rx_bytes"` - "1514413", "rx_bytes": "1514413",
- `"rx_errors"` - "0", "rx_errors": "0",
- `"rx_dropped"` - "0", "rx_dropped": "0",
- `"rx_overruns"` - "0", "rx_overruns": "0",
- `"rx_frame"` - "0", "rx_frame": "0",
- `"tx_packets"` - "4502", "tx_packets": "4502",
- `"tx_bytes"` - "866622", "tx_bytes": "866622",
- `"tx_errors"` - "0", "tx_errors": "0",
- `"tx_dropped"` - "0", "tx_dropped": "0",
- `"tx_overruns"` - "0", "tx_overruns": "0",
- `"tx_carrier"` - "0", "tx_carrier": "0",
- `"tx_collisions"` - "0", "tx_collisions": "0",
- `"metric"` - null "metric": null
}, },
{ {
- `"name"` - "lo", "name": "lo",
- `"flags"` - "73", "flags": "73",
- `"state"` - "UP,LOOPBACK,RUNNING", "state": "UP,LOOPBACK,RUNNING",
- `"mtu"` - "65536", "mtu": "65536",
- `"ipv4_addr"` - "127.0.0.1", "ipv4_addr": "127.0.0.1",
- `"ipv4_mask"` - "255.0.0.0", "ipv4_mask": "255.0.0.0",
- `"ipv4_bcast"` - null, "ipv4_bcast": null,
- `"ipv6_addr"` - "::1", "ipv6_addr": "::1",
- `"ipv6_mask"` - "128", "ipv6_mask": "128",
- `"ipv6_scope"` - "0x10", "ipv6_scope": "0x10",
- `"mac_addr"` - null, "mac_addr": null,
- `"type"` - "Local Loopback", "type": "Local Loopback",
- `"rx_packets"` - "73", "rx_packets": "73",
- `"rx_bytes"` - "6009", "rx_bytes": "6009",
- `"rx_errors"` - "0", "rx_errors": "0",
- `"rx_dropped"` - "0", "rx_dropped": "0",
- `"rx_overruns"` - "0", "rx_overruns": "0",
- `"rx_frame"` - "0", "rx_frame": "0",
- `"tx_packets"` - "73", "tx_packets": "73",
- `"tx_bytes"` - "6009", "tx_bytes": "6009",
- `"tx_errors"` - "0", "tx_errors": "0",
- `"tx_dropped"` - "0", "tx_dropped": "0",
- `"tx_overruns"` - "0", "tx_overruns": "0",
- `"tx_carrier"` - "0", "tx_carrier": "0",
- `"tx_collisions"` - "0", "tx_collisions": "0",
- `"metric"` - null "metric": null
} }
] ]
@ -220,9 +219,7 @@ ifconfig parser module written by threeheadedknight@protonmail.com
def __init__(console_output) def __init__(console_output)
``` ```
**Arguments**: :param console_output:
- `console_output`:
<a id="jc.parsers.ifconfig._IfconfigParser.list_interfaces"></a> <a id="jc.parsers.ifconfig._IfconfigParser.list_interfaces"></a>
@ -232,6 +229,8 @@ def __init__(console_output)
def list_interfaces() def list_interfaces()
``` ```
:return:
<a id="jc.parsers.ifconfig._IfconfigParser.count_interfaces"></a> <a id="jc.parsers.ifconfig._IfconfigParser.count_interfaces"></a>
#### count\_interfaces #### count\_interfaces
@ -240,6 +239,8 @@ def list_interfaces()
def count_interfaces() def count_interfaces()
``` ```
:return:
<a id="jc.parsers.ifconfig._IfconfigParser.filter_interfaces"></a> <a id="jc.parsers.ifconfig._IfconfigParser.filter_interfaces"></a>
#### filter\_interfaces #### filter\_interfaces
@ -248,9 +249,8 @@ def count_interfaces()
def filter_interfaces(**kwargs) def filter_interfaces(**kwargs)
``` ```
**Arguments**: :param kwargs:
:return:
- `kwargs`:
<a id="jc.parsers.ifconfig._IfconfigParser.get_interface"></a> <a id="jc.parsers.ifconfig._IfconfigParser.get_interface"></a>
@ -260,9 +260,8 @@ def filter_interfaces(**kwargs)
def get_interface(name) def get_interface(name)
``` ```
**Arguments**: :param name:
:return:
- `name`:
<a id="jc.parsers.ifconfig._IfconfigParser.get_interfaces"></a> <a id="jc.parsers.ifconfig._IfconfigParser.get_interfaces"></a>
@ -272,6 +271,8 @@ def get_interface(name)
def get_interfaces() def get_interfaces()
``` ```
:return:
<a id="jc.parsers.ifconfig._IfconfigParser.is_available"></a> <a id="jc.parsers.ifconfig._IfconfigParser.is_available"></a>
#### is\_available #### is\_available
@ -280,9 +281,8 @@ def get_interfaces()
def is_available(name) def is_available(name)
``` ```
**Arguments**: :param name:
:return:
- `name`:
<a id="jc.parsers.ifconfig._IfconfigParser.parser"></a> <a id="jc.parsers.ifconfig._IfconfigParser.parser"></a>
@ -292,9 +292,8 @@ def is_available(name)
def parser(source_data) def parser(source_data)
``` ```
**Arguments**: :param source_data:
:return:
- `source_data`:
<a id="jc.parsers.ifconfig.parse"></a> <a id="jc.parsers.ifconfig.parse"></a>
@ -306,16 +305,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -37,8 +37,7 @@ configparser standard library documentation for more details.
"key2": string "key2": string
} }
**Examples**: Examples:
$ cat example.ini $ cat example.ini
[DEFAULT] [DEFAULT]
@ -56,19 +55,19 @@ configparser standard library documentation for more details.
$ cat example.ini | jc --ini -p $ cat example.ini | jc --ini -p
{ {
- `"bitbucket.org"` - { "bitbucket.org": {
- `"serveraliveinterval"` - "45", "serveraliveinterval": "45",
- `"compression"` - "yes", "compression": "yes",
- `"compressionlevel"` - "9", "compressionlevel": "9",
- `"forwardx11"` - "yes", "forwardx11": "yes",
- `"user"` - "hg" "user": "hg"
}, },
- `"topsecret.server.com"` - { "topsecret.server.com": {
- `"serveraliveinterval"` - "45", "serveraliveinterval": "45",
- `"compression"` - "yes", "compression": "yes",
- `"compressionlevel"` - "9", "compressionlevel": "9",
- `"forwardx11"` - "no", "forwardx11": "no",
- `"port"` - "50022" "port": "50022"
} }
} }
@ -92,16 +91,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
Dictionary representing the ini file Dictionary representing the ini file

View File

@ -82,86 +82,85 @@ Schema:
} }
] ]
**Examples**: Examples:
$ iostat | jc --iostat -p $ iostat | jc --iostat -p
[ [
{ {
- `"percent_user"` - 0.15, "percent_user": 0.15,
- `"percent_nice"` - 0.0, "percent_nice": 0.0,
- `"percent_system"` - 0.18, "percent_system": 0.18,
- `"percent_iowait"` - 0.0, "percent_iowait": 0.0,
- `"percent_steal"` - 0.0, "percent_steal": 0.0,
- `"percent_idle"` - 99.67, "percent_idle": 99.67,
- `"type"` - "cpu" "type": "cpu"
}, },
{ {
- `"device"` - "sda", "device": "sda",
- `"tps"` - 0.29, "tps": 0.29,
- `"kb_read_s"` - 7.22, "kb_read_s": 7.22,
- `"kb_wrtn_s"` - 1.25, "kb_wrtn_s": 1.25,
- `"kb_read"` - 194341, "kb_read": 194341,
- `"kb_wrtn"` - 33590, "kb_wrtn": 33590,
- `"type"` - "device" "type": "device"
}, },
{ {
- `"device"` - "dm-0", "device": "dm-0",
- `"tps"` - 0.29, "tps": 0.29,
- `"kb_read_s"` - 5.99, "kb_read_s": 5.99,
- `"kb_wrtn_s"` - 1.17, "kb_wrtn_s": 1.17,
- `"kb_read"` - 161361, "kb_read": 161361,
- `"kb_wrtn"` - 31522, "kb_wrtn": 31522,
- `"type"` - "device" "type": "device"
}, },
{ {
- `"device"` - "dm-1", "device": "dm-1",
- `"tps"` - 0.0, "tps": 0.0,
- `"kb_read_s"` - 0.08, "kb_read_s": 0.08,
- `"kb_wrtn_s"` - 0.0, "kb_wrtn_s": 0.0,
- `"kb_read"` - 2204, "kb_read": 2204,
- `"kb_wrtn"` - 0, "kb_wrtn": 0,
- `"type"` - "device" "type": "device"
} }
] ]
$ iostat | jc --iostat -p -r $ iostat | jc --iostat -p -r
[ [
{ {
- `"percent_user"` - "0.15", "percent_user": "0.15",
- `"percent_nice"` - "0.00", "percent_nice": "0.00",
- `"percent_system"` - "0.18", "percent_system": "0.18",
- `"percent_iowait"` - "0.00", "percent_iowait": "0.00",
- `"percent_steal"` - "0.00", "percent_steal": "0.00",
- `"percent_idle"` - "99.67", "percent_idle": "99.67",
- `"type"` - "cpu" "type": "cpu"
}, },
{ {
- `"device"` - "sda", "device": "sda",
- `"tps"` - "0.29", "tps": "0.29",
- `"kb_read_s"` - "7.22", "kb_read_s": "7.22",
- `"kb_wrtn_s"` - "1.25", "kb_wrtn_s": "1.25",
- `"kb_read"` - "194341", "kb_read": "194341",
- `"kb_wrtn"` - "33590", "kb_wrtn": "33590",
- `"type"` - "device" "type": "device"
}, },
{ {
- `"device"` - "dm-0", "device": "dm-0",
- `"tps"` - "0.29", "tps": "0.29",
- `"kb_read_s"` - "5.99", "kb_read_s": "5.99",
- `"kb_wrtn_s"` - "1.17", "kb_wrtn_s": "1.17",
- `"kb_read"` - "161361", "kb_read": "161361",
- `"kb_wrtn"` - "31522", "kb_wrtn": "31522",
- `"type"` - "device" "type": "device"
}, },
{ {
- `"device"` - "dm-1", "device": "dm-1",
- `"tps"` - "0.00", "tps": "0.00",
- `"kb_read_s"` - "0.08", "kb_read_s": "0.08",
- `"kb_wrtn_s"` - "0.00", "kb_wrtn_s": "0.00",
- `"kb_read"` - "2204", "kb_read": "2204",
- `"kb_wrtn"` - "0", "kb_wrtn": "0",
- `"type"` - "device" "type": "device"
} }
] ]
@ -185,16 +184,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -93,8 +93,7 @@ Schema:
} }
} }
**Examples**: Examples:
$ iostat | jc --iostat-s $ iostat | jc --iostat-s
{"percent_user":0.14,"percent_nice":0.0,"percent_system":0.16,...} {"percent_user":0.14,"percent_nice":0.0,"percent_system":0.16,...}
@ -126,25 +125,20 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False)
Main text parsing generator function. Returns an iterator object. Main text parsing generator function. Returns an iterator object.
**Arguments**: Parameters:
data: (iterable) line-based text data to parse
- `data` - (iterable) line-based text data to parse
(e.g. sys.stdin or str.splitlines()) (e.g. sys.stdin or str.splitlines())
- `raw` - (boolean) unprocessed output if True raw: (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True quiet: (boolean) suppress warning messages if True
- `ignore_exceptions` - (boolean) ignore parsing exceptions if True ignore_exceptions: (boolean) ignore parsing exceptions if True
**Yields**:
Yields:
Dictionary. Raw or processed structured data. Dictionary. Raw or processed structured data.
Returns:
**Returns**:
Iterator object Iterator object

View File

@ -48,62 +48,61 @@ Schema:
} }
] ]
**Examples**: Examples:
$ sudo iptables --line-numbers -v -L -t nat | jc --iptables -p $ sudo iptables --line-numbers -v -L -t nat | jc --iptables -p
[ [
{ {
- `"chain"` - "PREROUTING", "chain": "PREROUTING",
- `"rules"` - [ "rules": [
{ {
- `"num"` - 1, "num": 1,
- `"pkts"` - 2183, "pkts": 2183,
- `"bytes"` - 186000, "bytes": 186000,
- `"target"` - "PREROUTING_direct", "target": "PREROUTING_direct",
- `"prot"` - "all", "prot": "all",
- `"opt"` - null, "opt": null,
- `"in"` - "any", "in": "any",
- `"out"` - "any", "out": "any",
- `"source"` - "anywhere", "source": "anywhere",
- `"destination"` - "anywhere" "destination": "anywhere"
}, },
{ {
- `"num"` - 2, "num": 2,
- `"pkts"` - 2183, "pkts": 2183,
- `"bytes"` - 186000, "bytes": 186000,
- `"target"` - "PREROUTING_ZONES_SOURCE", "target": "PREROUTING_ZONES_SOURCE",
- `"prot"` - "all", "prot": "all",
- `"opt"` - null, "opt": null,
- `"in"` - "any", "in": "any",
- `"out"` - "any", "out": "any",
- `"source"` - "anywhere", "source": "anywhere",
- `"destination"` - "anywhere" "destination": "anywhere"
}, },
{ {
- `"num"` - 3, "num": 3,
- `"pkts"` - 2183, "pkts": 2183,
- `"bytes"` - 186000, "bytes": 186000,
- `"target"` - "PREROUTING_ZONES", "target": "PREROUTING_ZONES",
- `"prot"` - "all", "prot": "all",
- `"opt"` - null, "opt": null,
- `"in"` - "any", "in": "any",
- `"out"` - "any", "out": "any",
- `"source"` - "anywhere", "source": "anywhere",
- `"destination"` - "anywhere" "destination": "anywhere"
}, },
{ {
- `"num"` - 4, "num": 4,
- `"pkts"` - 0, "pkts": 0,
- `"bytes"` - 0, "bytes": 0,
- `"target"` - "DOCKER", "target": "DOCKER",
- `"prot"` - "all", "prot": "all",
- `"opt"` - null, "opt": null,
- `"in"` - "any", "in": "any",
- `"out"` - "any", "out": "any",
- `"source"` - "anywhere", "source": "anywhere",
- `"destination"` - "anywhere", "destination": "anywhere",
- `"options"` - "ADDRTYPE match dst-type LOCAL" "options": "ADDRTYPE match dst-type LOCAL"
} }
] ]
}, },
@ -113,56 +112,56 @@ Schema:
$ sudo iptables --line-numbers -v -L -t nat | jc --iptables -p -r $ sudo iptables --line-numbers -v -L -t nat | jc --iptables -p -r
[ [
{ {
- `"chain"` - "PREROUTING", "chain": "PREROUTING",
- `"rules"` - [ "rules": [
{ {
- `"num"` - "1", "num": "1",
- `"pkts"` - "2183", "pkts": "2183",
- `"bytes"` - "186K", "bytes": "186K",
- `"target"` - "PREROUTING_direct", "target": "PREROUTING_direct",
- `"prot"` - "all", "prot": "all",
- `"opt"` - "--", "opt": "--",
- `"in"` - "any", "in": "any",
- `"out"` - "any", "out": "any",
- `"source"` - "anywhere", "source": "anywhere",
- `"destination"` - "anywhere" "destination": "anywhere"
}, },
{ {
- `"num"` - "2", "num": "2",
- `"pkts"` - "2183", "pkts": "2183",
- `"bytes"` - "186K", "bytes": "186K",
- `"target"` - "PREROUTING_ZONES_SOURCE", "target": "PREROUTING_ZONES_SOURCE",
- `"prot"` - "all", "prot": "all",
- `"opt"` - "--", "opt": "--",
- `"in"` - "any", "in": "any",
- `"out"` - "any", "out": "any",
- `"source"` - "anywhere", "source": "anywhere",
- `"destination"` - "anywhere" "destination": "anywhere"
}, },
{ {
- `"num"` - "3", "num": "3",
- `"pkts"` - "2183", "pkts": "2183",
- `"bytes"` - "186K", "bytes": "186K",
- `"target"` - "PREROUTING_ZONES", "target": "PREROUTING_ZONES",
- `"prot"` - "all", "prot": "all",
- `"opt"` - "--", "opt": "--",
- `"in"` - "any", "in": "any",
- `"out"` - "any", "out": "any",
- `"source"` - "anywhere", "source": "anywhere",
- `"destination"` - "anywhere" "destination": "anywhere"
}, },
{ {
- `"num"` - "4", "num": "4",
- `"pkts"` - "0", "pkts": "0",
- `"bytes"` - "0", "bytes": "0",
- `"target"` - "DOCKER", "target": "DOCKER",
- `"prot"` - "all", "prot": "all",
- `"opt"` - "--", "opt": "--",
- `"in"` - "any", "in": "any",
- `"out"` - "any", "out": "any",
- `"source"` - "anywhere", "source": "anywhere",
- `"destination"` - "anywhere", "destination": "anywhere",
- `"options"` - "ADDRTYPE match dst-type LOCAL" "options": "ADDRTYPE match dst-type LOCAL"
} }
] ]
}, },
@ -189,16 +188,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -36,18 +36,17 @@ Schema:
} }
] ]
**Examples**: Examples:
$ iw dev wlan0 scan | jc --iw-scan -p $ iw dev wlan0 scan | jc --iw-scan -p
[ [
{ {
- `"bssid"` - "71:31:72:65:e1:a2", "bssid": "71:31:72:65:e1:a2",
- `"interface"` - "wlan0", "interface": "wlan0",
- `"freq"` - 2462, "freq": 2462,
- `"capability"` - "ESS Privacy ShortSlotTime (0x0411)", "capability": "ESS Privacy ShortSlotTime (0x0411)",
- `"ssid"` - "WLAN-1234", "ssid": "WLAN-1234",
- `"supported_rates"` - [ "supported_rates": [
1.0, 1.0,
2.0, 2.0,
5.5, 5.5,
@ -57,72 +56,72 @@ Schema:
36.0, 36.0,
54.0 54.0
], ],
- `"erp"` - "<no flags>", "erp": "<no flags>",
- `"erp_d4.0"` - "<no flags>", "erp_d4.0": "<no flags>",
- `"rsn"` - "Version: 1", "rsn": "Version: 1",
- `"group_cipher"` - "CCMP", "group_cipher": "CCMP",
- `"pairwise_ciphers"` - "CCMP", "pairwise_ciphers": "CCMP",
- `"authentication_suites"` - "PSK", "authentication_suites": "PSK",
- `"capabilities"` - "0x186c", "capabilities": "0x186c",
- `"extended_supported_rates"` - [ "extended_supported_rates": [
6.0, 6.0,
9.0, 9.0,
12.0, 12.0,
48.0 48.0
], ],
- `"ht_rx_mcs_rate_indexes_supported"` - "0-15", "ht_rx_mcs_rate_indexes_supported": "0-15",
- `"primary_channel"` - 11, "primary_channel": 11,
- `"secondary_channel_offset"` - "no secondary", "secondary_channel_offset": "no secondary",
- `"rifs"` - 1, "rifs": 1,
- `"ht_protection"` - "no", "ht_protection": "no",
- `"non-gf_present"` - 1, "non-gf_present": 1,
- `"obss_non-gf_present"` - 0, "obss_non-gf_present": 0,
- `"dual_beacon"` - 0, "dual_beacon": 0,
- `"dual_cts_protection"` - 0, "dual_cts_protection": 0,
- `"stbc_beacon"` - 0, "stbc_beacon": 0,
- `"l-sig_txop_prot"` - 0, "l-sig_txop_prot": 0,
- `"pco_active"` - 0, "pco_active": 0,
- `"pco_phase"` - 0, "pco_phase": 0,
- `"bss_width_channel_transition_delay_factor"` - 5, "bss_width_channel_transition_delay_factor": 5,
- `"extended_capabilities"` - "HT Information Exchange Supported", "extended_capabilities": "HT Information Exchange Supported",
- `"wmm"` - "Parameter version 1", "wmm": "Parameter version 1",
- `"be"` - "CW 15-1023, AIFSN 3", "be": "CW 15-1023, AIFSN 3",
- `"bk"` - "CW 15-1023, AIFSN 7", "bk": "CW 15-1023, AIFSN 7",
- `"vi"` - "CW 7-15, AIFSN 2, TXOP 3008 usec", "vi": "CW 7-15, AIFSN 2, TXOP 3008 usec",
- `"vo"` - "CW 3-7, AIFSN 2, TXOP 1504 usec", "vo": "CW 3-7, AIFSN 2, TXOP 1504 usec",
- `"wps"` - "Version: 1.0", "wps": "Version: 1.0",
- `"wi-fi_protected_setup_state"` - "2 (Configured)", "wi-fi_protected_setup_state": "2 (Configured)",
- `"selected_registrar"` - "0x0", "selected_registrar": "0x0",
- `"response_type"` - "3 (AP)", "response_type": "3 (AP)",
- `"uuid"` - "00000000-0000-0003-0000-75317074f1a2", "uuid": "00000000-0000-0003-0000-75317074f1a2",
- `"manufacturer"` - "Corporation", "manufacturer": "Corporation",
- `"model"` - "VGV8539JW", "model": "VGV8539JW",
- `"model_number"` - "1.47.000", "model_number": "1.47.000",
- `"serial_number"` - "J144024542", "serial_number": "J144024542",
- `"primary_device_type"` - "6-0050f204-1", "primary_device_type": "6-0050f204-1",
- `"device_name"` - "Wireless Router(WFA)", "device_name": "Wireless Router(WFA)",
- `"config_methods"` - "Label, PBC", "config_methods": "Label, PBC",
- `"rf_bands"` - "0x3", "rf_bands": "0x3",
- `"tsf_usec"` - 212098649788, "tsf_usec": 212098649788,
- `"sta_channel_width_mhz"` - 20, "sta_channel_width_mhz": 20,
- `"passive_dwell_tus"` - 20, "passive_dwell_tus": 20,
- `"active_dwell_tus"` - 10, "active_dwell_tus": 10,
- `"channel_width_trigger_scan_interval_s"` - 300, "channel_width_trigger_scan_interval_s": 300,
- `"scan_passive_total_per_channel_tus"` - 200, "scan_passive_total_per_channel_tus": 200,
- `"scan_active_total_per_channel_tus"` - 20, "scan_active_total_per_channel_tus": 20,
- `"beacon_interval_tus"` - 100, "beacon_interval_tus": 100,
- `"signal_dbm"` - -80.0, "signal_dbm": -80.0,
- `"last_seen_ms"` - 11420, "last_seen_ms": 11420,
- `"selected_rates"` - [ "selected_rates": [
1.0, 1.0,
2.0, 2.0,
5.5, 5.5,
11.0 11.0
], ],
- `"obss_scan_activity_threshold_percent"` - 0.25, "obss_scan_activity_threshold_percent": 0.25,
- `"ds_parameter_set_channel"` - 11, "ds_parameter_set_channel": 11,
- `"max_amsdu_length_bytes"` - 7935, "max_amsdu_length_bytes": 7935,
- `"minimum_rx_ampdu_time_spacing_usec"` - 16 "minimum_rx_ampdu_time_spacing_usec": 16
}, },
... ...
] ]
@ -147,16 +146,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -28,8 +28,7 @@ Schema:
} }
] ]
**Examples**: Examples:
$ cat MANIFEST.MF | jc --jar-manifest -p $ cat MANIFEST.MF | jc --jar-manifest -p
$ unzip -c log4j-core-2.16.0.jar META-INF/MANIFEST.MF | \\ $ unzip -c log4j-core-2.16.0.jar META-INF/MANIFEST.MF | \\
@ -40,16 +39,16 @@ Schema:
$ cat MANIFEST.MF | jc --jar-manifest -p $ cat MANIFEST.MF | jc --jar-manifest -p
[ [
{ {
- `"Import_Package"` - "com.conversantmedia.util.concurrent;resoluti...", "Import_Package": "com.conversantmedia.util.concurrent;resoluti...",
- `"Export_Package"` - "org.apache.logging.log4j.core;uses:=\"org.ap...", "Export_Package": "org.apache.logging.log4j.core;uses:=\"org.ap...",
- `"Manifest_Version"` - "1.0", "Manifest_Version": "1.0",
- `"Bundle_License"` - "https://www.apache.org/licenses/LICENSE-2.0.txt", "Bundle_License": "https://www.apache.org/licenses/LICENSE-2.0.txt",
- `"Bundle_SymbolicName"` - "org.apache.logging.log4j.core", "Bundle_SymbolicName": "org.apache.logging.log4j.core",
- `"Built_By"` - "matt", "Built_By": "matt",
- `"Bnd_LastModified"` - "1639373735804", "Bnd_LastModified": "1639373735804",
- `"Implementation_Vendor_Id"` - "org.apache.logging.log4j", "Implementation_Vendor_Id": "org.apache.logging.log4j",
- `"Specification_Title"` - "Apache Log4j Core", "Specification_Title": "Apache Log4j Core",
- `"Log4jReleaseManager"` - "Matt Sicker", "Log4jReleaseManager": "Matt Sicker",
... ...
} }
] ]
@ -59,25 +58,25 @@ Schema:
[ [
... ...
{ {
- `"Archive"` - "apache-log4j-2.16.0-bin/log4j-spring-boot-2.16.0-so...", "Archive": "apache-log4j-2.16.0-bin/log4j-spring-boot-2.16.0-so...",
- `"Manifest_Version"` - "1.0", "Manifest_Version": "1.0",
- `"Built_By"` - "matt", "Built_By": "matt",
- `"Created_By"` - "Apache Maven 3.8.4", "Created_By": "Apache Maven 3.8.4",
- `"Build_Jdk"` - "1.8.0_312" "Build_Jdk": "1.8.0_312"
}, },
{ {
- `"Archive"` - "apache-log4j-2.16.0-bin/log4j-spring-boot-2.16.0-ja...", "Archive": "apache-log4j-2.16.0-bin/log4j-spring-boot-2.16.0-ja...",
- `"Manifest_Version"` - "1.0", "Manifest_Version": "1.0",
- `"Built_By"` - "matt", "Built_By": "matt",
- `"Created_By"` - "Apache Maven 3.8.4", "Created_By": "Apache Maven 3.8.4",
- `"Build_Jdk"` - "1.8.0_312" "Build_Jdk": "1.8.0_312"
}, },
{ {
- `"Bundle_SymbolicName"` - "org.apache.logging.log4j.spring-cloud-c...", "Bundle_SymbolicName": "org.apache.logging.log4j.spring-cloud-c...",
- `"Export_Package"` - "org.apache.logging.log4j.spring.cloud.config...", "Export_Package": "org.apache.logging.log4j.spring.cloud.config...",
- `"Archive"` - "apache-log4j-2.16.0-bin/log4j-spring-cloud-config-c...", "Archive": "apache-log4j-2.16.0-bin/log4j-spring-cloud-config-c...",
- `"Manifest_Version"` - "1.0", "Manifest_Version": "1.0",
- `"Bundle_License"` - "https://www.apache.org/licenses/LICENSE-2.0.txt", "Bundle_License": "https://www.apache.org/licenses/LICENSE-2.0.txt",
... ...
} }
... ...
@ -103,16 +102,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -36,66 +36,65 @@ Schema:
} }
] ]
**Example**: Example:
$ jobs -l | jc --jobs -p $ jobs -l | jc --jobs -p
[ [
{ {
- `"job_number"` - 1, "job_number": 1,
- `"pid"` - 5283, "pid": 5283,
- `"status"` - "Running", "status": "Running",
- `"command"` - "sleep 10000 &" "command": "sleep 10000 &"
}, },
{ {
- `"job_number"` - 2, "job_number": 2,
- `"pid"` - 5284, "pid": 5284,
- `"status"` - "Running", "status": "Running",
- `"command"` - "sleep 10100 &" "command": "sleep 10100 &"
}, },
{ {
- `"job_number"` - 3, "job_number": 3,
- `"pid"` - 5285, "pid": 5285,
- `"history"` - "previous", "history": "previous",
- `"status"` - "Running", "status": "Running",
- `"command"` - "sleep 10001 &" "command": "sleep 10001 &"
}, },
{ {
- `"job_number"` - 4, "job_number": 4,
- `"pid"` - 5286, "pid": 5286,
- `"history"` - "current", "history": "current",
- `"status"` - "Running", "status": "Running",
- `"command"` - "sleep 10112 &" "command": "sleep 10112 &"
} }
] ]
$ jobs -l | jc --jobs -p -r $ jobs -l | jc --jobs -p -r
[ [
{ {
- `"job_number"` - "1", "job_number": "1",
- `"pid"` - "19510", "pid": "19510",
- `"status"` - "Running", "status": "Running",
- `"command"` - "sleep 1000 &" "command": "sleep 1000 &"
}, },
{ {
- `"job_number"` - "2", "job_number": "2",
- `"pid"` - "19511", "pid": "19511",
- `"status"` - "Running", "status": "Running",
- `"command"` - "sleep 1001 &" "command": "sleep 1001 &"
}, },
{ {
- `"job_number"` - "3", "job_number": "3",
- `"pid"` - "19512", "pid": "19512",
- `"history"` - "previous", "history": "previous",
- `"status"` - "Running", "status": "Running",
- `"command"` - "sleep 1002 &" "command": "sleep 1002 &"
}, },
{ {
- `"job_number"` - "4", "job_number": "4",
- `"pid"` - "19513", "pid": "19513",
- `"history"` - "current", "history": "current",
- `"status"` - "Running", "status": "Running",
- `"command"` - "sleep 1003 &" "command": "sleep 1003 &"
} }
] ]
@ -119,16 +118,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -37,14 +37,13 @@ configparser standard library documentation for more details.
"key2": string "key2": string
} }
**Examples**: Examples:
$ cat keyvalue.txt $ cat keyvalue.txt
# this file contains key/value pairs # this file contains key/value pairs
name = John Doe name = John Doe
address=555 California Drive address=555 California Drive
- `age` - 34 age: 34
; comments can include # or ; ; comments can include # or ;
# delimiter can be = or : # delimiter can be = or :
# quoted values have quotation marks stripped by default # quoted values have quotation marks stripped by default
@ -53,10 +52,10 @@ configparser standard library documentation for more details.
$ cat keyvalue.txt | jc --kv -p $ cat keyvalue.txt | jc --kv -p
{ {
- `"name"` - "John Doe", "name": "John Doe",
- `"address"` - "555 California Drive", "address": "555 California Drive",
- `"age"` - "34", "age": "34",
- `"occupation"` - "Engineer" "occupation": "Engineer"
} }
<a id="jc.parsers.kv.info"></a> <a id="jc.parsers.kv.info"></a>
@ -81,16 +80,13 @@ Main text parsing function
Note: this is just a wrapper for jc.parsers.ini Note: this is just a wrapper for jc.parsers.ini
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
Dictionary representing the key/value file Dictionary representing the key/value file

View File

@ -45,39 +45,38 @@ Schema:
} }
] ]
**Examples**: Examples:
$ last -F | jc --last -p $ last -F | jc --last -p
[ [
{ {
- `"user"` - "kbrazil", "user": "kbrazil",
- `"tty"` - "ttys002", "tty": "ttys002",
- `"hostname"` - null, "hostname": null,
- `"login"` - "Mon Dec 28 17:24:10 2020", "login": "Mon Dec 28 17:24:10 2020",
- `"logout"` - "still logged in" "logout": "still logged in"
}, },
{ {
- `"user"` - "kbrazil", "user": "kbrazil",
- `"tty"` - "ttys003", "tty": "ttys003",
- `"hostname"` - null, "hostname": null,
- `"login"` - "Mon Dec 28 17:24:10 2020", "login": "Mon Dec 28 17:24:10 2020",
- `"logout"` - "Mon Dec 28 17:25:01 2020", "logout": "Mon Dec 28 17:25:01 2020",
- `"duration"` - "00:00", "duration": "00:00",
- `"login_epoch"` - 1565891826, "login_epoch": 1565891826,
- `"logout_epoch"` - 1565895404, "logout_epoch": 1565895404,
- `"duration_seconds"` - 3578 "duration_seconds": 3578
}, },
{ {
- `"user"` - "kbrazil", "user": "kbrazil",
- `"tty"` - "ttys003", "tty": "ttys003",
- `"hostname"` - null, "hostname": null,
- `"login"` - "Mon Dec 28 17:24:10 2020", "login": "Mon Dec 28 17:24:10 2020",
- `"logout"` - "Mon Dec 28 17:25:01 2020", "logout": "Mon Dec 28 17:25:01 2020",
- `"duration"` - "00:00", "duration": "00:00",
- `"login_epoch"` - 1565891826, "login_epoch": 1565891826,
- `"logout_epoch"` - 1565895404, "logout_epoch": 1565895404,
- `"duration_seconds"` - 3578 "duration_seconds": 3578
}, },
... ...
] ]
@ -85,27 +84,27 @@ Schema:
$ last | jc --last -p -r $ last | jc --last -p -r
[ [
{ {
- `"user"` - "kbrazil", "user": "kbrazil",
- `"tty"` - "ttys002", "tty": "ttys002",
- `"hostname"` - "-", "hostname": "-",
- `"login"` - "Thu Feb 27 14:31", "login": "Thu Feb 27 14:31",
- `"logout"` - "still_logged_in" "logout": "still_logged_in"
}, },
{ {
- `"user"` - "kbrazil", "user": "kbrazil",
- `"tty"` - "ttys003", "tty": "ttys003",
- `"hostname"` - "-", "hostname": "-",
- `"login"` - "Thu Feb 27 10:38", "login": "Thu Feb 27 10:38",
- `"logout"` - "10:38", "logout": "10:38",
- `"duration"` - "00:00" "duration": "00:00"
}, },
{ {
- `"user"` - "kbrazil", "user": "kbrazil",
- `"tty"` - "ttys003", "tty": "ttys003",
- `"hostname"` - "-", "hostname": "-",
- `"login"` - "Thu Feb 27 10:18", "login": "Thu Feb 27 10:18",
- `"logout"` - "10:18", "logout": "10:18",
- `"duration"` - "00:00" "duration": "00:00"
}, },
... ...
] ]
@ -130,16 +129,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -60,16 +60,15 @@ Schema:
[1] timezone aware timestamp if date field is in UTC and can [1] timezone aware timestamp if date field is in UTC and can
be converted. be converted.
**Examples**: Examples:
$ ls /usr/bin | jc --ls -p $ ls /usr/bin | jc --ls -p
[ [
{ {
- `"filename"` - "apropos" "filename": "apropos"
}, },
{ {
- `"filename"` - "arch" "filename": "arch"
}, },
... ...
] ]
@ -77,23 +76,23 @@ be converted.
$ ls -l /usr/bin | jc --ls -p $ ls -l /usr/bin | jc --ls -p
[ [
{ {
- `"filename"` - "apropos", "filename": "apropos",
- `"link_to"` - "whatis", "link_to": "whatis",
- `"flags"` - "lrwxrwxrwx.", "flags": "lrwxrwxrwx.",
- `"links"` - 1, "links": 1,
- `"owner"` - "root", "owner": "root",
- `"group"` - "root", "group": "root",
- `"size"` - 6, "size": 6,
- `"date"` - "Aug 15 10:53" "date": "Aug 15 10:53"
}, },
{ {
- `"filename"` - "ar", "filename": "ar",
- `"flags"` - "-rwxr-xr-x.", "flags": "-rwxr-xr-x.",
- `"links"` - 1, "links": 1,
- `"owner"` - "root", "owner": "root",
- `"group"` - "root", "group": "root",
- `"size"` - 62744, "size": 62744,
- `"date"` - "Aug 8 16:14" "date": "Aug 8 16:14"
}, },
... ...
] ]
@ -101,23 +100,23 @@ be converted.
$ ls -l /usr/bin | jc --ls -p -r $ ls -l /usr/bin | jc --ls -p -r
[ [
{ {
- `"filename"` - "apropos", "filename": "apropos",
- `"link_to"` - "whatis", "link_to": "whatis",
- `"flags"` - "lrwxrwxrwx.", "flags": "lrwxrwxrwx.",
- `"links"` - "1", "links": "1",
- `"owner"` - "root", "owner": "root",
- `"group"` - "root", "group": "root",
- `"size"` - "6", "size": "6",
- `"date"` - "Aug 15 10:53" "date": "Aug 15 10:53"
}, },
{ {
- `"filename"` - "arch", "filename": "arch",
- `"flags"` - "-rwxr-xr-x.", "flags": "-rwxr-xr-x.",
- `"links"` - "1", "links": "1",
- `"owner"` - "root", "owner": "root",
- `"group"` - "root", "group": "root",
- `"size"` - "33080", "size": "33080",
- `"date"` - "Aug 19 23:25" "date": "Aug 19 23:25"
}, },
... ...
] ]
@ -142,16 +141,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -68,8 +68,7 @@ Schema:
[1] timezone aware timestamp if date field is in UTC and can [1] timezone aware timestamp if date field is in UTC and can
be converted be converted
**Examples**: Examples:
$ ls -l /usr/bin | jc --ls-s $ ls -l /usr/bin | jc --ls-s
{"filename":"2to3-","flags":"-rwxr-xr-x","links":4,"owner":"root","...} {"filename":"2to3-","flags":"-rwxr-xr-x","links":4,"owner":"root","...}
@ -103,25 +102,20 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False)
Main text parsing generator function. Returns an iterator object. Main text parsing generator function. Returns an iterator object.
**Arguments**: Parameters:
data: (iterable) line-based text data to parse
- `data` - (iterable) line-based text data to parse
(e.g. sys.stdin or str.splitlines()) (e.g. sys.stdin or str.splitlines())
- `raw` - (boolean) unprocessed output if True raw: (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True quiet: (boolean) suppress warning messages if True
- `ignore_exceptions` - (boolean) ignore parsing exceptions if True ignore_exceptions: (boolean) ignore parsing exceptions if True
**Yields**:
Yields:
Dictionary. Raw or processed structured data. Dictionary. Raw or processed structured data.
Returns:
**Returns**:
Iterator object Iterator object

View File

@ -70,28 +70,27 @@ Schema:
} }
] ]
**Examples**: Examples:
$ lsblk | jc --lsblk -p $ lsblk | jc --lsblk -p
[ [
{ {
- `"name"` - "sda", "name": "sda",
- `"maj_min"` - "8:0", "maj_min": "8:0",
- `"rm"` - false, "rm": false,
- `"size"` - "20G", "size": "20G",
- `"ro"` - false, "ro": false,
- `"type"` - "disk", "type": "disk",
- `"mountpoint"` - null "mountpoint": null
}, },
{ {
- `"name"` - "sda1", "name": "sda1",
- `"maj_min"` - "8:1", "maj_min": "8:1",
- `"rm"` - false, "rm": false,
- `"size"` - "1G", "size": "1G",
- `"ro"` - false, "ro": false,
- `"type"` - "part", "type": "part",
- `"mountpoint"` - "/boot" "mountpoint": "/boot"
}, },
... ...
] ]
@ -102,88 +101,88 @@ Schema:
PKNAME,HCTL,TRAN,REV,VENDOR | jc --lsblk -p PKNAME,HCTL,TRAN,REV,VENDOR | jc --lsblk -p
[ [
{ {
- `"name"` - "sda", "name": "sda",
- `"maj_min"` - "8:0", "maj_min": "8:0",
- `"rm"` - false, "rm": false,
- `"size"` - "20G", "size": "20G",
- `"ro"` - false, "ro": false,
- `"type"` - "disk", "type": "disk",
- `"mountpoint"` - null, "mountpoint": null,
- `"kname"` - "sda", "kname": "sda",
- `"fstype"` - null, "fstype": null,
- `"label"` - null, "label": null,
- `"uuid"` - null, "uuid": null,
- `"partlabel"` - null, "partlabel": null,
- `"partuuid"` - null, "partuuid": null,
- `"ra"` - 4096, "ra": 4096,
- `"model"` - "VMware Virtual S", "model": "VMware Virtual S",
- `"serial"` - null, "serial": null,
- `"state"` - "running", "state": "running",
- `"owner"` - "root", "owner": "root",
- `"group"` - "disk", "group": "disk",
- `"mode"` - "brw-rw----", "mode": "brw-rw----",
- `"alignment"` - 0, "alignment": 0,
- `"min_io"` - 512, "min_io": 512,
- `"opt_io"` - 0, "opt_io": 0,
- `"phy_sec"` - 512, "phy_sec": 512,
- `"log_sec"` - 512, "log_sec": 512,
- `"rota"` - true, "rota": true,
- `"sched"` - "deadline", "sched": "deadline",
- `"rq_size"` - 128, "rq_size": 128,
- `"disc_aln"` - 0, "disc_aln": 0,
- `"disc_gran"` - "0B", "disc_gran": "0B",
- `"disc_max"` - "0B", "disc_max": "0B",
- `"disc_zero"` - false, "disc_zero": false,
- `"wsame"` - "32M", "wsame": "32M",
- `"wwn"` - null, "wwn": null,
- `"rand"` - true, "rand": true,
- `"pkname"` - null, "pkname": null,
- `"hctl"` - "0:0:0:0", "hctl": "0:0:0:0",
- `"tran"` - "spi", "tran": "spi",
- `"rev"` - "1.0", "rev": "1.0",
- `"vendor"` - "VMware," "vendor": "VMware,"
}, },
{ {
- `"name"` - "sda1", "name": "sda1",
- `"maj_min"` - "8:1", "maj_min": "8:1",
- `"rm"` - false, "rm": false,
- `"size"` - "1G", "size": "1G",
- `"ro"` - false, "ro": false,
- `"type"` - "part", "type": "part",
- `"mountpoint"` - "/boot", "mountpoint": "/boot",
- `"kname"` - "sda1", "kname": "sda1",
- `"fstype"` - "xfs", "fstype": "xfs",
- `"label"` - null, "label": null,
- `"uuid"` - "05d927bb-5875-49e3-ada1-7f46cb31c932", "uuid": "05d927bb-5875-49e3-ada1-7f46cb31c932",
- `"partlabel"` - null, "partlabel": null,
- `"partuuid"` - null, "partuuid": null,
- `"ra"` - 4096, "ra": 4096,
- `"model"` - null, "model": null,
- `"serial"` - null, "serial": null,
- `"state"` - null, "state": null,
- `"owner"` - "root", "owner": "root",
- `"group"` - "disk", "group": "disk",
- `"mode"` - "brw-rw----", "mode": "brw-rw----",
- `"alignment"` - 0, "alignment": 0,
- `"min_io"` - 512, "min_io": 512,
- `"opt_io"` - 0, "opt_io": 0,
- `"phy_sec"` - 512, "phy_sec": 512,
- `"log_sec"` - 512, "log_sec": 512,
- `"rota"` - true, "rota": true,
- `"sched"` - "deadline", "sched": "deadline",
- `"rq_size"` - 128, "rq_size": 128,
- `"disc_aln"` - 0, "disc_aln": 0,
- `"disc_gran"` - "0B", "disc_gran": "0B",
- `"disc_max"` - "0B", "disc_max": "0B",
- `"disc_zero"` - false, "disc_zero": false,
- `"wsame"` - "32M", "wsame": "32M",
- `"wwn"` - null, "wwn": null,
- `"rand"` - true, "rand": true,
- `"pkname"` - "sda", "pkname": "sda",
- `"hctl"` - null, "hctl": null,
- `"tran"` - null, "tran": null,
- `"rev"` - null, "rev": null,
- `"vendor"` - null "vendor": null
}, },
... ...
] ]
@ -194,88 +193,88 @@ Schema:
PKNAME,HCTL,TRAN,REV,VENDOR | jc --lsblk -p -r PKNAME,HCTL,TRAN,REV,VENDOR | jc --lsblk -p -r
[ [
{ {
- `"name"` - "sda", "name": "sda",
- `"maj_min"` - "8:0", "maj_min": "8:0",
- `"rm"` - "0", "rm": "0",
- `"size"` - "20G", "size": "20G",
- `"ro"` - "0", "ro": "0",
- `"type"` - "disk", "type": "disk",
- `"mountpoint"` - null, "mountpoint": null,
- `"kname"` - "sda", "kname": "sda",
- `"fstype"` - null, "fstype": null,
- `"label"` - null, "label": null,
- `"uuid"` - null, "uuid": null,
- `"partlabel"` - null, "partlabel": null,
- `"partuuid"` - null, "partuuid": null,
- `"ra"` - "4096", "ra": "4096",
- `"model"` - "VMware Virtual S", "model": "VMware Virtual S",
- `"serial"` - null, "serial": null,
- `"state"` - "running", "state": "running",
- `"owner"` - "root", "owner": "root",
- `"group"` - "disk", "group": "disk",
- `"mode"` - "brw-rw----", "mode": "brw-rw----",
- `"alignment"` - "0", "alignment": "0",
- `"min_io"` - "512", "min_io": "512",
- `"opt_io"` - "0", "opt_io": "0",
- `"phy_sec"` - "512", "phy_sec": "512",
- `"log_sec"` - "512", "log_sec": "512",
- `"rota"` - "1", "rota": "1",
- `"sched"` - "deadline", "sched": "deadline",
- `"rq_size"` - "128", "rq_size": "128",
- `"disc_aln"` - "0", "disc_aln": "0",
- `"disc_gran"` - "0B", "disc_gran": "0B",
- `"disc_max"` - "0B", "disc_max": "0B",
- `"disc_zero"` - "0", "disc_zero": "0",
- `"wsame"` - "32M", "wsame": "32M",
- `"wwn"` - null, "wwn": null,
- `"rand"` - "1", "rand": "1",
- `"pkname"` - null, "pkname": null,
- `"hctl"` - "0:0:0:0", "hctl": "0:0:0:0",
- `"tran"` - "spi", "tran": "spi",
- `"rev"` - "1.0", "rev": "1.0",
- `"vendor"` - "VMware," "vendor": "VMware,"
}, },
{ {
- `"name"` - "sda1", "name": "sda1",
- `"maj_min"` - "8:1", "maj_min": "8:1",
- `"rm"` - "0", "rm": "0",
- `"size"` - "1G", "size": "1G",
- `"ro"` - "0", "ro": "0",
- `"type"` - "part", "type": "part",
- `"mountpoint"` - "/boot", "mountpoint": "/boot",
- `"kname"` - "sda1", "kname": "sda1",
- `"fstype"` - "xfs", "fstype": "xfs",
- `"label"` - null, "label": null,
- `"uuid"` - "05d927bb-5875-49e3-ada1-7f46cb31c932", "uuid": "05d927bb-5875-49e3-ada1-7f46cb31c932",
- `"partlabel"` - null, "partlabel": null,
- `"partuuid"` - null, "partuuid": null,
- `"ra"` - "4096", "ra": "4096",
- `"model"` - null, "model": null,
- `"serial"` - null, "serial": null,
- `"state"` - null, "state": null,
- `"owner"` - "root", "owner": "root",
- `"group"` - "disk", "group": "disk",
- `"mode"` - "brw-rw----", "mode": "brw-rw----",
- `"alignment"` - "0", "alignment": "0",
- `"min_io"` - "512", "min_io": "512",
- `"opt_io"` - "0", "opt_io": "0",
- `"phy_sec"` - "512", "phy_sec": "512",
- `"log_sec"` - "512", "log_sec": "512",
- `"rota"` - "1", "rota": "1",
- `"sched"` - "deadline", "sched": "deadline",
- `"rq_size"` - "128", "rq_size": "128",
- `"disc_aln"` - "0", "disc_aln": "0",
- `"disc_gran"` - "0B", "disc_gran": "0B",
- `"disc_max"` - "0B", "disc_max": "0B",
- `"disc_zero"` - "0", "disc_zero": "0",
- `"wsame"` - "32M", "wsame": "32M",
- `"wwn"` - null, "wwn": null,
- `"rand"` - "1", "rand": "1",
- `"pkname"` - "sda", "pkname": "sda",
- `"hctl"` - null, "hctl": null,
- `"tran"` - null, "tran": null,
- `"rev"` - null, "rev": null,
- `"vendor"` - null "vendor": null
}, },
... ...
] ]
@ -300,16 +299,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -36,42 +36,41 @@ string
} }
] ]
**Examples**: Examples:
$ lsmod | jc --lsmod -p $ lsmod | jc --lsmod -p
[ [
... ...
{ {
- `"module"` - "nf_nat", "module": "nf_nat",
- `"size"` - 26583, "size": 26583,
- `"used"` - 3, "used": 3,
- `"by"` - [ "by": [
"nf_nat_ipv4", "nf_nat_ipv4",
"nf_nat_ipv6", "nf_nat_ipv6",
"nf_nat_masquerade_ipv4" "nf_nat_masquerade_ipv4"
] ]
}, },
{ {
- `"module"` - "iptable_mangle", "module": "iptable_mangle",
- `"size"` - 12695, "size": 12695,
- `"used"` - 1 "used": 1
}, },
{ {
- `"module"` - "iptable_security", "module": "iptable_security",
- `"size"` - 12705, "size": 12705,
- `"used"` - 1 "used": 1
}, },
{ {
- `"module"` - "iptable_raw", "module": "iptable_raw",
- `"size"` - 12678, "size": 12678,
- `"used"` - 1 "used": 1
}, },
{ {
- `"module"` - "nf_conntrack", "module": "nf_conntrack",
- `"size"` - 139224, "size": 139224,
- `"used"` - 7, "used": 7,
- `"by"` - [ "by": [
"nf_nat", "nf_nat",
"nf_nat_ipv4", "nf_nat_ipv4",
"nf_nat_ipv6", "nf_nat_ipv6",
@ -88,10 +87,10 @@ string
[ [
... ...
{ {
- `"module"` - "nf_conntrack", "module": "nf_conntrack",
- `"size"` - "139224", "size": "139224",
- `"used"` - "7", "used": "7",
- `"by"` - [ "by": [
"nf_nat", "nf_nat",
"nf_nat_ipv4", "nf_nat_ipv4",
"nf_nat_ipv6", "nf_nat_ipv6",
@ -102,28 +101,28 @@ string
] ]
}, },
{ {
- `"module"` - "ip_set", "module": "ip_set",
- `"size"` - "45799", "size": "45799",
- `"used"` - "0" "used": "0"
}, },
{ {
- `"module"` - "nfnetlink", "module": "nfnetlink",
- `"size"` - "14519", "size": "14519",
- `"used"` - "1", "used": "1",
- `"by"` - [ "by": [
"ip_set" "ip_set"
] ]
}, },
{ {
- `"module"` - "ebtable_filter", "module": "ebtable_filter",
- `"size"` - "12827", "size": "12827",
- `"used"` - "1" "used": "1"
}, },
{ {
- `"module"` - "ebtables", "module": "ebtables",
- `"size"` - "35009", "size": "35009",
- `"used"` - "2", "used": "2",
- `"by"` - [ "by": [
"ebtable_nat", "ebtable_nat",
"ebtable_filter" "ebtable_filter"
] ]
@ -151,16 +150,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -40,46 +40,45 @@ Schema:
} }
] ]
**Examples**: Examples:
$ sudo lsof | jc --lsof -p $ sudo lsof | jc --lsof -p
[ [
{ {
- `"command"` - "systemd", "command": "systemd",
- `"pid"` - 1, "pid": 1,
- `"tid"` - null, "tid": null,
- `"user"` - "root", "user": "root",
- `"fd"` - "cwd", "fd": "cwd",
- `"type"` - "DIR", "type": "DIR",
- `"device"` - "253,0", "device": "253,0",
- `"size_off"` - 224, "size_off": 224,
- `"node"` - 64, "node": 64,
- `"name"` - "/" "name": "/"
}, },
{ {
- `"command"` - "systemd", "command": "systemd",
- `"pid"` - 1, "pid": 1,
- `"tid"` - null, "tid": null,
- `"user"` - "root", "user": "root",
- `"fd"` - "rtd", "fd": "rtd",
- `"type"` - "DIR", "type": "DIR",
- `"device"` - "253,0", "device": "253,0",
- `"size_off"` - 224, "size_off": 224,
- `"node"` - 64, "node": 64,
- `"name"` - "/" "name": "/"
}, },
{ {
- `"command"` - "systemd", "command": "systemd",
- `"pid"` - 1, "pid": 1,
- `"tid"` - null, "tid": null,
- `"user"` - "root", "user": "root",
- `"fd"` - "txt", "fd": "txt",
- `"type"` - "REG", "type": "REG",
- `"device"` - "253,0", "device": "253,0",
- `"size_off"` - 1624520, "size_off": 1624520,
- `"node"` - 50360451, "node": 50360451,
- `"name"` - "/usr/lib/systemd/systemd" "name": "/usr/lib/systemd/systemd"
}, },
... ...
] ]
@ -87,40 +86,40 @@ Schema:
$ sudo lsof | jc --lsof -p -r $ sudo lsof | jc --lsof -p -r
[ [
{ {
- `"command"` - "systemd", "command": "systemd",
- `"pid"` - "1", "pid": "1",
- `"tid"` - null, "tid": null,
- `"user"` - "root", "user": "root",
- `"fd"` - "cwd", "fd": "cwd",
- `"type"` - "DIR", "type": "DIR",
- `"device"` - "8,2", "device": "8,2",
- `"size_off"` - "4096", "size_off": "4096",
- `"node"` - "2", "node": "2",
- `"name"` - "/" "name": "/"
}, },
{ {
- `"command"` - "systemd", "command": "systemd",
- `"pid"` - "1", "pid": "1",
- `"tid"` - null, "tid": null,
- `"user"` - "root", "user": "root",
- `"fd"` - "rtd", "fd": "rtd",
- `"type"` - "DIR", "type": "DIR",
- `"device"` - "8,2", "device": "8,2",
- `"size_off"` - "4096", "size_off": "4096",
- `"node"` - "2", "node": "2",
- `"name"` - "/" "name": "/"
}, },
{ {
- `"command"` - "systemd", "command": "systemd",
- `"pid"` - "1", "pid": "1",
- `"tid"` - null, "tid": null,
- `"user"` - "root", "user": "root",
- `"fd"` - "txt", "fd": "txt",
- `"type"` - "REG", "type": "REG",
- `"device"` - "8,2", "device": "8,2",
- `"size_off"` - "1595792", "size_off": "1595792",
- `"node"` - "668802", "node": "668802",
- `"name"` - "/lib/systemd/systemd" "name": "/lib/systemd/systemd"
}, },
... ...
] ]
@ -145,16 +144,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -146,81 +146,80 @@ string
} }
] ]
**Examples**: Examples:
$ lsusb -v | jc --lsusb -p $ lsusb -v | jc --lsusb -p
[ [
{ {
- `"bus"` - "002", "bus": "002",
- `"device"` - "001", "device": "001",
- `"id"` - "1d6b:0001", "id": "1d6b:0001",
- `"description"` - "Linux Foundation 1.1 root hub", "description": "Linux Foundation 1.1 root hub",
- `"device_descriptor"` - { "device_descriptor": {
- `"bLength"` - { "bLength": {
- `"value"` - "18" "value": "18"
}, },
- `"bDescriptorType"` - { "bDescriptorType": {
- `"value"` - "1" "value": "1"
}, },
- `"bcdUSB"` - { "bcdUSB": {
- `"value"` - "1.10" "value": "1.10"
}, },
... ...
- `"bNumConfigurations"` - { "bNumConfigurations": {
- `"value"` - "1" "value": "1"
}, },
- `"configuration_descriptor"` - { "configuration_descriptor": {
- `"bLength"` - { "bLength": {
- `"value"` - "9" "value": "9"
}, },
... ...
- `"iConfiguration"` - { "iConfiguration": {
- `"value"` - "0" "value": "0"
}, },
- `"bmAttributes"` - { "bmAttributes": {
- `"value"` - "0xe0", "value": "0xe0",
- `"attributes"` - [ "attributes": [
"Self Powered", "Self Powered",
"Remote Wakeup" "Remote Wakeup"
] ]
}, },
- `"MaxPower"` - { "MaxPower": {
- `"description"` - "0mA" "description": "0mA"
}, },
- `"interface_descriptors"` - [ "interface_descriptors": [
{ {
- `"bLength"` - { "bLength": {
- `"value"` - "9" "value": "9"
}, },
... ...
- `"bInterfaceProtocol"` - { "bInterfaceProtocol": {
- `"value"` - "0", "value": "0",
- `"description"` - "Full speed (or root) hub" "description": "Full speed (or root) hub"
}, },
- `"iInterface"` - { "iInterface": {
- `"value"` - "0" "value": "0"
}, },
- `"endpoint_descriptors"` - [ "endpoint_descriptors": [
{ {
- `"bLength"` - { "bLength": {
- `"value"` - "7" "value": "7"
}, },
... ...
- `"bmAttributes"` - { "bmAttributes": {
- `"value"` - "3", "value": "3",
- `"attributes"` - [ "attributes": [
"Transfer Type Interrupt", "Transfer Type Interrupt",
"Synch Type None", "Synch Type None",
"Usage Type Data" "Usage Type Data"
] ]
}, },
- `"wMaxPacketSize"` - { "wMaxPacketSize": {
- `"value"` - "0x0002", "value": "0x0002",
- `"description"` - "1x 2 bytes" "description": "1x 2 bytes"
}, },
- `"bInterval"` - { "bInterval": {
- `"value"` - "255" "value": "255"
} }
} }
] ]
@ -228,31 +227,31 @@ string
] ]
} }
}, },
- `"hub_descriptor"` - { "hub_descriptor": {
- `"bLength"` - { "bLength": {
- `"value"` - "9" "value": "9"
}, },
... ...
- `"wHubCharacteristic"` - { "wHubCharacteristic": {
- `"value"` - "0x000a", "value": "0x000a",
- `"attributes"` - [ "attributes": [
"No power switching (usb 1.0)", "No power switching (usb 1.0)",
"Per-port overcurrent protection" "Per-port overcurrent protection"
] ]
}, },
... ...
- `"hub_port_status"` - { "hub_port_status": {
"Port 1": { "Port 1": {
- `"value"` - "0000.0103", "value": "0000.0103",
- `"attributes"` - [ "attributes": [
"power", "power",
"enable", "enable",
"connect" "connect"
] ]
}, },
"Port 2": { "Port 2": {
- `"value"` - "0000.0103", "value": "0000.0103",
- `"attributes"` - [ "attributes": [
"power", "power",
"enable", "enable",
"connect" "connect"
@ -260,9 +259,9 @@ string
} }
} }
}, },
- `"device_status"` - { "device_status": {
- `"value"` - "0x0001", "value": "0x0001",
- `"description"` - "Self Powered" "description": "Self Powered"
} }
} }
] ]
@ -287,16 +286,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -36,16 +36,15 @@ string
} }
] ]
**Example**: Example:
$ mount | jc --mount -p $ mount | jc --mount -p
[ [
{ {
- `"filesystem"` - "sysfs", "filesystem": "sysfs",
- `"mount_point"` - "/sys", "mount_point": "/sys",
- `"type"` - "sysfs", "type": "sysfs",
- `"access"` - [ "access": [
"rw", "rw",
"nosuid", "nosuid",
"nodev", "nodev",
@ -54,10 +53,10 @@ string
] ]
}, },
{ {
- `"filesystem"` - "proc", "filesystem": "proc",
- `"mount_point"` - "/proc", "mount_point": "/proc",
- `"type"` - "proc", "type": "proc",
- `"access"` - [ "access": [
"rw", "rw",
"nosuid", "nosuid",
"nodev", "nodev",
@ -66,10 +65,10 @@ string
] ]
}, },
{ {
- `"filesystem"` - "udev", "filesystem": "udev",
- `"mount_point"` - "/dev", "mount_point": "/dev",
- `"type"` - "devtmpfs", "type": "devtmpfs",
- `"access"` - [ "access": [
"rw", "rw",
"nosuid", "nosuid",
"relatime", "relatime",
@ -101,16 +100,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -129,155 +129,154 @@ string,
} }
] ]
**Examples**: Examples:
# netstat -apee | jc --netstat -p # netstat -apee | jc --netstat -p
[ [
{ {
- `"proto"` - "tcp", "proto": "tcp",
- `"recv_q"` - 0, "recv_q": 0,
- `"send_q"` - 0, "send_q": 0,
- `"local_address"` - "localhost", "local_address": "localhost",
- `"foreign_address"` - "0.0.0.0", "foreign_address": "0.0.0.0",
- `"state"` - "LISTEN", "state": "LISTEN",
- `"user"` - "systemd-resolve", "user": "systemd-resolve",
- `"inode"` - 26958, "inode": 26958,
- `"program_name"` - "systemd-resolve", "program_name": "systemd-resolve",
- `"kind"` - "network", "kind": "network",
- `"pid"` - 887, "pid": 887,
- `"local_port"` - "domain", "local_port": "domain",
- `"foreign_port"` - "*", "foreign_port": "*",
- `"transport_protocol"` - "tcp", "transport_protocol": "tcp",
- `"network_protocol"` - "ipv4" "network_protocol": "ipv4"
}, },
{ {
- `"proto"` - "tcp", "proto": "tcp",
- `"recv_q"` - 0, "recv_q": 0,
- `"send_q"` - 0, "send_q": 0,
- `"local_address"` - "0.0.0.0", "local_address": "0.0.0.0",
- `"foreign_address"` - "0.0.0.0", "foreign_address": "0.0.0.0",
- `"state"` - "LISTEN", "state": "LISTEN",
- `"user"` - "root", "user": "root",
- `"inode"` - 30499, "inode": 30499,
- `"program_name"` - "sshd", "program_name": "sshd",
- `"kind"` - "network", "kind": "network",
- `"pid"` - 1186, "pid": 1186,
- `"local_port"` - "ssh", "local_port": "ssh",
- `"foreign_port"` - "*", "foreign_port": "*",
- `"transport_protocol"` - "tcp", "transport_protocol": "tcp",
- `"network_protocol"` - "ipv4" "network_protocol": "ipv4"
}, },
{ {
- `"proto"` - "tcp", "proto": "tcp",
- `"recv_q"` - 0, "recv_q": 0,
- `"send_q"` - 0, "send_q": 0,
- `"local_address"` - "localhost", "local_address": "localhost",
- `"foreign_address"` - "localhost", "foreign_address": "localhost",
- `"state"` - "ESTABLISHED", "state": "ESTABLISHED",
- `"user"` - "root", "user": "root",
- `"inode"` - 46829, "inode": 46829,
- `"program_name"` - "sshd: root", "program_name": "sshd: root",
- `"kind"` - "network", "kind": "network",
- `"pid"` - 2242, "pid": 2242,
- `"local_port"` - "ssh", "local_port": "ssh",
- `"foreign_port"` - "52186", "foreign_port": "52186",
- `"transport_protocol"` - "tcp", "transport_protocol": "tcp",
- `"network_protocol"` - "ipv4", "network_protocol": "ipv4",
- `"foreign_port_num"` - 52186 "foreign_port_num": 52186
}, },
{ {
- `"proto"` - "tcp", "proto": "tcp",
- `"recv_q"` - 0, "recv_q": 0,
- `"send_q"` - 0, "send_q": 0,
- `"local_address"` - "localhost", "local_address": "localhost",
- `"foreign_address"` - "localhost", "foreign_address": "localhost",
- `"state"` - "ESTABLISHED", "state": "ESTABLISHED",
- `"user"` - "root", "user": "root",
- `"inode"` - 46828, "inode": 46828,
- `"program_name"` - "ssh", "program_name": "ssh",
- `"kind"` - "network", "kind": "network",
- `"pid"` - 2241, "pid": 2241,
- `"local_port"` - "52186", "local_port": "52186",
- `"foreign_port"` - "ssh", "foreign_port": "ssh",
- `"transport_protocol"` - "tcp", "transport_protocol": "tcp",
- `"network_protocol"` - "ipv4", "network_protocol": "ipv4",
- `"local_port_num"` - 52186 "local_port_num": 52186
}, },
{ {
- `"proto"` - "tcp6", "proto": "tcp6",
- `"recv_q"` - 0, "recv_q": 0,
- `"send_q"` - 0, "send_q": 0,
- `"local_address"` - "[::]", "local_address": "[::]",
- `"foreign_address"` - "[::]", "foreign_address": "[::]",
- `"state"` - "LISTEN", "state": "LISTEN",
- `"user"` - "root", "user": "root",
- `"inode"` - 30510, "inode": 30510,
- `"program_name"` - "sshd", "program_name": "sshd",
- `"kind"` - "network", "kind": "network",
- `"pid"` - 1186, "pid": 1186,
- `"local_port"` - "ssh", "local_port": "ssh",
- `"foreign_port"` - "*", "foreign_port": "*",
- `"transport_protocol"` - "tcp", "transport_protocol": "tcp",
- `"network_protocol"` - "ipv6" "network_protocol": "ipv6"
}, },
{ {
- `"proto"` - "udp", "proto": "udp",
- `"recv_q"` - 0, "recv_q": 0,
- `"send_q"` - 0, "send_q": 0,
- `"local_address"` - "localhost", "local_address": "localhost",
- `"foreign_address"` - "0.0.0.0", "foreign_address": "0.0.0.0",
- `"state"` - null, "state": null,
- `"user"` - "systemd-resolve", "user": "systemd-resolve",
- `"inode"` - 26957, "inode": 26957,
- `"program_name"` - "systemd-resolve", "program_name": "systemd-resolve",
- `"kind"` - "network", "kind": "network",
- `"pid"` - 887, "pid": 887,
- `"local_port"` - "domain", "local_port": "domain",
- `"foreign_port"` - "*", "foreign_port": "*",
- `"transport_protocol"` - "udp", "transport_protocol": "udp",
- `"network_protocol"` - "ipv4" "network_protocol": "ipv4"
}, },
{ {
- `"proto"` - "raw6", "proto": "raw6",
- `"recv_q"` - 0, "recv_q": 0,
- `"send_q"` - 0, "send_q": 0,
- `"local_address"` - "[::]", "local_address": "[::]",
- `"foreign_address"` - "[::]", "foreign_address": "[::]",
- `"state"` - "7", "state": "7",
- `"user"` - "systemd-network", "user": "systemd-network",
- `"inode"` - 27001, "inode": 27001,
- `"program_name"` - "systemd-network", "program_name": "systemd-network",
- `"kind"` - "network", "kind": "network",
- `"pid"` - 867, "pid": 867,
- `"local_port"` - "ipv6-icmp", "local_port": "ipv6-icmp",
- `"foreign_port"` - "*", "foreign_port": "*",
- `"transport_protocol"` - null, "transport_protocol": null,
- `"network_protocol"` - "ipv6" "network_protocol": "ipv6"
}, },
{ {
- `"proto"` - "unix", "proto": "unix",
- `"refcnt"` - 2, "refcnt": 2,
- `"flags"` - null, "flags": null,
- `"type"` - "DGRAM", "type": "DGRAM",
- `"state"` - null, "state": null,
- `"inode"` - 33322, "inode": 33322,
- `"program_name"` - "systemd", "program_name": "systemd",
- `"path"` - "/run/user/1000/systemd/notify", "path": "/run/user/1000/systemd/notify",
- `"kind"` - "socket", "kind": "socket",
- `"pid"` - 1607 "pid": 1607
}, },
{ {
- `"proto"` - "unix", "proto": "unix",
- `"refcnt"` - 2, "refcnt": 2,
- `"flags"` - "ACC", "flags": "ACC",
- `"type"` - "SEQPACKET", "type": "SEQPACKET",
- `"state"` - "LISTENING", "state": "LISTENING",
- `"inode"` - 20835, "inode": 20835,
- `"program_name"` - "init", "program_name": "init",
- `"path"` - "/run/udev/control", "path": "/run/udev/control",
- `"kind"` - "socket", "kind": "socket",
- `"pid"` - 1 "pid": 1
}, },
... ...
] ]
@ -285,45 +284,45 @@ string,
$ netstat -r | jc --netstat -p $ netstat -r | jc --netstat -p
[ [
{ {
- `"destination"` - "default", "destination": "default",
- `"gateway"` - "gateway", "gateway": "gateway",
- `"genmask"` - "0.0.0.0", "genmask": "0.0.0.0",
- `"route_flags"` - "UG", "route_flags": "UG",
- `"mss"` - 0, "mss": 0,
- `"window"` - 0, "window": 0,
- `"irtt"` - 0, "irtt": 0,
- `"iface"` - "ens33", "iface": "ens33",
- `"kind"` - "route", "kind": "route",
- `"route_flags_pretty"` - [ "route_flags_pretty": [
"UP", "UP",
"GATEWAY" "GATEWAY"
] ]
}, },
{ {
- `"destination"` - "172.17.0.0", "destination": "172.17.0.0",
- `"gateway"` - "0.0.0.0", "gateway": "0.0.0.0",
- `"genmask"` - "255.255.0.0", "genmask": "255.255.0.0",
- `"route_flags"` - "U", "route_flags": "U",
- `"mss"` - 0, "mss": 0,
- `"window"` - 0, "window": 0,
- `"irtt"` - 0, "irtt": 0,
- `"iface"` - "docker0", "iface": "docker0",
- `"kind"` - "route", "kind": "route",
- `"route_flags_pretty"` - [ "route_flags_pretty": [
"UP" "UP"
] ]
}, },
{ {
- `"destination"` - "192.168.71.0", "destination": "192.168.71.0",
- `"gateway"` - "0.0.0.0", "gateway": "0.0.0.0",
- `"genmask"` - "255.255.255.0", "genmask": "255.255.255.0",
- `"route_flags"` - "U", "route_flags": "U",
- `"mss"` - 0, "mss": 0,
- `"window"` - 0, "window": 0,
- `"irtt"` - 0, "irtt": 0,
- `"iface"` - "ens33", "iface": "ens33",
- `"kind"` - "route", "kind": "route",
- `"route_flags_pretty"` - [ "route_flags_pretty": [
"UP" "UP"
] ]
} }
@ -332,32 +331,32 @@ string,
$ netstat -i | jc --netstat -p $ netstat -i | jc --netstat -p
[ [
{ {
- `"iface"` - "ens33", "iface": "ens33",
- `"mtu"` - 1500, "mtu": 1500,
- `"rx_ok"` - 476, "rx_ok": 476,
- `"rx_err"` - 0, "rx_err": 0,
- `"rx_drp"` - 0, "rx_drp": 0,
- `"rx_ovr"` - 0, "rx_ovr": 0,
- `"tx_ok"` - 312, "tx_ok": 312,
- `"tx_err"` - 0, "tx_err": 0,
- `"tx_drp"` - 0, "tx_drp": 0,
- `"tx_ovr"` - 0, "tx_ovr": 0,
- `"flg"` - "BMRU", "flg": "BMRU",
- `"kind"` - "interface" "kind": "interface"
}, },
{ {
- `"iface"` - "lo", "iface": "lo",
- `"mtu"` - 65536, "mtu": 65536,
- `"rx_ok"` - 0, "rx_ok": 0,
- `"rx_err"` - 0, "rx_err": 0,
- `"rx_drp"` - 0, "rx_drp": 0,
- `"rx_ovr"` - 0, "rx_ovr": 0,
- `"tx_ok"` - 0, "tx_ok": 0,
- `"tx_err"` - 0, "tx_err": 0,
- `"tx_drp"` - 0, "tx_drp": 0,
- `"tx_ovr"` - 0, "tx_ovr": 0,
- `"flg"` - "LRU", "flg": "LRU",
- `"kind"` - "interface" "kind": "interface"
} }
] ]
@ -381,16 +380,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -41,174 +41,173 @@ Schema:
}, },
] ]
**Examples**: Examples:
$ ntpq -p | jc --ntpq -p $ ntpq -p | jc --ntpq -p
[ [
{ {
- `"remote"` - "44.190.6.254", "remote": "44.190.6.254",
- `"refid"` - "127.67.113.92", "refid": "127.67.113.92",
- `"st"` - 2, "st": 2,
- `"t"` - "u", "t": "u",
- `"when"` - 1, "when": 1,
- `"poll"` - 64, "poll": 64,
- `"reach"` - 1, "reach": 1,
- `"delay"` - 23.399, "delay": 23.399,
- `"offset"` - -2.805, "offset": -2.805,
- `"jitter"` - 2.131, "jitter": 2.131,
- `"state"` - null "state": null
}, },
{ {
- `"remote"` - "ntp.wdc1.us.lea", "remote": "ntp.wdc1.us.lea",
- `"refid"` - "130.133.1.10", "refid": "130.133.1.10",
- `"st"` - 2, "st": 2,
- `"t"` - "u", "t": "u",
- `"when"` - null, "when": null,
- `"poll"` - 64, "poll": 64,
- `"reach"` - 1, "reach": 1,
- `"delay"` - 93.053, "delay": 93.053,
- `"offset"` - -0.807, "offset": -0.807,
- `"jitter"` - 2.839, "jitter": 2.839,
- `"state"` - null "state": null
}, },
{ {
- `"remote"` - "clock.team-cymr", "remote": "clock.team-cymr",
- `"refid"` - "204.9.54.119", "refid": "204.9.54.119",
- `"st"` - 2, "st": 2,
- `"t"` - "u", "t": "u",
- `"when"` - null, "when": null,
- `"poll"` - 64, "poll": 64,
- `"reach"` - 1, "reach": 1,
- `"delay"` - 70.337, "delay": 70.337,
- `"offset"` - -2.909, "offset": -2.909,
- `"jitter"` - 2.6, "jitter": 2.6,
- `"state"` - null "state": null
}, },
{ {
- `"remote"` - "mirror1.sjc02.s", "remote": "mirror1.sjc02.s",
- `"refid"` - "216.218.254.202", "refid": "216.218.254.202",
- `"st"` - 2, "st": 2,
- `"t"` - "u", "t": "u",
- `"when"` - 2, "when": 2,
- `"poll"` - 64, "poll": 64,
- `"reach"` - 1, "reach": 1,
- `"delay"` - 29.325, "delay": 29.325,
- `"offset"` - 1.044, "offset": 1.044,
- `"jitter"` - 4.069, "jitter": 4.069,
- `"state"` - null, "state": null,
} }
] ]
$ ntpq -pn| jc --ntpq -p $ ntpq -pn| jc --ntpq -p
[ [
{ {
- `"remote"` - "44.190.6.254", "remote": "44.190.6.254",
- `"refid"` - "127.67.113.92", "refid": "127.67.113.92",
- `"st"` - 2, "st": 2,
- `"t"` - "u", "t": "u",
- `"when"` - 66, "when": 66,
- `"poll"` - 64, "poll": 64,
- `"reach"` - 377, "reach": 377,
- `"delay"` - 22.69, "delay": 22.69,
- `"offset"` - -0.392, "offset": -0.392,
- `"jitter"` - 2.085, "jitter": 2.085,
- `"state"` - "+" "state": "+"
}, },
{ {
- `"remote"` - "108.59.2.24", "remote": "108.59.2.24",
- `"refid"` - "130.133.1.10", "refid": "130.133.1.10",
- `"st"` - 2, "st": 2,
- `"t"` - "u", "t": "u",
- `"when"` - 63, "when": 63,
- `"poll"` - 64, "poll": 64,
- `"reach"` - 377, "reach": 377,
- `"delay"` - 90.805, "delay": 90.805,
- `"offset"` - 2.84, "offset": 2.84,
- `"jitter"` - 1.908, "jitter": 1.908,
- `"state"` - "-" "state": "-"
}, },
{ {
- `"remote"` - "38.229.71.1", "remote": "38.229.71.1",
- `"refid"` - "204.9.54.119", "refid": "204.9.54.119",
- `"st"` - 2, "st": 2,
- `"t"` - "u", "t": "u",
- `"when"` - 64, "when": 64,
- `"poll"` - 64, "poll": 64,
- `"reach"` - 377, "reach": 377,
- `"delay"` - 68.699, "delay": 68.699,
- `"offset"` - -0.61, "offset": -0.61,
- `"jitter"` - 2.576, "jitter": 2.576,
- `"state"` - "+" "state": "+"
}, },
{ {
- `"remote"` - "72.5.72.15", "remote": "72.5.72.15",
- `"refid"` - "216.218.254.202", "refid": "216.218.254.202",
- `"st"` - 2, "st": 2,
- `"t"` - "u", "t": "u",
- `"when"` - 63, "when": 63,
- `"poll"` - 64, "poll": 64,
- `"reach"` - 377, "reach": 377,
- `"delay"` - 22.654, "delay": 22.654,
- `"offset"` - 0.231, "offset": 0.231,
- `"jitter"` - 1.964, "jitter": 1.964,
- `"state"` - "*" "state": "*"
} }
] ]
$ ntpq -pn| jc --ntpq -p -r $ ntpq -pn| jc --ntpq -p -r
[ [
{ {
- `"s"` - "+", "s": "+",
- `"remote"` - "44.190.6.254", "remote": "44.190.6.254",
- `"refid"` - "127.67.113.92", "refid": "127.67.113.92",
- `"st"` - "2", "st": "2",
- `"t"` - "u", "t": "u",
- `"when"` - "66", "when": "66",
- `"poll"` - "64", "poll": "64",
- `"reach"` - "377", "reach": "377",
- `"delay"` - "22.690", "delay": "22.690",
- `"offset"` - "-0.392", "offset": "-0.392",
- `"jitter"` - "2.085" "jitter": "2.085"
}, },
{ {
- `"s"` - "-", "s": "-",
- `"remote"` - "108.59.2.24", "remote": "108.59.2.24",
- `"refid"` - "130.133.1.10", "refid": "130.133.1.10",
- `"st"` - "2", "st": "2",
- `"t"` - "u", "t": "u",
- `"when"` - "63", "when": "63",
- `"poll"` - "64", "poll": "64",
- `"reach"` - "377", "reach": "377",
- `"delay"` - "90.805", "delay": "90.805",
- `"offset"` - "2.840", "offset": "2.840",
- `"jitter"` - "1.908" "jitter": "1.908"
}, },
{ {
- `"s"` - "+", "s": "+",
- `"remote"` - "38.229.71.1", "remote": "38.229.71.1",
- `"refid"` - "204.9.54.119", "refid": "204.9.54.119",
- `"st"` - "2", "st": "2",
- `"t"` - "u", "t": "u",
- `"when"` - "64", "when": "64",
- `"poll"` - "64", "poll": "64",
- `"reach"` - "377", "reach": "377",
- `"delay"` - "68.699", "delay": "68.699",
- `"offset"` - "-0.610", "offset": "-0.610",
- `"jitter"` - "2.576" "jitter": "2.576"
}, },
{ {
- `"s"` - "*", "s": "*",
- `"remote"` - "72.5.72.15", "remote": "72.5.72.15",
- `"refid"` - "216.218.254.202", "refid": "216.218.254.202",
- `"st"` - "2", "st": "2",
- `"t"` - "u", "t": "u",
- `"when"` - "63", "when": "63",
- `"poll"` - "64", "poll": "64",
- `"reach"` - "377", "reach": "377",
- `"delay"` - "22.654", "delay": "22.654",
- `"offset"` - "0.231", "offset": "0.231",
- `"jitter"` - "1.964" "jitter": "1.964"
} }
] ]
@ -232,16 +231,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -33,37 +33,36 @@ Schema:
} }
] ]
**Examples**: Examples:
$ cat /etc/passwd | jc --passwd -p $ cat /etc/passwd | jc --passwd -p
[ [
{ {
- `"username"` - "nobody", "username": "nobody",
- `"password"` - "*", "password": "*",
- `"uid"` - -2, "uid": -2,
- `"gid"` - -2, "gid": -2,
- `"comment"` - "Unprivileged User", "comment": "Unprivileged User",
- `"home"` - "/var/empty", "home": "/var/empty",
- `"shell"` - "/usr/bin/false" "shell": "/usr/bin/false"
}, },
{ {
- `"username"` - "root", "username": "root",
- `"password"` - "*", "password": "*",
- `"uid"` - 0, "uid": 0,
- `"gid"` - 0, "gid": 0,
- `"comment"` - "System Administrator", "comment": "System Administrator",
- `"home"` - "/var/root", "home": "/var/root",
- `"shell"` - "/bin/sh" "shell": "/bin/sh"
}, },
{ {
- `"username"` - "daemon", "username": "daemon",
- `"password"` - "*", "password": "*",
- `"uid"` - 1, "uid": 1,
- `"gid"` - 1, "gid": 1,
- `"comment"` - "System Services", "comment": "System Services",
- `"home"` - "/var/root", "home": "/var/root",
- `"shell"` - "/usr/bin/false" "shell": "/usr/bin/false"
}, },
... ...
] ]
@ -71,31 +70,31 @@ Schema:
$ cat /etc/passwd | jc --passwd -p -r $ cat /etc/passwd | jc --passwd -p -r
[ [
{ {
- `"username"` - "nobody", "username": "nobody",
- `"password"` - "*", "password": "*",
- `"uid"` - "-2", "uid": "-2",
- `"gid"` - "-2", "gid": "-2",
- `"comment"` - "Unprivileged User", "comment": "Unprivileged User",
- `"home"` - "/var/empty", "home": "/var/empty",
- `"shell"` - "/usr/bin/false" "shell": "/usr/bin/false"
}, },
{ {
- `"username"` - "root", "username": "root",
- `"password"` - "*", "password": "*",
- `"uid"` - "0", "uid": "0",
- `"gid"` - "0", "gid": "0",
- `"comment"` - "System Administrator", "comment": "System Administrator",
- `"home"` - "/var/root", "home": "/var/root",
- `"shell"` - "/bin/sh" "shell": "/bin/sh"
}, },
{ {
- `"username"` - "daemon", "username": "daemon",
- `"password"` - "*", "password": "*",
- `"uid"` - "1", "uid": "1",
- `"gid"` - "1", "gid": "1",
- `"comment"` - "System Services", "comment": "System Services",
- `"home"` - "/var/root", "home": "/var/root",
- `"shell"` - "/usr/bin/false" "shell": "/usr/bin/false"
}, },
... ...
] ]
@ -120,16 +119,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -75,95 +75,94 @@ Schema:
[1] only if an 'unparsable_line' type [1] only if an 'unparsable_line' type
[2] hex value converted to decimal [2] hex value converted to decimal
**Examples**: Examples:
$ ping -c 3 -p ff cnn.com | jc --ping -p $ ping -c 3 -p ff cnn.com | jc --ping -p
{ {
- `"destination_ip"` - "151.101.1.67", "destination_ip": "151.101.1.67",
- `"data_bytes"` - 56, "data_bytes": 56,
- `"pattern"` - "0xff", "pattern": "0xff",
- `"destination"` - "cnn.com", "destination": "cnn.com",
- `"packets_transmitted"` - 3, "packets_transmitted": 3,
- `"packets_received"` - 3, "packets_received": 3,
- `"packet_loss_percent"` - 0.0, "packet_loss_percent": 0.0,
- `"duplicates"` - 0, "duplicates": 0,
- `"round_trip_ms_min"` - 28.015, "round_trip_ms_min": 28.015,
- `"round_trip_ms_avg"` - 32.848, "round_trip_ms_avg": 32.848,
- `"round_trip_ms_max"` - 39.376, "round_trip_ms_max": 39.376,
- `"round_trip_ms_stddev"` - 4.79, "round_trip_ms_stddev": 4.79,
- `"responses"` - [ "responses": [
{ {
- `"type"` - "reply", "type": "reply",
- `"bytes"` - 64, "bytes": 64,
- `"response_ip"` - "151.101.1.67", "response_ip": "151.101.1.67",
- `"icmp_seq"` - 0, "icmp_seq": 0,
- `"ttl"` - 59, "ttl": 59,
- `"time_ms"` - 28.015, "time_ms": 28.015,
- `"duplicate"` - false "duplicate": false
}, },
{ {
- `"type"` - "reply", "type": "reply",
- `"bytes"` - 64, "bytes": 64,
- `"response_ip"` - "151.101.1.67", "response_ip": "151.101.1.67",
- `"icmp_seq"` - 1, "icmp_seq": 1,
- `"ttl"` - 59, "ttl": 59,
- `"time_ms"` - 39.376, "time_ms": 39.376,
- `"duplicate"` - false "duplicate": false
}, },
{ {
- `"type"` - "reply", "type": "reply",
- `"bytes"` - 64, "bytes": 64,
- `"response_ip"` - "151.101.1.67", "response_ip": "151.101.1.67",
- `"icmp_seq"` - 2, "icmp_seq": 2,
- `"ttl"` - 59, "ttl": 59,
- `"time_ms"` - 31.153, "time_ms": 31.153,
- `"duplicate"` - false "duplicate": false
} }
] ]
} }
$ ping -c 3 -p ff cnn.com | jc --ping -p -r $ ping -c 3 -p ff cnn.com | jc --ping -p -r
{ {
- `"destination_ip"` - "151.101.129.67", "destination_ip": "151.101.129.67",
- `"data_bytes"` - "56", "data_bytes": "56",
- `"pattern"` - "0xff", "pattern": "0xff",
- `"destination"` - "cnn.com", "destination": "cnn.com",
- `"packets_transmitted"` - "3", "packets_transmitted": "3",
- `"packets_received"` - "3", "packets_received": "3",
- `"packet_loss_percent"` - "0.0", "packet_loss_percent": "0.0",
- `"duplicates"` - "0", "duplicates": "0",
- `"round_trip_ms_min"` - "25.078", "round_trip_ms_min": "25.078",
- `"round_trip_ms_avg"` - "29.543", "round_trip_ms_avg": "29.543",
- `"round_trip_ms_max"` - "32.553", "round_trip_ms_max": "32.553",
- `"round_trip_ms_stddev"` - "3.221", "round_trip_ms_stddev": "3.221",
- `"responses"` - [ "responses": [
{ {
- `"type"` - "reply", "type": "reply",
- `"bytes"` - "64", "bytes": "64",
- `"response_ip"` - "151.101.129.67", "response_ip": "151.101.129.67",
- `"icmp_seq"` - "0", "icmp_seq": "0",
- `"ttl"` - "59", "ttl": "59",
- `"time_ms"` - "25.078", "time_ms": "25.078",
- `"duplicate"` - false "duplicate": false
}, },
{ {
- `"type"` - "reply", "type": "reply",
- `"bytes"` - "64", "bytes": "64",
- `"response_ip"` - "151.101.129.67", "response_ip": "151.101.129.67",
- `"icmp_seq"` - "1", "icmp_seq": "1",
- `"ttl"` - "59", "ttl": "59",
- `"time_ms"` - "30.999", "time_ms": "30.999",
- `"duplicate"` - false "duplicate": false
}, },
{ {
- `"type"` - "reply", "type": "reply",
- `"bytes"` - "64", "bytes": "64",
- `"response_ip"` - "151.101.129.67", "response_ip": "151.101.129.67",
- `"icmp_seq"` - "2", "icmp_seq": "2",
- `"ttl"` - "59", "ttl": "59",
- `"time_ms"` - "32.553", "time_ms": "32.553",
- `"duplicate"` - false "duplicate": false
} }
] ]
} }
@ -188,16 +187,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
Dictionary. Raw or processed structured data. Dictionary. Raw or processed structured data.

View File

@ -74,8 +74,7 @@ Schema:
[0] 'reply', 'timeout', 'summary', etc. See `_error_type.type_map` [0] 'reply', 'timeout', 'summary', etc. See `_error_type.type_map`
for all options. for all options.
**Examples**: Examples:
$ ping 1.1.1.1 | jc --ping-s $ ping 1.1.1.1 | jc --ping-s
{"type":"reply","destination_ip":"1.1.1.1","sent_bytes":56,"patte...} {"type":"reply","destination_ip":"1.1.1.1","sent_bytes":56,"patte...}
@ -109,25 +108,20 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False)
Main text parsing generator function. Returns an iterator object. Main text parsing generator function. Returns an iterator object.
**Arguments**: Parameters:
data: (iterable) line-based text data to parse
- `data` - (iterable) line-based text data to parse
(e.g. sys.stdin or str.splitlines()) (e.g. sys.stdin or str.splitlines())
- `raw` - (boolean) unprocessed output if True raw: (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True quiet: (boolean) suppress warning messages if True
- `ignore_exceptions` - (boolean) ignore parsing exceptions if True ignore_exceptions: (boolean) ignore parsing exceptions if True
**Yields**:
Yields:
Dictionary. Raw or processed structured data. Dictionary. Raw or processed structured data.
Returns:
**Returns**:
Iterator object Iterator object

View File

@ -33,22 +33,21 @@ Schema:
} }
] ]
**Examples**: Examples:
$ pip list | jc --pip-list -p $ pip list | jc --pip-list -p
[ [
{ {
- `"package"` - "ansible", "package": "ansible",
- `"version"` - "2.8.5" "version": "2.8.5"
}, },
{ {
- `"package"` - "antlr4-python3-runtime", "package": "antlr4-python3-runtime",
- `"version"` - "4.7.2" "version": "4.7.2"
}, },
{ {
- `"package"` - "asn1crypto", "package": "asn1crypto",
- `"version"` - "0.24.0" "version": "0.24.0"
}, },
... ...
] ]
@ -73,16 +72,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -40,34 +40,33 @@ Schema:
} }
] ]
**Examples**: Examples:
$ pip show wrapt jc wheel | jc --pip-show -p $ pip show wrapt jc wheel | jc --pip-show -p
[ [
{ {
- `"name"` - "wrapt", "name": "wrapt",
- `"version"` - "1.11.2", "version": "1.11.2",
- `"summary"` - "Module for decorators, wrappers and monkey patching.", "summary": "Module for decorators, wrappers and monkey patching.",
- `"home_page"` - "https://github.com/GrahamDumpleton/wrapt", "home_page": "https://github.com/GrahamDumpleton/wrapt",
- `"author"` - "Graham Dumpleton", "author": "Graham Dumpleton",
- `"author_email"` - "Graham.Dumpleton@gmail.com", "author_email": "Graham.Dumpleton@gmail.com",
- `"license"` - "BSD", "license": "BSD",
- `"location"` - "/usr/local/lib/python3.7/site-packages", "location": "/usr/local/lib/python3.7/site-packages",
- `"requires"` - null, "requires": null,
- `"required_by"` - "astroid" "required_by": "astroid"
}, },
{ {
- `"name"` - "wheel", "name": "wheel",
- `"version"` - "0.33.4", "version": "0.33.4",
- `"summary"` - "A built-package format for Python.", "summary": "A built-package format for Python.",
- `"home_page"` - "https://github.com/pypa/wheel", "home_page": "https://github.com/pypa/wheel",
- `"author"` - "Daniel Holth", "author": "Daniel Holth",
- `"author_email"` - "dholth@fastmail.fm", "author_email": "dholth@fastmail.fm",
- `"license"` - "MIT", "license": "MIT",
- `"location"` - "/usr/local/lib/python3.7/site-packages", "location": "/usr/local/lib/python3.7/site-packages",
- `"requires"` - null, "requires": null,
- `"required_by"` - null "required_by": null
} }
] ]
@ -91,16 +90,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -51,40 +51,39 @@ Schema:
} }
] ]
**Examples**: Examples:
$ ps -ef | jc --ps -p $ ps -ef | jc --ps -p
[ [
{ {
- `"uid"` - "root", "uid": "root",
- `"pid"` - 1, "pid": 1,
- `"ppid"` - 0, "ppid": 0,
- `"c"` - 0, "c": 0,
- `"stime"` - "Nov01", "stime": "Nov01",
- `"tty"` - null, "tty": null,
- `"time"` - "00:00:11", "time": "00:00:11",
- `"cmd"` - "/usr/lib/systemd/systemd --switched-root --system --dese..." "cmd": "/usr/lib/systemd/systemd --switched-root --system --dese..."
}, },
{ {
- `"uid"` - "root", "uid": "root",
- `"pid"` - 2, "pid": 2,
- `"ppid"` - 0, "ppid": 0,
- `"c"` - 0, "c": 0,
- `"stime"` - "Nov01", "stime": "Nov01",
- `"tty"` - null, "tty": null,
- `"time"` - "00:00:00", "time": "00:00:00",
- `"cmd"` - "[kthreadd]" "cmd": "[kthreadd]"
}, },
{ {
- `"uid"` - "root", "uid": "root",
- `"pid"` - 4, "pid": 4,
- `"ppid"` - 2, "ppid": 2,
- `"c"` - 0, "c": 0,
- `"stime"` - "Nov01", "stime": "Nov01",
- `"tty"` - null, "tty": null,
- `"time"` - "00:00:00", "time": "00:00:00",
- `"cmd"` - "[kworker/0:0H]" "cmd": "[kworker/0:0H]"
}, },
... ...
] ]
@ -92,34 +91,34 @@ Schema:
$ ps -ef | jc --ps -p -r $ ps -ef | jc --ps -p -r
[ [
{ {
- `"uid"` - "root", "uid": "root",
- `"pid"` - "1", "pid": "1",
- `"ppid"` - "0", "ppid": "0",
- `"c"` - "0", "c": "0",
- `"stime"` - "Nov01", "stime": "Nov01",
- `"tty"` - "?", "tty": "?",
- `"time"` - "00:00:11", "time": "00:00:11",
- `"cmd"` - "/usr/lib/systemd/systemd --switched-root --system --dese..." "cmd": "/usr/lib/systemd/systemd --switched-root --system --dese..."
}, },
{ {
- `"uid"` - "root", "uid": "root",
- `"pid"` - "2", "pid": "2",
- `"ppid"` - "0", "ppid": "0",
- `"c"` - "0", "c": "0",
- `"stime"` - "Nov01", "stime": "Nov01",
- `"tty"` - "?", "tty": "?",
- `"time"` - "00:00:00", "time": "00:00:00",
- `"cmd"` - "[kthreadd]" "cmd": "[kthreadd]"
}, },
{ {
- `"uid"` - "root", "uid": "root",
- `"pid"` - "4", "pid": "4",
- `"ppid"` - "2", "ppid": "2",
- `"c"` - "0", "c": "0",
- `"stime"` - "Nov01", "stime": "Nov01",
- `"tty"` - "?", "tty": "?",
- `"time"` - "00:00:00", "time": "00:00:00",
- `"cmd"` - "[kworker/0:0H]" "cmd": "[kworker/0:0H]"
}, },
... ...
] ]
@ -127,43 +126,43 @@ Schema:
$ ps axu | jc --ps -p $ ps axu | jc --ps -p
[ [
{ {
- `"user"` - "root", "user": "root",
- `"pid"` - 1, "pid": 1,
- `"cpu_percent"` - 0.0, "cpu_percent": 0.0,
- `"mem_percent"` - 0.1, "mem_percent": 0.1,
- `"vsz"` - 128072, "vsz": 128072,
- `"rss"` - 6784, "rss": 6784,
- `"tty"` - null, "tty": null,
- `"stat"` - "Ss", "stat": "Ss",
- `"start"` - "Nov09", "start": "Nov09",
- `"time"` - "0:08", "time": "0:08",
- `"command"` - "/usr/lib/systemd/systemd --switched-root --system --..." "command": "/usr/lib/systemd/systemd --switched-root --system --..."
}, },
{ {
- `"user"` - "root", "user": "root",
- `"pid"` - 2, "pid": 2,
- `"cpu_percent"` - 0.0, "cpu_percent": 0.0,
- `"mem_percent"` - 0.0, "mem_percent": 0.0,
- `"vsz"` - 0, "vsz": 0,
- `"rss"` - 0, "rss": 0,
- `"tty"` - null, "tty": null,
- `"stat"` - "S", "stat": "S",
- `"start"` - "Nov09", "start": "Nov09",
- `"time"` - "0:00", "time": "0:00",
- `"command"` - "[kthreadd]" "command": "[kthreadd]"
}, },
{ {
- `"user"` - "root", "user": "root",
- `"pid"` - 4, "pid": 4,
- `"cpu_percent"` - 0.0, "cpu_percent": 0.0,
- `"mem_percent"` - 0.0, "mem_percent": 0.0,
- `"vsz"` - 0, "vsz": 0,
- `"rss"` - 0, "rss": 0,
- `"tty"` - null, "tty": null,
- `"stat"` - "S<", "stat": "S<",
- `"start"` - "Nov09", "start": "Nov09",
- `"time"` - "0:00", "time": "0:00",
- `"command"` - "[kworker/0:0H]" "command": "[kworker/0:0H]"
}, },
... ...
] ]
@ -171,43 +170,43 @@ Schema:
$ ps axu | jc --ps -p -r $ ps axu | jc --ps -p -r
[ [
{ {
- `"user"` - "root", "user": "root",
- `"pid"` - "1", "pid": "1",
- `"cpu_percent"` - "0.0", "cpu_percent": "0.0",
- `"mem_percent"` - "0.1", "mem_percent": "0.1",
- `"vsz"` - "128072", "vsz": "128072",
- `"rss"` - "6784", "rss": "6784",
- `"tty"` - "?", "tty": "?",
- `"stat"` - "Ss", "stat": "Ss",
- `"start"` - "Nov09", "start": "Nov09",
- `"time"` - "0:08", "time": "0:08",
- `"command"` - "/usr/lib/systemd/systemd --switched-root --system --..." "command": "/usr/lib/systemd/systemd --switched-root --system --..."
}, },
{ {
- `"user"` - "root", "user": "root",
- `"pid"` - "2", "pid": "2",
- `"cpu_percent"` - "0.0", "cpu_percent": "0.0",
- `"mem_percent"` - "0.0", "mem_percent": "0.0",
- `"vsz"` - "0", "vsz": "0",
- `"rss"` - "0", "rss": "0",
- `"tty"` - "?", "tty": "?",
- `"stat"` - "S", "stat": "S",
- `"start"` - "Nov09", "start": "Nov09",
- `"time"` - "0:00", "time": "0:00",
- `"command"` - "[kthreadd]" "command": "[kthreadd]"
}, },
{ {
- `"user"` - "root", "user": "root",
- `"pid"` - "4", "pid": "4",
- `"cpu_percent"` - "0.0", "cpu_percent": "0.0",
- `"mem_percent"` - "0.0", "mem_percent": "0.0",
- `"vsz"` - "0", "vsz": "0",
- `"rss"` - "0", "rss": "0",
- `"tty"` - "?", "tty": "?",
- `"stat"` - "S<", "stat": "S<",
- `"start"` - "Nov09", "start": "Nov09",
- `"time"` - "0:00", "time": "0:00",
- `"command"` - "[kworker/0:0H]" "command": "[kworker/0:0H]"
}, },
... ...
] ]
@ -232,16 +231,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -44,41 +44,40 @@ string
} }
] ]
**Examples**: Examples:
$ route -ee | jc --route -p $ route -ee | jc --route -p
[ [
{ {
- `"destination"` - "default", "destination": "default",
- `"gateway"` - "_gateway", "gateway": "_gateway",
- `"genmask"` - "0.0.0.0", "genmask": "0.0.0.0",
- `"flags"` - "UG", "flags": "UG",
- `"metric"` - 202, "metric": 202,
- `"ref"` - 0, "ref": 0,
- `"use"` - 0, "use": 0,
- `"iface"` - "ens33", "iface": "ens33",
- `"mss"` - 0, "mss": 0,
- `"window"` - 0, "window": 0,
- `"irtt"` - 0, "irtt": 0,
- `"flags_pretty"` - [ "flags_pretty": [
"UP", "UP",
"GATEWAY" "GATEWAY"
] ]
}, },
{ {
- `"destination"` - "192.168.71.0", "destination": "192.168.71.0",
- `"gateway"` - "0.0.0.0", "gateway": "0.0.0.0",
- `"genmask"` - "255.255.255.0", "genmask": "255.255.255.0",
- `"flags"` - "U", "flags": "U",
- `"metric"` - 202, "metric": 202,
- `"ref"` - 0, "ref": 0,
- `"use"` - 0, "use": 0,
- `"iface"` - "ens33", "iface": "ens33",
- `"mss"` - 0, "mss": 0,
- `"window"` - 0, "window": 0,
- `"irtt"` - 0, "irtt": 0,
- `"flags_pretty"` - [ "flags_pretty": [
"UP" "UP"
] ]
} }
@ -87,30 +86,30 @@ string
$ route -ee | jc --route -p -r $ route -ee | jc --route -p -r
[ [
{ {
- `"destination"` - "default", "destination": "default",
- `"gateway"` - "_gateway", "gateway": "_gateway",
- `"genmask"` - "0.0.0.0", "genmask": "0.0.0.0",
- `"flags"` - "UG", "flags": "UG",
- `"metric"` - "202", "metric": "202",
- `"ref"` - "0", "ref": "0",
- `"use"` - "0", "use": "0",
- `"iface"` - "ens33", "iface": "ens33",
- `"mss"` - "0", "mss": "0",
- `"window"` - "0", "window": "0",
- `"irtt"` - "0" "irtt": "0"
}, },
{ {
- `"destination"` - "192.168.71.0", "destination": "192.168.71.0",
- `"gateway"` - "0.0.0.0", "gateway": "0.0.0.0",
- `"genmask"` - "255.255.255.0", "genmask": "255.255.255.0",
- `"flags"` - "U", "flags": "U",
- `"metric"` - "202", "metric": "202",
- `"ref"` - "0", "ref": "0",
- `"use"` - "0", "use": "0",
- `"iface"` - "ens33", "iface": "ens33",
- `"mss"` - "0", "mss": "0",
- `"window"` - "0", "window": "0",
- `"irtt"` - "0" "irtt": "0"
} }
] ]
@ -134,16 +133,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -64,59 +64,58 @@ Schema:
[0] naive timestamp [0] naive timestamp
[1] Aware timestamp if timezone is UTC [1] Aware timestamp if timezone is UTC
**Examples**: Examples:
$ rpm -qia | jc --rpm-qi -p $ rpm -qia | jc --rpm-qi -p
[ [
{ {
- `"name"` - "make", "name": "make",
- `"epoch"` - 1, "epoch": 1,
- `"version"` - "3.82", "version": "3.82",
- `"release"` - "24.el7", "release": "24.el7",
- `"architecture"` - "x86_64", "architecture": "x86_64",
- `"install_date"` - "Wed 16 Oct 2019 09:21:42 AM PDT", "install_date": "Wed 16 Oct 2019 09:21:42 AM PDT",
- `"group"` - "Development/Tools", "group": "Development/Tools",
- `"size"` - 1160660, "size": 1160660,
- `"license"` - "GPLv2+", "license": "GPLv2+",
- `"signature"` - "RSA/SHA256, Thu 22 Aug 2019 02:34:59 PM PDT, Key ...", "signature": "RSA/SHA256, Thu 22 Aug 2019 02:34:59 PM PDT, Key ...",
- `"source_rpm"` - "make-3.82-24.el7.src.rpm", "source_rpm": "make-3.82-24.el7.src.rpm",
- `"build_date"` - "Thu 08 Aug 2019 05:47:25 PM PDT", "build_date": "Thu 08 Aug 2019 05:47:25 PM PDT",
- `"build_host"` - "x86-01.bsys.centos.org", "build_host": "x86-01.bsys.centos.org",
- `"relocations"` - "(not relocatable)", "relocations": "(not relocatable)",
- `"packager"` - "CentOS BuildSystem <http://bugs.centos.org>", "packager": "CentOS BuildSystem <http://bugs.centos.org>",
- `"vendor"` - "CentOS", "vendor": "CentOS",
- `"url"` - "http://www.gnu.org/software/make/", "url": "http://www.gnu.org/software/make/",
- `"summary"` - "A GNU tool which simplifies the build process for ...", "summary": "A GNU tool which simplifies the build process for ...",
- `"description"` - "A GNU tool for controlling the generation of ex...", "description": "A GNU tool for controlling the generation of ex...",
- `"build_epoch"` - 1565311645, "build_epoch": 1565311645,
- `"build_epoch_utc"` - null, "build_epoch_utc": null,
- `"install_date_epoch"` - 1571242902, "install_date_epoch": 1571242902,
- `"install_date_epoch_utc"` - null "install_date_epoch_utc": null
}, },
{ {
- `"name"` - "kbd-legacy", "name": "kbd-legacy",
- `"version"` - "1.15.5", "version": "1.15.5",
- `"release"` - "15.el7", "release": "15.el7",
- `"architecture"` - "noarch", "architecture": "noarch",
- `"install_date"` - "Thu 15 Aug 2019 10:53:08 AM PDT", "install_date": "Thu 15 Aug 2019 10:53:08 AM PDT",
- `"group"` - "System Environment/Base", "group": "System Environment/Base",
- `"size"` - 503608, "size": 503608,
- `"license"` - "GPLv2+", "license": "GPLv2+",
- `"signature"` - "RSA/SHA256, Mon 12 Nov 2018 07:17:49 AM PST, Key ...", "signature": "RSA/SHA256, Mon 12 Nov 2018 07:17:49 AM PST, Key ...",
- `"source_rpm"` - "kbd-1.15.5-15.el7.src.rpm", "source_rpm": "kbd-1.15.5-15.el7.src.rpm",
- `"build_date"` - "Tue 30 Oct 2018 03:40:00 PM PDT", "build_date": "Tue 30 Oct 2018 03:40:00 PM PDT",
- `"build_host"` - "x86-01.bsys.centos.org", "build_host": "x86-01.bsys.centos.org",
- `"relocations"` - "(not relocatable)", "relocations": "(not relocatable)",
- `"packager"` - "CentOS BuildSystem <http://bugs.centos.org>", "packager": "CentOS BuildSystem <http://bugs.centos.org>",
- `"vendor"` - "CentOS", "vendor": "CentOS",
- `"url"` - "http://ftp.altlinux.org/pub/people/legion/kbd", "url": "http://ftp.altlinux.org/pub/people/legion/kbd",
- `"summary"` - "Legacy data for kbd package", "summary": "Legacy data for kbd package",
- `"description"` - "The kbd-legacy package contains original keymap...", "description": "The kbd-legacy package contains original keymap...",
- `"build_epoch"` - 1540939200, "build_epoch": 1540939200,
- `"build_epoch_utc"` - null, "build_epoch_utc": null,
- `"install_date_epoch"` - 1565891588, "install_date_epoch": 1565891588,
- `"install_date_epoch_utc"` - null "install_date_epoch_utc": null
}, },
... ...
] ]
@ -124,45 +123,45 @@ Schema:
$ rpm -qia | jc --rpm-qi -p -r $ rpm -qia | jc --rpm-qi -p -r
[ [
{ {
- `"name"` - "make", "name": "make",
- `"epoch"` - "1", "epoch": "1",
- `"version"` - "3.82", "version": "3.82",
- `"release"` - "24.el7", "release": "24.el7",
- `"architecture"` - "x86_64", "architecture": "x86_64",
- `"install_date"` - "Wed 16 Oct 2019 09:21:42 AM PDT", "install_date": "Wed 16 Oct 2019 09:21:42 AM PDT",
- `"group"` - "Development/Tools", "group": "Development/Tools",
- `"size"` - "1160660", "size": "1160660",
- `"license"` - "GPLv2+", "license": "GPLv2+",
- `"signature"` - "RSA/SHA256, Thu 22 Aug 2019 02:34:59 PM PDT, Key ...", "signature": "RSA/SHA256, Thu 22 Aug 2019 02:34:59 PM PDT, Key ...",
- `"source_rpm"` - "make-3.82-24.el7.src.rpm", "source_rpm": "make-3.82-24.el7.src.rpm",
- `"build_date"` - "Thu 08 Aug 2019 05:47:25 PM PDT", "build_date": "Thu 08 Aug 2019 05:47:25 PM PDT",
- `"build_host"` - "x86-01.bsys.centos.org", "build_host": "x86-01.bsys.centos.org",
- `"relocations"` - "(not relocatable)", "relocations": "(not relocatable)",
- `"packager"` - "CentOS BuildSystem <http://bugs.centos.org>", "packager": "CentOS BuildSystem <http://bugs.centos.org>",
- `"vendor"` - "CentOS", "vendor": "CentOS",
- `"url"` - "http://www.gnu.org/software/make/", "url": "http://www.gnu.org/software/make/",
- `"summary"` - "A GNU tool which simplifies the build process for...", "summary": "A GNU tool which simplifies the build process for...",
- `"description"` - "A GNU tool for controlling the generation of exe..." "description": "A GNU tool for controlling the generation of exe..."
}, },
{ {
- `"name"` - "kbd-legacy", "name": "kbd-legacy",
- `"version"` - "1.15.5", "version": "1.15.5",
- `"release"` - "15.el7", "release": "15.el7",
- `"architecture"` - "noarch", "architecture": "noarch",
- `"install_date"` - "Thu 15 Aug 2019 10:53:08 AM PDT", "install_date": "Thu 15 Aug 2019 10:53:08 AM PDT",
- `"group"` - "System Environment/Base", "group": "System Environment/Base",
- `"size"` - "503608", "size": "503608",
- `"license"` - "GPLv2+", "license": "GPLv2+",
- `"signature"` - "RSA/SHA256, Mon 12 Nov 2018 07:17:49 AM PST, Key ...", "signature": "RSA/SHA256, Mon 12 Nov 2018 07:17:49 AM PST, Key ...",
- `"source_rpm"` - "kbd-1.15.5-15.el7.src.rpm", "source_rpm": "kbd-1.15.5-15.el7.src.rpm",
- `"build_date"` - "Tue 30 Oct 2018 03:40:00 PM PDT", "build_date": "Tue 30 Oct 2018 03:40:00 PM PDT",
- `"build_host"` - "x86-01.bsys.centos.org", "build_host": "x86-01.bsys.centos.org",
- `"relocations"` - "(not relocatable)", "relocations": "(not relocatable)",
- `"packager"` - "CentOS BuildSystem <http://bugs.centos.org>", "packager": "CentOS BuildSystem <http://bugs.centos.org>",
- `"vendor"` - "CentOS", "vendor": "CentOS",
- `"url"` - "http://ftp.altlinux.org/pub/people/legion/kbd", "url": "http://ftp.altlinux.org/pub/people/legion/kbd",
- `"summary"` - "Legacy data for kbd package", "summary": "Legacy data for kbd package",
- `"description"` - "The kbd-legacy package contains original keymaps..." "description": "The kbd-legacy package contains original keymaps..."
}, },
... ...
] ]
@ -187,16 +186,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -75,136 +75,135 @@ Schema:
[0] will be integer when using deprecated -d sfdisk option [0] will be integer when using deprecated -d sfdisk option
**Examples**: Examples:
# sfdisk -l | jc --sfdisk -p # sfdisk -l | jc --sfdisk -p
[ [
{ {
- `"disk"` - "/dev/sda", "disk": "/dev/sda",
- `"cylinders"` - 2610, "cylinders": 2610,
- `"heads"` - 255, "heads": 255,
- `"sectors_per_track"` - 63, "sectors_per_track": 63,
- `"units"` - "cylinders of 8225280 bytes, blocks of 1024 bytes, ...", "units": "cylinders of 8225280 bytes, blocks of 1024 bytes, ...",
- `"partitions"` - [ "partitions": [
{ {
- `"device"` - "/dev/sda1", "device": "/dev/sda1",
- `"boot"` - true, "boot": true,
- `"start"` - 0, "start": 0,
- `"end"` - 130, "end": 130,
- `"cyls"` - 131, "cyls": 131,
- `"blocks"` - 1048576, "blocks": 1048576,
- `"id"` - "83", "id": "83",
- `"system"` - "Linux" "system": "Linux"
}, },
{ {
- `"device"` - "/dev/sda2", "device": "/dev/sda2",
- `"boot"` - false, "boot": false,
- `"start"` - 130, "start": 130,
- `"end"` - 2610, "end": 2610,
- `"cyls"` - 2481, "cyls": 2481,
- `"blocks"` - 19921920, "blocks": 19921920,
- `"id"` - "8e", "id": "8e",
- `"system"` - "Linux LVM" "system": "Linux LVM"
}, },
{ {
- `"device"` - "/dev/sda3", "device": "/dev/sda3",
- `"boot"` - false, "boot": false,
- `"start"` - 0, "start": 0,
- `"end"` - null, "end": null,
- `"cyls"` - 0, "cyls": 0,
- `"blocks"` - 0, "blocks": 0,
- `"id"` - "0", "id": "0",
- `"system"` - "Empty" "system": "Empty"
}, },
{ {
- `"device"` - "/dev/sda4", "device": "/dev/sda4",
- `"boot"` - false, "boot": false,
- `"start"` - 0, "start": 0,
- `"end"` - null, "end": null,
- `"cyls"` - 0, "cyls": 0,
- `"blocks"` - 0, "blocks": 0,
- `"id"` - "0", "id": "0",
- `"system"` - "Empty" "system": "Empty"
} }
] ]
}, },
{ {
- `"disk"` - "/dev/mapper/centos-root", "disk": "/dev/mapper/centos-root",
- `"cylinders"` - 2218, "cylinders": 2218,
- `"heads"` - 255, "heads": 255,
- `"sectors_per_track"` - 63 "sectors_per_track": 63
}, },
{ {
- `"disk"` - "/dev/mapper/centos-swap", "disk": "/dev/mapper/centos-swap",
- `"cylinders"` - 261, "cylinders": 261,
- `"heads"` - 255, "heads": 255,
- `"sectors_per_track"` - 63 "sectors_per_track": 63
} }
] ]
# sfdisk -l | jc --sfdisk -p -r # sfdisk -l | jc --sfdisk -p -r
[ [
{ {
- `"disk"` - "/dev/sda", "disk": "/dev/sda",
- `"cylinders"` - "2610", "cylinders": "2610",
- `"heads"` - "255", "heads": "255",
- `"sectors_per_track"` - "63", "sectors_per_track": "63",
- `"units"` - "cylinders of 8225280 bytes, blocks of 1024 bytes, co...", "units": "cylinders of 8225280 bytes, blocks of 1024 bytes, co...",
- `"partitions"` - [ "partitions": [
{ {
- `"device"` - "/dev/sda1", "device": "/dev/sda1",
- `"boot"` - "*", "boot": "*",
- `"start"` - "0+", "start": "0+",
- `"end"` - "130-", "end": "130-",
- `"cyls"` - "131-", "cyls": "131-",
- `"blocks"` - "1048576", "blocks": "1048576",
- `"id"` - "83", "id": "83",
- `"system"` - "Linux" "system": "Linux"
}, },
{ {
- `"device"` - "/dev/sda2", "device": "/dev/sda2",
- `"boot"` - null, "boot": null,
- `"start"` - "130+", "start": "130+",
- `"end"` - "2610-", "end": "2610-",
- `"cyls"` - "2481-", "cyls": "2481-",
- `"blocks"` - "19921920", "blocks": "19921920",
- `"id"` - "8e", "id": "8e",
- `"system"` - "Linux LVM" "system": "Linux LVM"
}, },
{ {
- `"device"` - "/dev/sda3", "device": "/dev/sda3",
- `"boot"` - null, "boot": null,
- `"start"` - "0", "start": "0",
- `"end"` - "-", "end": "-",
- `"cyls"` - "0", "cyls": "0",
- `"blocks"` - "0", "blocks": "0",
- `"id"` - "0", "id": "0",
- `"system"` - "Empty" "system": "Empty"
}, },
{ {
- `"device"` - "/dev/sda4", "device": "/dev/sda4",
- `"boot"` - null, "boot": null,
- `"start"` - "0", "start": "0",
- `"end"` - "-", "end": "-",
- `"cyls"` - "0", "cyls": "0",
- `"blocks"` - "0", "blocks": "0",
- `"id"` - "0", "id": "0",
- `"system"` - "Empty" "system": "Empty"
} }
] ]
}, },
{ {
- `"disk"` - "/dev/mapper/centos-root", "disk": "/dev/mapper/centos-root",
- `"cylinders"` - "2218", "cylinders": "2218",
- `"heads"` - "255", "heads": "255",
- `"sectors_per_track"` - "63" "sectors_per_track": "63"
}, },
{ {
- `"disk"` - "/dev/mapper/centos-swap", "disk": "/dev/mapper/centos-swap",
- `"cylinders"` - "261", "cylinders": "261",
- `"heads"` - "255", "heads": "255",
- `"sectors_per_track"` - "63" "sectors_per_track": "63"
} }
] ]
@ -228,16 +227,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -34,40 +34,39 @@ Schema:
} }
] ]
**Examples**: Examples:
$ sudo cat /etc/shadow | jc --shadow -p $ sudo cat /etc/shadow | jc --shadow -p
[ [
{ {
- `"username"` - "root", "username": "root",
- `"password"` - "*", "password": "*",
- `"last_changed"` - 18113, "last_changed": 18113,
- `"minimum"` - 0, "minimum": 0,
- `"maximum"` - 99999, "maximum": 99999,
- `"warn"` - 7, "warn": 7,
- `"inactive"` - null, "inactive": null,
- `"expire"` - null "expire": null
}, },
{ {
- `"username"` - "daemon", "username": "daemon",
- `"password"` - "*", "password": "*",
- `"last_changed"` - 18113, "last_changed": 18113,
- `"minimum"` - 0, "minimum": 0,
- `"maximum"` - 99999, "maximum": 99999,
- `"warn"` - 7, "warn": 7,
- `"inactive"` - null, "inactive": null,
- `"expire"` - null "expire": null
}, },
{ {
- `"username"` - "bin", "username": "bin",
- `"password"` - "*", "password": "*",
- `"last_changed"` - 18113, "last_changed": 18113,
- `"minimum"` - 0, "minimum": 0,
- `"maximum"` - 99999, "maximum": 99999,
- `"warn"` - 7, "warn": 7,
- `"inactive"` - null, "inactive": null,
- `"expire"` - null "expire": null
}, },
... ...
] ]
@ -75,34 +74,34 @@ Schema:
$ sudo cat /etc/shadow | jc --shadow -p -r $ sudo cat /etc/shadow | jc --shadow -p -r
[ [
{ {
- `"username"` - "root", "username": "root",
- `"password"` - "*", "password": "*",
- `"last_changed"` - "18113", "last_changed": "18113",
- `"minimum"` - "0", "minimum": "0",
- `"maximum"` - "99999", "maximum": "99999",
- `"warn"` - "7", "warn": "7",
- `"inactive"` - "", "inactive": "",
- `"expire"` - "" "expire": ""
}, },
{ {
- `"username"` - "daemon", "username": "daemon",
- `"password"` - "*", "password": "*",
- `"last_changed"` - "18113", "last_changed": "18113",
- `"minimum"` - "0", "minimum": "0",
- `"maximum"` - "99999", "maximum": "99999",
- `"warn"` - "7", "warn": "7",
- `"inactive"` - "", "inactive": "",
- `"expire"` - "" "expire": ""
}, },
{ {
- `"username"` - "bin", "username": "bin",
- `"password"` - "*", "password": "*",
- `"last_changed"` - "18113", "last_changed": "18113",
- `"minimum"` - "0", "minimum": "0",
- `"maximum"` - "99999", "maximum": "99999",
- `"warn"` - "7", "warn": "7",
- `"inactive"` - "", "inactive": "",
- `"expire"` - "" "expire": ""
}, },
... ...
] ]
@ -127,16 +126,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -51,238 +51,237 @@ field names
} }
] ]
**Examples**: Examples:
$ sudo ss -a | jc --ss -p $ sudo ss -a | jc --ss -p
[ [
{ {
- `"netid"` - "nl", "netid": "nl",
- `"state"` - "UNCONN", "state": "UNCONN",
- `"recv_q"` - 0, "recv_q": 0,
- `"send_q"` - 0, "send_q": 0,
- `"peer_address"` - "*", "peer_address": "*",
- `"channel"` - "rtnl:kernel" "channel": "rtnl:kernel"
}, },
{ {
- `"netid"` - "nl", "netid": "nl",
- `"state"` - "UNCONN", "state": "UNCONN",
- `"recv_q"` - 0, "recv_q": 0,
- `"send_q"` - 0, "send_q": 0,
- `"peer_address"` - "*", "peer_address": "*",
- `"pid"` - 893, "pid": 893,
- `"channel"` - "rtnl:systemd-resolve" "channel": "rtnl:systemd-resolve"
}, },
... ...
{ {
- `"netid"` - "p_raw", "netid": "p_raw",
- `"state"` - "UNCONN", "state": "UNCONN",
- `"recv_q"` - 0, "recv_q": 0,
- `"send_q"` - 0, "send_q": 0,
- `"peer_address"` - "*", "peer_address": "*",
- `"link_layer"` - "LLDP", "link_layer": "LLDP",
- `"interface"` - "ens33" "interface": "ens33"
}, },
{ {
- `"netid"` - "u_dgr", "netid": "u_dgr",
- `"state"` - "UNCONN", "state": "UNCONN",
- `"recv_q"` - 0, "recv_q": 0,
- `"send_q"` - 0, "send_q": 0,
- `"local_port"` - "93066", "local_port": "93066",
- `"peer_address"` - "*", "peer_address": "*",
- `"peer_port"` - "0", "peer_port": "0",
- `"path"` - "/run/user/1000/systemd/notify" "path": "/run/user/1000/systemd/notify"
}, },
{ {
- `"netid"` - "u_seq", "netid": "u_seq",
- `"state"` - "LISTEN", "state": "LISTEN",
- `"recv_q"` - 0, "recv_q": 0,
- `"send_q"` - 128, "send_q": 128,
- `"local_port"` - "20699", "local_port": "20699",
- `"peer_address"` - "*", "peer_address": "*",
- `"peer_port"` - "0", "peer_port": "0",
- `"path"` - "/run/udev/control" "path": "/run/udev/control"
}, },
... ...
{ {
- `"netid"` - "icmp6", "netid": "icmp6",
- `"state"` - "UNCONN", "state": "UNCONN",
- `"recv_q"` - 0, "recv_q": 0,
- `"send_q"` - 0, "send_q": 0,
- `"local_address"` - "*", "local_address": "*",
- `"local_port"` - "ipv6-icmp", "local_port": "ipv6-icmp",
- `"peer_address"` - "*", "peer_address": "*",
- `"peer_port"` - "*", "peer_port": "*",
- `"interface"` - "ens33" "interface": "ens33"
}, },
{ {
- `"netid"` - "udp", "netid": "udp",
- `"state"` - "UNCONN", "state": "UNCONN",
- `"recv_q"` - 0, "recv_q": 0,
- `"send_q"` - 0, "send_q": 0,
- `"local_address"` - "127.0.0.53", "local_address": "127.0.0.53",
- `"local_port"` - "domain", "local_port": "domain",
- `"peer_address"` - "0.0.0.0", "peer_address": "0.0.0.0",
- `"peer_port"` - "*", "peer_port": "*",
- `"interface"` - "lo" "interface": "lo"
}, },
{ {
- `"netid"` - "tcp", "netid": "tcp",
- `"state"` - "LISTEN", "state": "LISTEN",
- `"recv_q"` - 0, "recv_q": 0,
- `"send_q"` - 128, "send_q": 128,
- `"local_address"` - "127.0.0.53", "local_address": "127.0.0.53",
- `"local_port"` - "domain", "local_port": "domain",
- `"peer_address"` - "0.0.0.0", "peer_address": "0.0.0.0",
- `"peer_port"` - "*", "peer_port": "*",
- `"interface"` - "lo" "interface": "lo"
}, },
{ {
- `"netid"` - "tcp", "netid": "tcp",
- `"state"` - "LISTEN", "state": "LISTEN",
- `"recv_q"` - 0, "recv_q": 0,
- `"send_q"` - 128, "send_q": 128,
- `"local_address"` - "0.0.0.0", "local_address": "0.0.0.0",
- `"local_port"` - "ssh", "local_port": "ssh",
- `"peer_address"` - "0.0.0.0", "peer_address": "0.0.0.0",
- `"peer_port"` - "*" "peer_port": "*"
}, },
{ {
- `"netid"` - "tcp", "netid": "tcp",
- `"state"` - "LISTEN", "state": "LISTEN",
- `"recv_q"` - 0, "recv_q": 0,
- `"send_q"` - 128, "send_q": 128,
- `"local_address"` - "[::]", "local_address": "[::]",
- `"local_port"` - "ssh", "local_port": "ssh",
- `"peer_address"` - "[::]", "peer_address": "[::]",
- `"peer_port"` - "*" "peer_port": "*"
}, },
{ {
- `"netid"` - "v_str", "netid": "v_str",
- `"state"` - "ESTAB", "state": "ESTAB",
- `"recv_q"` - 0, "recv_q": 0,
- `"send_q"` - 0, "send_q": 0,
- `"local_address"` - "999900439", "local_address": "999900439",
- `"local_port"` - "1023", "local_port": "1023",
- `"peer_address"` - "0", "peer_address": "0",
- `"peer_port"` - "976", "peer_port": "976",
- `"local_port_num"` - 1023, "local_port_num": 1023,
- `"peer_port_num"` - 976 "peer_port_num": 976
} }
] ]
$ sudo ss -a | jc --ss -p -r $ sudo ss -a | jc --ss -p -r
[ [
{ {
- `"netid"` - "nl", "netid": "nl",
- `"state"` - "UNCONN", "state": "UNCONN",
- `"recv_q"` - "0", "recv_q": "0",
- `"send_q"` - "0", "send_q": "0",
- `"peer_address"` - "*", "peer_address": "*",
- `"channel"` - "rtnl:kernel" "channel": "rtnl:kernel"
}, },
{ {
- `"netid"` - "nl", "netid": "nl",
- `"state"` - "UNCONN", "state": "UNCONN",
- `"recv_q"` - "0", "recv_q": "0",
- `"send_q"` - "0", "send_q": "0",
- `"peer_address"` - "*", "peer_address": "*",
- `"pid"` - "893", "pid": "893",
- `"channel"` - "rtnl:systemd-resolve" "channel": "rtnl:systemd-resolve"
}, },
... ...
{ {
- `"netid"` - "p_raw", "netid": "p_raw",
- `"state"` - "UNCONN", "state": "UNCONN",
- `"recv_q"` - "0", "recv_q": "0",
- `"send_q"` - "0", "send_q": "0",
- `"peer_address"` - "*", "peer_address": "*",
- `"link_layer"` - "LLDP", "link_layer": "LLDP",
- `"interface"` - "ens33" "interface": "ens33"
}, },
{ {
- `"netid"` - "u_dgr", "netid": "u_dgr",
- `"state"` - "UNCONN", "state": "UNCONN",
- `"recv_q"` - "0", "recv_q": "0",
- `"send_q"` - "0", "send_q": "0",
- `"local_port"` - "93066", "local_port": "93066",
- `"peer_address"` - "*", "peer_address": "*",
- `"peer_port"` - "0", "peer_port": "0",
- `"path"` - "/run/user/1000/systemd/notify" "path": "/run/user/1000/systemd/notify"
}, },
{ {
- `"netid"` - "u_seq", "netid": "u_seq",
- `"state"` - "LISTEN", "state": "LISTEN",
- `"recv_q"` - "0", "recv_q": "0",
- `"send_q"` - "128", "send_q": "128",
- `"local_port"` - "20699", "local_port": "20699",
- `"peer_address"` - "*", "peer_address": "*",
- `"peer_port"` - "0", "peer_port": "0",
- `"path"` - "/run/udev/control" "path": "/run/udev/control"
}, },
... ...
{ {
- `"netid"` - "icmp6", "netid": "icmp6",
- `"state"` - "UNCONN", "state": "UNCONN",
- `"recv_q"` - "0", "recv_q": "0",
- `"send_q"` - "0", "send_q": "0",
- `"local_address"` - "*", "local_address": "*",
- `"local_port"` - "ipv6-icmp", "local_port": "ipv6-icmp",
- `"peer_address"` - "*", "peer_address": "*",
- `"peer_port"` - "*", "peer_port": "*",
- `"interface"` - "ens33" "interface": "ens33"
}, },
{ {
- `"netid"` - "udp", "netid": "udp",
- `"state"` - "UNCONN", "state": "UNCONN",
- `"recv_q"` - "0", "recv_q": "0",
- `"send_q"` - "0", "send_q": "0",
- `"local_address"` - "127.0.0.53", "local_address": "127.0.0.53",
- `"local_port"` - "domain", "local_port": "domain",
- `"peer_address"` - "0.0.0.0", "peer_address": "0.0.0.0",
- `"peer_port"` - "*", "peer_port": "*",
- `"interface"` - "lo" "interface": "lo"
}, },
{ {
- `"netid"` - "tcp", "netid": "tcp",
- `"state"` - "LISTEN", "state": "LISTEN",
- `"recv_q"` - "0", "recv_q": "0",
- `"send_q"` - "128", "send_q": "128",
- `"local_address"` - "127.0.0.53", "local_address": "127.0.0.53",
- `"local_port"` - "domain", "local_port": "domain",
- `"peer_address"` - "0.0.0.0", "peer_address": "0.0.0.0",
- `"peer_port"` - "*", "peer_port": "*",
- `"interface"` - "lo" "interface": "lo"
}, },
{ {
- `"netid"` - "tcp", "netid": "tcp",
- `"state"` - "LISTEN", "state": "LISTEN",
- `"recv_q"` - "0", "recv_q": "0",
- `"send_q"` - "128", "send_q": "128",
- `"local_address"` - "0.0.0.0", "local_address": "0.0.0.0",
- `"local_port"` - "ssh", "local_port": "ssh",
- `"peer_address"` - "0.0.0.0", "peer_address": "0.0.0.0",
- `"peer_port"` - "*" "peer_port": "*"
}, },
{ {
- `"netid"` - "tcp", "netid": "tcp",
- `"state"` - "LISTEN", "state": "LISTEN",
- `"recv_q"` - "0", "recv_q": "0",
- `"send_q"` - "128", "send_q": "128",
- `"local_address"` - "[::]", "local_address": "[::]",
- `"local_port"` - "ssh", "local_port": "ssh",
- `"peer_address"` - "[::]", "peer_address": "[::]",
- `"peer_port"` - "*" "peer_port": "*"
}, },
{ {
- `"netid"` - "v_str", "netid": "v_str",
- `"state"` - "ESTAB", "state": "ESTAB",
- `"recv_q"` - "0", "recv_q": "0",
- `"send_q"` - "0", "send_q": "0",
- `"local_address"` - "999900439", "local_address": "999900439",
- `"local_port"` - "1023", "local_port": "1023",
- `"peer_address"` - "0", "peer_address": "0",
- `"peer_port"` - "976" "peer_port": "976"
} }
] ]
@ -306,16 +305,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -67,66 +67,65 @@ Schema:
} }
] ]
**Examples**: Examples:
$ stat /bin/* | jc --stat -p $ stat /bin/* | jc --stat -p
[ [
{ {
- `"file"` - "/bin/bash", "file": "/bin/bash",
- `"size"` - 1113504, "size": 1113504,
- `"blocks"` - 2176, "blocks": 2176,
- `"io_blocks"` - 4096, "io_blocks": 4096,
- `"type"` - "regular file", "type": "regular file",
- `"device"` - "802h/2050d", "device": "802h/2050d",
- `"inode"` - 131099, "inode": 131099,
- `"links"` - 1, "links": 1,
- `"access"` - "0755", "access": "0755",
- `"flags"` - "-rwxr-xr-x", "flags": "-rwxr-xr-x",
- `"uid"` - 0, "uid": 0,
- `"user"` - "root", "user": "root",
- `"gid"` - 0, "gid": 0,
- `"group"` - "root", "group": "root",
- `"access_time"` - "2019-11-14 08:18:03.509681766 +0000", "access_time": "2019-11-14 08:18:03.509681766 +0000",
- `"modify_time"` - "2019-06-06 22:28:15.000000000 +0000", "modify_time": "2019-06-06 22:28:15.000000000 +0000",
- `"change_time"` - "2019-08-12 17:21:29.521945390 +0000", "change_time": "2019-08-12 17:21:29.521945390 +0000",
- `"birth_time"` - null, "birth_time": null,
- `"access_time_epoch"` - 1573748283, "access_time_epoch": 1573748283,
- `"access_time_epoch_utc"` - 1573719483, "access_time_epoch_utc": 1573719483,
- `"modify_time_epoch"` - 1559885295, "modify_time_epoch": 1559885295,
- `"modify_time_epoch_utc"` - 1559860095, "modify_time_epoch_utc": 1559860095,
- `"change_time_epoch"` - 1565655689, "change_time_epoch": 1565655689,
- `"change_time_epoch_utc"` - 1565630489, "change_time_epoch_utc": 1565630489,
- `"birth_time_epoch"` - null, "birth_time_epoch": null,
- `"birth_time_epoch_utc"` - null "birth_time_epoch_utc": null
}, },
{ {
- `"file"` - "/bin/btrfs", "file": "/bin/btrfs",
- `"size"` - 716464, "size": 716464,
- `"blocks"` - 1400, "blocks": 1400,
- `"io_blocks"` - 4096, "io_blocks": 4096,
- `"type"` - "regular file", "type": "regular file",
- `"device"` - "802h/2050d", "device": "802h/2050d",
- `"inode"` - 131100, "inode": 131100,
- `"links"` - 1, "links": 1,
- `"access"` - "0755", "access": "0755",
- `"flags"` - "-rwxr-xr-x", "flags": "-rwxr-xr-x",
- `"uid"` - 0, "uid": 0,
- `"user"` - "root", "user": "root",
- `"gid"` - 0, "gid": 0,
- `"group"` - "root", "group": "root",
- `"access_time"` - "2019-11-14 08:18:28.990834276 +0000", "access_time": "2019-11-14 08:18:28.990834276 +0000",
- `"modify_time"` - "2018-03-12 23:04:27.000000000 +0000", "modify_time": "2018-03-12 23:04:27.000000000 +0000",
- `"change_time"` - "2019-08-12 17:21:29.545944399 +0000", "change_time": "2019-08-12 17:21:29.545944399 +0000",
- `"birth_time"` - null, "birth_time": null,
- `"access_time_epoch"` - 1573748308, "access_time_epoch": 1573748308,
- `"access_time_epoch_utc"` - 1573719508, "access_time_epoch_utc": 1573719508,
- `"modify_time_epoch"` - 1520921067, "modify_time_epoch": 1520921067,
- `"modify_time_epoch_utc"` - 1520895867, "modify_time_epoch_utc": 1520895867,
- `"change_time_epoch"` - 1565655689, "change_time_epoch": 1565655689,
- `"change_time_epoch_utc"` - 1565630489, "change_time_epoch_utc": 1565630489,
- `"birth_time_epoch"` - null, "birth_time_epoch": null,
- `"birth_time_epoch_utc"` - null "birth_time_epoch_utc": null
}, },
... ...
] ]
@ -134,44 +133,44 @@ Schema:
$ stat /bin/* | jc --stat -p -r $ stat /bin/* | jc --stat -p -r
[ [
{ {
- `"file"` - "/bin/bash", "file": "/bin/bash",
- `"size"` - "1113504", "size": "1113504",
- `"blocks"` - "2176", "blocks": "2176",
- `"io_blocks"` - "4096", "io_blocks": "4096",
- `"type"` - "regular file", "type": "regular file",
- `"device"` - "802h/2050d", "device": "802h/2050d",
- `"inode"` - "131099", "inode": "131099",
- `"links"` - "1", "links": "1",
- `"access"` - "0755", "access": "0755",
- `"flags"` - "-rwxr-xr-x", "flags": "-rwxr-xr-x",
- `"uid"` - "0", "uid": "0",
- `"user"` - "root", "user": "root",
- `"gid"` - "0", "gid": "0",
- `"group"` - "root", "group": "root",
- `"access_time"` - "2019-11-14 08:18:03.509681766 +0000", "access_time": "2019-11-14 08:18:03.509681766 +0000",
- `"modify_time"` - "2019-06-06 22:28:15.000000000 +0000", "modify_time": "2019-06-06 22:28:15.000000000 +0000",
- `"change_time"` - "2019-08-12 17:21:29.521945390 +0000", "change_time": "2019-08-12 17:21:29.521945390 +0000",
- `"birth_time"` - null "birth_time": null
}, },
{ {
- `"file"` - "/bin/btrfs", "file": "/bin/btrfs",
- `"size"` - "716464", "size": "716464",
- `"blocks"` - "1400", "blocks": "1400",
- `"io_blocks"` - "4096", "io_blocks": "4096",
- `"type"` - "regular file", "type": "regular file",
- `"device"` - "802h/2050d", "device": "802h/2050d",
- `"inode"` - "131100", "inode": "131100",
- `"links"` - "1", "links": "1",
- `"access"` - "0755", "access": "0755",
- `"flags"` - "-rwxr-xr-x", "flags": "-rwxr-xr-x",
- `"uid"` - "0", "uid": "0",
- `"user"` - "root", "user": "root",
- `"gid"` - "0", "gid": "0",
- `"group"` - "root", "group": "root",
- `"access_time"` - "2019-11-14 08:18:28.990834276 +0000", "access_time": "2019-11-14 08:18:28.990834276 +0000",
- `"modify_time"` - "2018-03-12 23:04:27.000000000 +0000", "modify_time": "2018-03-12 23:04:27.000000000 +0000",
- `"change_time"` - "2019-08-12 17:21:29.545944399 +0000", "change_time": "2019-08-12 17:21:29.545944399 +0000",
- `"birth_time"` - null "birth_time": null
}, },
... ...
] ]
@ -196,16 +195,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -78,8 +78,7 @@ Schema:
} }
} }
**Examples**: Examples:
$ stat | jc --stat-s $ stat | jc --stat-s
{"file":"(stdin)","unix_device":1027739696,"inode":1155,"flags":"cr...} {"file":"(stdin)","unix_device":1027739696,"inode":1155,"flags":"cr...}
@ -107,25 +106,20 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False)
Main text parsing generator function. Returns an iterator object. Main text parsing generator function. Returns an iterator object.
**Arguments**: Parameters:
data: (iterable) line-based text data to parse
- `data` - (iterable) line-based text data to parse
(e.g. sys.stdin or str.splitlines()) (e.g. sys.stdin or str.splitlines())
- `raw` - (boolean) unprocessed output if True raw: (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True quiet: (boolean) suppress warning messages if True
- `ignore_exceptions` - (boolean) ignore parsing exceptions if True ignore_exceptions: (boolean) ignore parsing exceptions if True
**Yields**:
Yields:
Dictionary. Raw or processed structured data. Dictionary. Raw or processed structured data.
Returns:
**Returns**:
Iterator object Iterator object

View File

@ -36,30 +36,29 @@ Schema:
"key3": string/integer/float "key3": string/integer/float
} }
**Examples**: Examples:
$ sysctl -a | jc --sysctl -p $ sysctl -a | jc --sysctl -p
{ {
- `"user.cs_path"` - "/usr/bin:/bin:/usr/sbin:/sbin", "user.cs_path": "/usr/bin:/bin:/usr/sbin:/sbin",
- `"user.bc_base_max"` - 99, "user.bc_base_max": 99,
- `"user.bc_dim_max"` - 2048, "user.bc_dim_max": 2048,
- `"user.bc_scale_max"` - 99, "user.bc_scale_max": 99,
- `"user.bc_string_max"` - 1000, "user.bc_string_max": 1000,
- `"user.coll_weights_max"` - 2, "user.coll_weights_max": 2,
- `"user.expr_nest_max"` - 32 "user.expr_nest_max": 32
... ...
} }
$ sysctl -a | jc --sysctl -p -r $ sysctl -a | jc --sysctl -p -r
{ {
- `"user.cs_path"` - "/usr/bin:/bin:/usr/sbin:/sbin", "user.cs_path": "/usr/bin:/bin:/usr/sbin:/sbin",
- `"user.bc_base_max"` - "99", "user.bc_base_max": "99",
- `"user.bc_dim_max"` - "2048", "user.bc_dim_max": "2048",
- `"user.bc_scale_max"` - "99", "user.bc_scale_max": "99",
- `"user.bc_string_max"` - "1000", "user.bc_string_max": "1000",
- `"user.coll_weights_max"` - "2", "user.coll_weights_max": "2",
- `"user.expr_nest_max"` - "32", "user.expr_nest_max": "32",
... ...
} }
@ -83,16 +82,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
Dictionary. Raw or processed structured data. Dictionary. Raw or processed structured data.

View File

@ -35,31 +35,30 @@ Schema:
} }
] ]
**Examples**: Examples:
$ systemctl -a | jc --systemctl -p $ systemctl -a | jc --systemctl -p
[ [
{ {
- `"unit"` - "proc-sys-fs-binfmt_misc.automount", "unit": "proc-sys-fs-binfmt_misc.automount",
- `"load"` - "loaded", "load": "loaded",
- `"active"` - "active", "active": "active",
- `"sub"` - "waiting", "sub": "waiting",
- `"description"` - "Arbitrary Executable File Formats File System ..." "description": "Arbitrary Executable File Formats File System ..."
}, },
{ {
- `"unit"` - "dev-block-8:2.device", "unit": "dev-block-8:2.device",
- `"load"` - "loaded", "load": "loaded",
- `"active"` - "active", "active": "active",
- `"sub"` - "plugged", "sub": "plugged",
- `"description"` - "LVM PV 3klkIj-w1qk-DkJi-0XBJ-y3o7-i2Ac-vHqWBM o..." "description": "LVM PV 3klkIj-w1qk-DkJi-0XBJ-y3o7-i2Ac-vHqWBM o..."
}, },
{ {
- `"unit"` - "dev-cdrom.device", "unit": "dev-cdrom.device",
- `"load"` - "loaded", "load": "loaded",
- `"active"` - "active", "active": "active",
- `"sub"` - "plugged", "sub": "plugged",
- `"description"` - "VMware_Virtual_IDE_CDROM_Drive" "description": "VMware_Virtual_IDE_CDROM_Drive"
}, },
... ...
] ]
@ -84,16 +83,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -34,50 +34,49 @@ Schema:
} }
] ]
**Examples**: Examples:
$ systemctl list-jobs| jc --systemctl-lj -p $ systemctl list-jobs| jc --systemctl-lj -p
[ [
{ {
- `"job"` - 3543, "job": 3543,
- `"unit"` - "nginxAfterGlusterfs.service", "unit": "nginxAfterGlusterfs.service",
- `"type"` - "start", "type": "start",
- `"state"` - "waiting" "state": "waiting"
}, },
{ {
- `"job"` - 3545, "job": 3545,
- `"unit"` - "glusterReadyForLocalhostMount.service", "unit": "glusterReadyForLocalhostMount.service",
- `"type"` - "start", "type": "start",
- `"state"` - "running" "state": "running"
}, },
{ {
- `"job"` - 3506, "job": 3506,
- `"unit"` - "nginx.service", "unit": "nginx.service",
- `"type"` - "start", "type": "start",
- `"state"` - "waiting" "state": "waiting"
} }
] ]
$ systemctl list-jobs| jc --systemctl-lj -p -r $ systemctl list-jobs| jc --systemctl-lj -p -r
[ [
{ {
- `"job"` - "3543", "job": "3543",
- `"unit"` - "nginxAfterGlusterfs.service", "unit": "nginxAfterGlusterfs.service",
- `"type"` - "start", "type": "start",
- `"state"` - "waiting" "state": "waiting"
}, },
{ {
- `"job"` - "3545", "job": "3545",
- `"unit"` - "glusterReadyForLocalhostMount.service", "unit": "glusterReadyForLocalhostMount.service",
- `"type"` - "start", "type": "start",
- `"state"` - "running" "state": "running"
}, },
{ {
- `"job"` - "3506", "job": "3506",
- `"unit"` - "nginx.service", "unit": "nginx.service",
- `"type"` - "start", "type": "start",
- `"state"` - "waiting" "state": "waiting"
} }
] ]
@ -101,16 +100,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -34,25 +34,24 @@ Schema:
} }
] ]
**Examples**: Examples:
$ systemctl list-sockets | jc --systemctl-ls -p $ systemctl list-sockets | jc --systemctl-ls -p
[ [
{ {
- `"listen"` - "/dev/log", "listen": "/dev/log",
- `"unit"` - "systemd-journald.socket", "unit": "systemd-journald.socket",
- `"activates"` - "systemd-journald.service" "activates": "systemd-journald.service"
}, },
{ {
- `"listen"` - "/run/dbus/system_bus_socket", "listen": "/run/dbus/system_bus_socket",
- `"unit"` - "dbus.socket", "unit": "dbus.socket",
- `"activates"` - "dbus.service" "activates": "dbus.service"
}, },
{ {
- `"listen"` - "/run/dmeventd-client", "listen": "/run/dmeventd-client",
- `"unit"` - "dm-event.socket", "unit": "dm-event.socket",
- `"activates"` - "dm-event.service" "activates": "dm-event.service"
}, },
... ...
] ]
@ -77,16 +76,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -33,22 +33,21 @@ Schema:
} }
] ]
**Examples**: Examples:
$ systemctl list-unit-files | jc --systemctl-luf -p $ systemctl list-unit-files | jc --systemctl-luf -p
[ [
{ {
- `"unit_file"` - "proc-sys-fs-binfmt_misc.automount", "unit_file": "proc-sys-fs-binfmt_misc.automount",
- `"state"` - "static" "state": "static"
}, },
{ {
- `"unit_file"` - "dev-hugepages.mount", "unit_file": "dev-hugepages.mount",
- `"state"` - "static" "state": "static"
}, },
{ {
- `"unit_file"` - "dev-mqueue.mount", "unit_file": "dev-mqueue.mount",
- `"state"` - "static" "state": "static"
}, },
... ...
] ]
@ -73,16 +72,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -94,126 +94,125 @@ string
[0] naive timestamp [0] naive timestamp
[1] timezone-aware timestamp [1] timezone-aware timestamp
**Examples**: Examples:
$ systeminfo | jc --systeminfo -p $ systeminfo | jc --systeminfo -p
{ {
- `"host_name"` - "TESTLAPTOP", "host_name": "TESTLAPTOP",
- `"os_name"` - "Microsoft Windows 10 Enterprise", "os_name": "Microsoft Windows 10 Enterprise",
- `"os_version"` - "10.0.17134 N/A Build 17134", "os_version": "10.0.17134 N/A Build 17134",
- `"os_manufacturer"` - "Microsoft Corporation", "os_manufacturer": "Microsoft Corporation",
- `"os_configuration"` - "Member Workstation", "os_configuration": "Member Workstation",
- `"os_build_type"` - "Multiprocessor Free", "os_build_type": "Multiprocessor Free",
- `"registered_owner"` - "Test, Inc.", "registered_owner": "Test, Inc.",
- `"registered_organization"` - "Test, Inc.", "registered_organization": "Test, Inc.",
- `"product_id"` - "11111-11111-11111-AA111", "product_id": "11111-11111-11111-AA111",
- `"original_install_date"` - "3/26/2019, 3:51:30 PM", "original_install_date": "3/26/2019, 3:51:30 PM",
- `"system_boot_time"` - "3/30/2021, 6:13:59 AM", "system_boot_time": "3/30/2021, 6:13:59 AM",
- `"system_manufacturer"` - "Dell Inc.", "system_manufacturer": "Dell Inc.",
- `"system_model"` - "Precision 5530", "system_model": "Precision 5530",
- `"system_type"` - "x64-based PC", "system_type": "x64-based PC",
- `"processors"` - [ "processors": [
"Intel64 Family 6 Model 158 Stepping 10 GenuineIntel ~2592 Mhz" "Intel64 Family 6 Model 158 Stepping 10 GenuineIntel ~2592 Mhz"
], ],
- `"bios_version"` - "Dell Inc. 1.16.2, 4/21/2020", "bios_version": "Dell Inc. 1.16.2, 4/21/2020",
- `"windows_directory"` - "C:\\WINDOWS", "windows_directory": "C:\\WINDOWS",
- `"system_directory"` - "C:\\WINDOWS\\system32", "system_directory": "C:\\WINDOWS\\system32",
- `"boot_device"` - "\\Device\\HarddiskVolume2", "boot_device": "\\Device\\HarddiskVolume2",
- `"system_locale"` - "en-us;English (United States)", "system_locale": "en-us;English (United States)",
- `"input_locale"` - "en-us;English (United States)", "input_locale": "en-us;English (United States)",
- `"time_zone"` - "(UTC+00:00) UTC", "time_zone": "(UTC+00:00) UTC",
- `"total_physical_memory_mb"` - 32503, "total_physical_memory_mb": 32503,
- `"available_physical_memory_mb"` - 19743, "available_physical_memory_mb": 19743,
- `"virtual_memory_max_size_mb"` - 37367, "virtual_memory_max_size_mb": 37367,
- `"virtual_memory_available_mb"` - 22266, "virtual_memory_available_mb": 22266,
- `"virtual_memory_in_use_mb"` - 15101, "virtual_memory_in_use_mb": 15101,
- `"page_file_locations"` - "C:\\pagefile.sys", "page_file_locations": "C:\\pagefile.sys",
- `"domain"` - "test.com", "domain": "test.com",
- `"logon_server"` - "\\\\TESTDC01", "logon_server": "\\\\TESTDC01",
- `"hotfixs"` - [ "hotfixs": [
"KB2693643", "KB2693643",
"KB4601054" "KB4601054"
], ],
- `"network_cards"` - [ "network_cards": [
{ {
- `"name"` - "Intel(R) Wireless-AC 9260 160MHz", "name": "Intel(R) Wireless-AC 9260 160MHz",
- `"connection_name"` - "Wi-Fi", "connection_name": "Wi-Fi",
- `"status"` - null, "status": null,
- `"dhcp_enabled"` - true, "dhcp_enabled": true,
- `"dhcp_server"` - "192.168.2.1", "dhcp_server": "192.168.2.1",
- `"ip_addresses"` - [ "ip_addresses": [
"192.168.2.219" "192.168.2.219"
] ]
} }
], ],
- `"hyperv_requirements"` - { "hyperv_requirements": {
- `"vm_monitor_mode_extensions"` - true, "vm_monitor_mode_extensions": true,
- `"virtualization_enabled_in_firmware"` - true, "virtualization_enabled_in_firmware": true,
- `"second_level_address_translation"` - false, "second_level_address_translation": false,
- `"data_execution_prevention_available"` - true "data_execution_prevention_available": true
}, },
- `"original_install_date_epoch"` - 1553640690, "original_install_date_epoch": 1553640690,
- `"original_install_date_epoch_utc"` - 1553615490, "original_install_date_epoch_utc": 1553615490,
- `"system_boot_time_epoch"` - 1617110039, "system_boot_time_epoch": 1617110039,
- `"system_boot_time_epoch_utc"` - 1617084839 "system_boot_time_epoch_utc": 1617084839
} }
$ systeminfo | jc --systeminfo -p -r $ systeminfo | jc --systeminfo -p -r
{ {
- `"host_name"` - "TESTLAPTOP", "host_name": "TESTLAPTOP",
- `"os_name"` - "Microsoft Windows 10 Enterprise", "os_name": "Microsoft Windows 10 Enterprise",
- `"os_version"` - "10.0.17134 N/A Build 17134", "os_version": "10.0.17134 N/A Build 17134",
- `"os_manufacturer"` - "Microsoft Corporation", "os_manufacturer": "Microsoft Corporation",
- `"os_configuration"` - "Member Workstation", "os_configuration": "Member Workstation",
- `"os_build_type"` - "Multiprocessor Free", "os_build_type": "Multiprocessor Free",
- `"registered_owner"` - "Test, Inc.", "registered_owner": "Test, Inc.",
- `"registered_organization"` - "Test, Inc.", "registered_organization": "Test, Inc.",
- `"product_id"` - "11111-11111-11111-AA111", "product_id": "11111-11111-11111-AA111",
- `"original_install_date"` - "3/26/2019, 3:51:30 PM", "original_install_date": "3/26/2019, 3:51:30 PM",
- `"system_boot_time"` - "3/30/2021, 6:13:59 AM", "system_boot_time": "3/30/2021, 6:13:59 AM",
- `"system_manufacturer"` - "Dell Inc.", "system_manufacturer": "Dell Inc.",
- `"system_model"` - "Precision 5530", "system_model": "Precision 5530",
- `"system_type"` - "x64-based PC", "system_type": "x64-based PC",
- `"processors"` - [ "processors": [
"Intel64 Family 6 Model 158 Stepping 10 GenuineIntel ~2592 Mhz" "Intel64 Family 6 Model 158 Stepping 10 GenuineIntel ~2592 Mhz"
], ],
- `"bios_version"` - "Dell Inc. 1.16.2, 4/21/2020", "bios_version": "Dell Inc. 1.16.2, 4/21/2020",
- `"windows_directory"` - "C:\\WINDOWS", "windows_directory": "C:\\WINDOWS",
- `"system_directory"` - "C:\\WINDOWS\\system32", "system_directory": "C:\\WINDOWS\\system32",
- `"boot_device"` - "\\Device\\HarddiskVolume2", "boot_device": "\\Device\\HarddiskVolume2",
- `"system_locale"` - "en-us;English (United States)", "system_locale": "en-us;English (United States)",
- `"input_locale"` - "en-us;English (United States)", "input_locale": "en-us;English (United States)",
- `"time_zone"` - "(UTC+00:00) UTC", "time_zone": "(UTC+00:00) UTC",
- `"total_physical_memory_mb"` - "32,503 MB", "total_physical_memory_mb": "32,503 MB",
- `"available_physical_memory_mb"` - "19,743 MB", "available_physical_memory_mb": "19,743 MB",
- `"virtual_memory_max_size_mb"` - "37,367 MB", "virtual_memory_max_size_mb": "37,367 MB",
- `"virtual_memory_available_mb"` - "22,266 MB", "virtual_memory_available_mb": "22,266 MB",
- `"virtual_memory_in_use_mb"` - "15,101 MB", "virtual_memory_in_use_mb": "15,101 MB",
- `"page_file_locations"` - "C:\\pagefile.sys", "page_file_locations": "C:\\pagefile.sys",
- `"domain"` - "test.com", "domain": "test.com",
- `"logon_server"` - "\\\\TESTDC01", "logon_server": "\\\\TESTDC01",
- `"hotfixs"` - [ "hotfixs": [
"KB2693643", "KB2693643",
"KB4601054" "KB4601054"
], ],
- `"network_cards"` - [ "network_cards": [
{ {
- `"name"` - "Intel(R) Wireless-AC 9260 160MHz", "name": "Intel(R) Wireless-AC 9260 160MHz",
- `"connection_name"` - "Wi-Fi", "connection_name": "Wi-Fi",
- `"status"` - "", "status": "",
- `"dhcp_enabled"` - "Yes", "dhcp_enabled": "Yes",
- `"dhcp_server"` - "192.168.2.1", "dhcp_server": "192.168.2.1",
- `"ip_addresses"` - [ "ip_addresses": [
"192.168.2.219" "192.168.2.219"
] ]
} }
], ],
- `"hyperv_requirements"` - { "hyperv_requirements": {
- `"vm_monitor_mode_extensions"` - "Yes", "vm_monitor_mode_extensions": "Yes",
- `"virtualization_enabled_in_firmware"` - "Yes", "virtualization_enabled_in_firmware": "Yes",
- `"second_level_address_translation"` - "No", "second_level_address_translation": "No",
- `"data_execution_prevention_available"` - "Yes" "data_execution_prevention_available": "Yes"
} }
} }
@ -237,16 +236,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -74,68 +74,67 @@ https://man7.org/linux/man-pages/man1/time.1.html
[0] aka File system inputs [0] aka File system inputs
[1] aka File system outputs [1] aka File system outputs
**Examples**: Examples:
$ /usr/bin/time --verbose -o timefile.out sleep 2; cat timefile.out | \\ $ /usr/bin/time --verbose -o timefile.out sleep 2; cat timefile.out | \\
jc --time -p jc --time -p
{ {
- `"command_being_timed"` - "sleep 2", "command_being_timed": "sleep 2",
- `"user_time"` - 0.0, "user_time": 0.0,
- `"system_time"` - 0.0, "system_time": 0.0,
- `"cpu_percent"` - 0, "cpu_percent": 0,
- `"elapsed_time"` - "0:02.00", "elapsed_time": "0:02.00",
- `"average_shared_text_size"` - 0, "average_shared_text_size": 0,
- `"average_unshared_data_size"` - 0, "average_unshared_data_size": 0,
- `"average_stack_size"` - 0, "average_stack_size": 0,
- `"average_total_size"` - 0, "average_total_size": 0,
- `"maximum_resident_set_size"` - 2084, "maximum_resident_set_size": 2084,
- `"average_resident_set_size"` - 0, "average_resident_set_size": 0,
- `"major_pagefaults"` - 0, "major_pagefaults": 0,
- `"minor_pagefaults"` - 72, "minor_pagefaults": 72,
- `"voluntary_context_switches"` - 2, "voluntary_context_switches": 2,
- `"involuntary_context_switches"` - 1, "involuntary_context_switches": 1,
- `"swaps"` - 0, "swaps": 0,
- `"block_input_operations"` - 0, "block_input_operations": 0,
- `"block_output_operations"` - 0, "block_output_operations": 0,
- `"messages_sent"` - 0, "messages_sent": 0,
- `"messages_received"` - 0, "messages_received": 0,
- `"signals_delivered"` - 0, "signals_delivered": 0,
- `"page_size"` - 4096, "page_size": 4096,
- `"exit_status"` - 0, "exit_status": 0,
- `"elapsed_time_hours"` - 0, "elapsed_time_hours": 0,
- `"elapsed_time_minutes"` - 0, "elapsed_time_minutes": 0,
- `"elapsed_time_seconds"` - 2, "elapsed_time_seconds": 2,
- `"elapsed_time_centiseconds"` - 50, "elapsed_time_centiseconds": 50,
- `"elapsed_time_total_seconds"` - 2.5 "elapsed_time_total_seconds": 2.5
} }
$ /usr/bin/time --verbose -o timefile.out sleep 2; cat timefile.out | \\ $ /usr/bin/time --verbose -o timefile.out sleep 2; cat timefile.out | \\
jc --time -p -r jc --time -p -r
{ {
- `"command_being_timed"` - "\"sleep 2\"", "command_being_timed": "\"sleep 2\"",
- `"user_time"` - "0.00", "user_time": "0.00",
- `"system_time"` - "0.00", "system_time": "0.00",
- `"cpu_percent"` - "0", "cpu_percent": "0",
- `"elapsed_time"` - "0:02.00", "elapsed_time": "0:02.00",
- `"average_shared_text_size"` - "0", "average_shared_text_size": "0",
- `"average_unshared_data_size"` - "0", "average_unshared_data_size": "0",
- `"average_stack_size"` - "0", "average_stack_size": "0",
- `"average_total_size"` - "0", "average_total_size": "0",
- `"maximum_resident_set_size"` - "2084", "maximum_resident_set_size": "2084",
- `"average_resident_set_size"` - "0", "average_resident_set_size": "0",
- `"major_pagefaults"` - "0", "major_pagefaults": "0",
- `"minor_pagefaults"` - "72", "minor_pagefaults": "72",
- `"voluntary_context_switches"` - "2", "voluntary_context_switches": "2",
- `"involuntary_context_switches"` - "0", "involuntary_context_switches": "0",
- `"swaps"` - "0", "swaps": "0",
- `"block_input_operations"` - "0", "block_input_operations": "0",
- `"block_output_operations"` - "0", "block_output_operations": "0",
- `"messages_sent"` - "0", "messages_sent": "0",
- `"messages_received"` - "0", "messages_received": "0",
- `"signals_delivered"` - "0", "signals_delivered": "0",
- `"page_size"` - "4096", "page_size": "4096",
- `"exit_status"` - "0" "exit_status": "0"
} }
<a id="jc.parsers.time.info"></a> <a id="jc.parsers.time.info"></a>
@ -158,16 +157,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
Dictionary. Raw or processed structured data. Dictionary. Raw or processed structured data.

View File

@ -42,32 +42,31 @@ Schema:
"dst_active": boolean "dst_active": boolean
} }
**Examples**: Examples:
$ timedatectl | jc --timedatectl -p $ timedatectl | jc --timedatectl -p
{ {
- `"local_time"` - "Tue 2020-03-10 17:53:21 PDT", "local_time": "Tue 2020-03-10 17:53:21 PDT",
- `"universal_time"` - "Wed 2020-03-11 00:53:21 UTC", "universal_time": "Wed 2020-03-11 00:53:21 UTC",
- `"rtc_time"` - "Wed 2020-03-11 00:53:21", "rtc_time": "Wed 2020-03-11 00:53:21",
- `"time_zone"` - "America/Los_Angeles (PDT, -0700)", "time_zone": "America/Los_Angeles (PDT, -0700)",
- `"ntp_enabled"` - true, "ntp_enabled": true,
- `"ntp_synchronized"` - true, "ntp_synchronized": true,
- `"rtc_in_local_tz"` - false, "rtc_in_local_tz": false,
- `"dst_active"` - true, "dst_active": true,
- `"epoch_utc"` - 1583888001 "epoch_utc": 1583888001
} }
$ timedatectl | jc --timedatectl -p -r $ timedatectl | jc --timedatectl -p -r
{ {
- `"local_time"` - "Tue 2020-03-10 17:53:21 PDT", "local_time": "Tue 2020-03-10 17:53:21 PDT",
- `"universal_time"` - "Wed 2020-03-11 00:53:21 UTC", "universal_time": "Wed 2020-03-11 00:53:21 UTC",
- `"rtc_time"` - "Wed 2020-03-11 00:53:21", "rtc_time": "Wed 2020-03-11 00:53:21",
- `"time_zone"` - "America/Los_Angeles (PDT, -0700)", "time_zone": "America/Los_Angeles (PDT, -0700)",
- `"ntp_enabled"` - "yes", "ntp_enabled": "yes",
- `"ntp_synchronized"` - "yes", "ntp_synchronized": "yes",
- `"rtc_in_local_tz"` - "no", "rtc_in_local_tz": "no",
- `"dst_active"` - "yes" "dst_active": "yes"
} }
<a id="jc.parsers.timedatectl.info"></a> <a id="jc.parsers.timedatectl.info"></a>
@ -90,16 +89,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
Dictionary. Raw or processed structured data. Dictionary. Raw or processed structured data.

View File

@ -44,95 +44,94 @@ Schema:
] ]
} }
**Examples**: Examples:
$ tracepath6 3ffe:2400:0:109::2 | jc --tracepath -p $ tracepath6 3ffe:2400:0:109::2 | jc --tracepath -p
{ {
- `"pmtu"` - 1480, "pmtu": 1480,
- `"forward_hops"` - 2, "forward_hops": 2,
- `"return_hops"` - 2, "return_hops": 2,
- `"hops"` - [ "hops": [
{ {
- `"ttl"` - 1, "ttl": 1,
- `"guess"` - true, "guess": true,
- `"host"` - "[LOCALHOST]", "host": "[LOCALHOST]",
- `"reply_ms"` - null, "reply_ms": null,
- `"pmtu"` - 1500, "pmtu": 1500,
- `"asymmetric_difference"` - null, "asymmetric_difference": null,
- `"reached"` - false "reached": false
}, },
{ {
- `"ttl"` - 1, "ttl": 1,
- `"guess"` - false, "guess": false,
- `"host"` - "dust.inr.ac.ru", "host": "dust.inr.ac.ru",
- `"reply_ms"` - 0.411, "reply_ms": 0.411,
- `"pmtu"` - null, "pmtu": null,
- `"asymmetric_difference"` - null, "asymmetric_difference": null,
- `"reached"` - false "reached": false
}, },
{ {
- `"ttl"` - 2, "ttl": 2,
- `"guess"` - false, "guess": false,
- `"host"` - "dust.inr.ac.ru", "host": "dust.inr.ac.ru",
- `"reply_ms"` - 0.39, "reply_ms": 0.39,
- `"pmtu"` - 1480, "pmtu": 1480,
- `"asymmetric_difference"` - 1, "asymmetric_difference": 1,
- `"reached"` - false "reached": false
}, },
{ {
- `"ttl"` - 2, "ttl": 2,
- `"guess"` - false, "guess": false,
- `"host"` - "3ffe:2400:0:109::2", "host": "3ffe:2400:0:109::2",
- `"reply_ms"` - 463.514, "reply_ms": 463.514,
- `"pmtu"` - null, "pmtu": null,
- `"asymmetric_difference"` - null, "asymmetric_difference": null,
- `"reached"` - true "reached": true
} }
] ]
} }
$ tracepath6 3ffe:2400:0:109::2 | jc --tracepath -p -r $ tracepath6 3ffe:2400:0:109::2 | jc --tracepath -p -r
{ {
- `"pmtu"` - "1480", "pmtu": "1480",
- `"forward_hops"` - "2", "forward_hops": "2",
- `"return_hops"` - "2", "return_hops": "2",
- `"hops"` - [ "hops": [
{ {
- `"ttl"` - "1", "ttl": "1",
- `"guess"` - true, "guess": true,
- `"host"` - "[LOCALHOST]", "host": "[LOCALHOST]",
- `"reply_ms"` - null, "reply_ms": null,
- `"pmtu"` - "1500", "pmtu": "1500",
- `"asymmetric_difference"` - null, "asymmetric_difference": null,
- `"reached"` - false "reached": false
}, },
{ {
- `"ttl"` - "1", "ttl": "1",
- `"guess"` - false, "guess": false,
- `"host"` - "dust.inr.ac.ru", "host": "dust.inr.ac.ru",
- `"reply_ms"` - "0.411", "reply_ms": "0.411",
- `"pmtu"` - null, "pmtu": null,
- `"asymmetric_difference"` - null, "asymmetric_difference": null,
- `"reached"` - false "reached": false
}, },
{ {
- `"ttl"` - "2", "ttl": "2",
- `"guess"` - false, "guess": false,
- `"host"` - "dust.inr.ac.ru", "host": "dust.inr.ac.ru",
- `"reply_ms"` - "0.390", "reply_ms": "0.390",
- `"pmtu"` - "1480", "pmtu": "1480",
- `"asymmetric_difference"` - "1", "asymmetric_difference": "1",
- `"reached"` - false "reached": false
}, },
{ {
- `"ttl"` - "2", "ttl": "2",
- `"guess"` - false, "guess": false,
- `"host"` - "3ffe:2400:0:109::2", "host": "3ffe:2400:0:109::2",
- `"reply_ms"` - "463.514", "reply_ms": "463.514",
- `"pmtu"` - null, "pmtu": null,
- `"asymmetric_difference"` - null, "asymmetric_difference": null,
- `"reached"` - true "reached": true
} }
] ]
} }
@ -157,16 +156,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
Dictionary. Raw or processed structured data. Dictionary. Raw or processed structured data.

View File

@ -53,37 +53,36 @@ Schema:
] ]
} }
**Examples**: Examples:
$ traceroute google.com | jc --traceroute -p $ traceroute google.com | jc --traceroute -p
{ {
- `"destination_ip"` - "216.58.194.46", "destination_ip": "216.58.194.46",
- `"destination_name"` - "google.com", "destination_name": "google.com",
- `"hops"` - [ "hops": [
{ {
- `"hop"` - 1, "hop": 1,
- `"probes"` - [ "probes": [
{ {
- `"annotation"` - null, "annotation": null,
- `"asn"` - null, "asn": null,
- `"ip"` - "216.230.231.141", "ip": "216.230.231.141",
- `"name"` - "216-230-231-141.static.houston.tx.oplink.net", "name": "216-230-231-141.static.houston.tx.oplink.net",
- `"rtt"` - 198.574 "rtt": 198.574
}, },
{ {
- `"annotation"` - null, "annotation": null,
- `"asn"` - null, "asn": null,
- `"ip"` - "216.230.231.141", "ip": "216.230.231.141",
- `"name"` - "216-230-231-141.static.houston.tx.oplink.net", "name": "216-230-231-141.static.houston.tx.oplink.net",
- `"rtt"` - null "rtt": null
}, },
{ {
- `"annotation"` - null, "annotation": null,
- `"asn"` - null, "asn": null,
- `"ip"` - "216.230.231.141", "ip": "216.230.231.141",
- `"name"` - "216-230-231-141.static.houston.tx.oplink.net", "name": "216-230-231-141.static.houston.tx.oplink.net",
- `"rtt"` - 198.65 "rtt": 198.65
} }
] ]
}, },
@ -93,32 +92,32 @@ Schema:
$ traceroute google.com | jc --traceroute -p -r $ traceroute google.com | jc --traceroute -p -r
{ {
- `"destination_ip"` - "216.58.194.46", "destination_ip": "216.58.194.46",
- `"destination_name"` - "google.com", "destination_name": "google.com",
- `"hops"` - [ "hops": [
{ {
- `"hop"` - "1", "hop": "1",
- `"probes"` - [ "probes": [
{ {
- `"annotation"` - null, "annotation": null,
- `"asn"` - null, "asn": null,
- `"ip"` - "216.230.231.141", "ip": "216.230.231.141",
- `"name"` - "216-230-231-141.static.houston.tx.oplink.net", "name": "216-230-231-141.static.houston.tx.oplink.net",
- `"rtt"` - "198.574" "rtt": "198.574"
}, },
{ {
- `"annotation"` - null, "annotation": null,
- `"asn"` - null, "asn": null,
- `"ip"` - "216.230.231.141", "ip": "216.230.231.141",
- `"name"` - "216-230-231-141.static.houston.tx.oplink.net", "name": "216-230-231-141.static.houston.tx.oplink.net",
- `"rtt"` - null "rtt": null
}, },
{ {
- `"annotation"` - null, "annotation": null,
- `"asn"` - null, "asn": null,
- `"ip"` - "216.230.231.141", "ip": "216.230.231.141",
- `"name"` - "216-230-231-141.static.houston.tx.oplink.net", "name": "216-230-231-141.static.houston.tx.oplink.net",
- `"rtt"` - "198.650" "rtt": "198.650"
} }
] ]
}, },
@ -194,16 +193,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
Dictionary. Raw or processed structured data. Dictionary. Raw or processed structured data.

View File

@ -73,69 +73,68 @@ integer
[0] null if any 'to' ports or port_ranges are set [0] null if any 'to' ports or port_ranges are set
[1] null if any 'from' ports or port_ranges are set [1] null if any 'from' ports or port_ranges are set
**Examples**: Examples:
$ ufw status verbose | jc --ufw -p $ ufw status verbose | jc --ufw -p
{ {
- `"status"` - "active", "status": "active",
- `"logging"` - "on", "logging": "on",
- `"logging_level"` - "low", "logging_level": "low",
- `"default"` - "deny (incoming), allow (outgoing), disabled (routed)", "default": "deny (incoming), allow (outgoing), disabled (routed)",
- `"new_profiles"` - "skip", "new_profiles": "skip",
- `"rules"` - [ "rules": [
{ {
- `"action"` - "ALLOW", "action": "ALLOW",
- `"action_direction"` - "IN", "action_direction": "IN",
- `"index"` - null, "index": null,
- `"network_protocol"` - "ipv4", "network_protocol": "ipv4",
- `"to_interface"` - "any", "to_interface": "any",
- `"to_transport"` - "any", "to_transport": "any",
- `"to_service"` - null, "to_service": null,
- `"to_ports"` - [ "to_ports": [
22 22
], ],
- `"to_ip"` - "0.0.0.0", "to_ip": "0.0.0.0",
- `"to_ip_prefix"` - 0, "to_ip_prefix": 0,
- `"comment"` - null, "comment": null,
- `"from_ip"` - "0.0.0.0", "from_ip": "0.0.0.0",
- `"from_ip_prefix"` - 0, "from_ip_prefix": 0,
- `"from_interface"` - "any", "from_interface": "any",
- `"from_transport"` - "any", "from_transport": "any",
- `"from_port_ranges"` - [ "from_port_ranges": [
{ {
- `"start"` - 0, "start": 0,
- `"end"` - 65535 "end": 65535
} }
], ],
- `"from_service"` - null "from_service": null
}, },
{ {
- `"action"` - "ALLOW", "action": "ALLOW",
- `"action_direction"` - "IN", "action_direction": "IN",
- `"index"` - null, "index": null,
- `"network_protocol"` - "ipv4", "network_protocol": "ipv4",
- `"to_interface"` - "any", "to_interface": "any",
- `"to_transport"` - "tcp", "to_transport": "tcp",
- `"to_service"` - null, "to_service": null,
- `"to_ports"` - [ "to_ports": [
80, 80,
443 443
], ],
- `"to_ip"` - "0.0.0.0", "to_ip": "0.0.0.0",
- `"to_ip_prefix"` - 0, "to_ip_prefix": 0,
- `"comment"` - null, "comment": null,
- `"from_ip"` - "0.0.0.0", "from_ip": "0.0.0.0",
- `"from_ip_prefix"` - 0, "from_ip_prefix": 0,
- `"from_interface"` - "any", "from_interface": "any",
- `"from_transport"` - "any", "from_transport": "any",
- `"from_port_ranges"` - [ "from_port_ranges": [
{ {
- `"start"` - 0, "start": 0,
- `"end"` - 65535 "end": 65535
} }
], ],
- `"from_service"` - null "from_service": null
}, },
... ...
] ]
@ -143,64 +142,64 @@ integer
$ ufw status verbose | jc --ufw -p -r $ ufw status verbose | jc --ufw -p -r
{ {
- `"status"` - "active", "status": "active",
- `"logging"` - "on", "logging": "on",
- `"logging_level"` - "low", "logging_level": "low",
- `"default"` - "deny (incoming), allow (outgoing), disabled (routed)", "default": "deny (incoming), allow (outgoing), disabled (routed)",
- `"new_profiles"` - "skip", "new_profiles": "skip",
- `"rules"` - [ "rules": [
{ {
- `"action"` - "ALLOW", "action": "ALLOW",
- `"action_direction"` - "IN", "action_direction": "IN",
- `"index"` - null, "index": null,
- `"network_protocol"` - "ipv4", "network_protocol": "ipv4",
- `"to_interface"` - "any", "to_interface": "any",
- `"to_transport"` - "any", "to_transport": "any",
- `"to_service"` - null, "to_service": null,
- `"to_ports"` - [ "to_ports": [
"22" "22"
], ],
- `"to_ip"` - "0.0.0.0", "to_ip": "0.0.0.0",
- `"to_ip_prefix"` - "0", "to_ip_prefix": "0",
- `"comment"` - null, "comment": null,
- `"from_ip"` - "0.0.0.0", "from_ip": "0.0.0.0",
- `"from_ip_prefix"` - "0", "from_ip_prefix": "0",
- `"from_interface"` - "any", "from_interface": "any",
- `"from_transport"` - "any", "from_transport": "any",
- `"from_port_ranges"` - [ "from_port_ranges": [
{ {
- `"start"` - "0", "start": "0",
- `"end"` - "65535" "end": "65535"
} }
], ],
- `"from_service"` - null "from_service": null
}, },
{ {
- `"action"` - "ALLOW", "action": "ALLOW",
- `"action_direction"` - "IN", "action_direction": "IN",
- `"index"` - null, "index": null,
- `"network_protocol"` - "ipv4", "network_protocol": "ipv4",
- `"to_interface"` - "any", "to_interface": "any",
- `"to_transport"` - "tcp", "to_transport": "tcp",
- `"to_service"` - null, "to_service": null,
- `"to_ports"` - [ "to_ports": [
"80", "80",
"443" "443"
], ],
- `"to_ip"` - "0.0.0.0", "to_ip": "0.0.0.0",
- `"to_ip_prefix"` - "0", "to_ip_prefix": "0",
- `"comment"` - null, "comment": null,
- `"from_ip"` - "0.0.0.0", "from_ip": "0.0.0.0",
- `"from_ip_prefix"` - "0", "from_ip_prefix": "0",
- `"from_interface"` - "any", "from_interface": "any",
- `"from_transport"` - "any", "from_transport": "any",
- `"from_port_ranges"` - [ "from_port_ranges": [
{ {
- `"start"` - "0", "start": "0",
- `"end"` - "65535" "end": "65535"
} }
], ],
- `"from_service"` - null "from_service": null
}, },
... ...
] ]
@ -226,16 +225,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
Dictionary. Raw or processed structured data. Dictionary. Raw or processed structured data.

View File

@ -81,40 +81,39 @@ integers # [1]
[1] duplicates and overlapping are removed [1] duplicates and overlapping are removed
[2] overlapping are merged [2] overlapping are merged
**Examples**: Examples:
$ ufw app info MSN | jc --ufw-appinfo -p $ ufw app info MSN | jc --ufw-appinfo -p
[ [
{ {
- `"profile"` - "MSN", "profile": "MSN",
- `"title"` - "MSN Chat", "title": "MSN Chat",
- `"description"` - "MSN chat protocol (with file transfer and voice)", "description": "MSN chat protocol (with file transfer and voice)",
- `"tcp_list"` - [ "tcp_list": [
1863, 1863,
6901 6901
], ],
- `"udp_list"` - [ "udp_list": [
1863, 1863,
6901 6901
], ],
- `"tcp_ranges"` - [ "tcp_ranges": [
{ {
- `"start"` - 6891, "start": 6891,
- `"end"` - 6900 "end": 6900
} }
], ],
- `"normalized_tcp_list"` - [ "normalized_tcp_list": [
1863, 1863,
6901 6901
], ],
- `"normalized_tcp_ranges"` - [ "normalized_tcp_ranges": [
{ {
- `"start"` - 6891, "start": 6891,
- `"end"` - 6900 "end": 6900
} }
], ],
- `"normalized_udp_list"` - [ "normalized_udp_list": [
1863, 1863,
6901 6901
] ]
@ -124,21 +123,21 @@ integers # [1]
$ ufw app info MSN | jc --ufw-appinfo -p -r $ ufw app info MSN | jc --ufw-appinfo -p -r
[ [
{ {
- `"profile"` - "MSN", "profile": "MSN",
- `"title"` - "MSN Chat", "title": "MSN Chat",
- `"description"` - "MSN chat protocol (with file transfer and voice)", "description": "MSN chat protocol (with file transfer and voice)",
- `"tcp_list"` - [ "tcp_list": [
"1863", "1863",
"6901" "6901"
], ],
- `"udp_list"` - [ "udp_list": [
"1863", "1863",
"6901" "6901"
], ],
- `"tcp_ranges"` - [ "tcp_ranges": [
{ {
- `"start"` - "6891", "start": "6891",
- `"end"` - "6900" "end": "6900"
} }
] ]
} }
@ -164,16 +163,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -38,19 +38,18 @@ Schema:
"kernel_version": string "kernel_version": string
} }
**Example**: Example:
$ uname -a | jc --uname -p $ uname -a | jc --uname -p
{ {
- `"kernel_name"` - "Linux", "kernel_name": "Linux",
- `"node_name"` - "user-ubuntu", "node_name": "user-ubuntu",
- `"kernel_release"` - "4.15.0-65-generic", "kernel_release": "4.15.0-65-generic",
- `"operating_system"` - "GNU/Linux", "operating_system": "GNU/Linux",
- `"hardware_platform"` - "x86_64", "hardware_platform": "x86_64",
- `"processor"` - "x86_64", "processor": "x86_64",
- `"machine"` - "x86_64", "machine": "x86_64",
- `"kernel_version"` - "`74`-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019" "kernel_version": "#74-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019"
} }
<a id="jc.parsers.uname.info"></a> <a id="jc.parsers.uname.info"></a>
@ -73,16 +72,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
Dictionary. Raw or processed structured data. Dictionary. Raw or processed structured data.

View File

@ -14,10 +14,9 @@ def simple_table_parse(data)
Parse simple tables. The last column may contain data with spaces. Parse simple tables. The last column may contain data with spaces.
**Arguments**: Parameters:
data: (list) Text data to parse that has been split into lines
- `data` - (list) Text data to parse that has been split into lines
via .splitlines(). Item 0 must be the header row. via .splitlines(). Item 0 must be the header row.
Any spaces in header names should be changed to Any spaces in header names should be changed to
underscore '_'. You should also ensure headers are underscore '_'. You should also ensure headers are
@ -26,9 +25,7 @@ Parse simple tables. The last column may contain data with spaces.
Also, ensure there are no blank lines (list items) Also, ensure there are no blank lines (list items)
in the data. in the data.
Returns:
**Returns**:
List of Dictionaries List of Dictionaries
@ -42,10 +39,9 @@ def sparse_table_parse(data, delim='\u2063')
Parse tables with missing column data or with spaces in column data. Parse tables with missing column data or with spaces in column data.
**Arguments**: Parameters:
data: (list) Text data to parse that has been split into lines
- `data` - (list) Text data to parse that has been split into lines
via .splitlines(). Item 0 must be the header row. via .splitlines(). Item 0 must be the header row.
Any spaces in header names should be changed to Any spaces in header names should be changed to
underscore '_'. You should also ensure headers are underscore '_'. You should also ensure headers are
@ -56,15 +52,13 @@ Parse tables with missing column data or with spaces in column data.
Also, ensure there are no blank lines (list items) Also, ensure there are no blank lines (list items)
in the data. in the data.
- `delim` - (string) Delimiter to use. By default `u\\2063` delim: (string) Delimiter to use. By default `u\\2063`
(invisible separator) is used since it is unlikely (invisible separator) is used since it is unlikely
to ever be seen in terminal output. You can change to ever be seen in terminal output. You can change
this for troubleshooting purposes or if there is a this for troubleshooting purposes or if there is a
delimiter conflict with your data. delimiter conflict with your data.
Returns:
**Returns**:
List of Dictionaries List of Dictionaries

View File

@ -93,112 +93,111 @@ Schema:
[0] null if date-time conversion fails [0] null if date-time conversion fails
**Examples**: Examples:
$ upower -i /org/freedesktop/UPower/devices/battery | jc --upower -p $ upower -i /org/freedesktop/UPower/devices/battery | jc --upower -p
[ [
{ {
- `"native_path"` - "/sys/devices/LNXSYSTM:00/device:00/PNP0C0A:00/p...", "native_path": "/sys/devices/LNXSYSTM:00/device:00/PNP0C0A:00/p...",
- `"vendor"` - "NOTEBOOK", "vendor": "NOTEBOOK",
- `"model"` - "BAT", "model": "BAT",
- `"serial"` - "0001", "serial": "0001",
- `"power_supply"` - true, "power_supply": true,
- `"updated"` - "Thu 11 Mar 2021 06:28:08 PM UTC", "updated": "Thu 11 Mar 2021 06:28:08 PM UTC",
- `"has_history"` - true, "has_history": true,
- `"has_statistics"` - true, "has_statistics": true,
- `"detail"` - { "detail": {
- `"type"` - "battery", "type": "battery",
- `"present"` - true, "present": true,
- `"rechargeable"` - true, "rechargeable": true,
- `"state"` - "charging", "state": "charging",
- `"energy"` - 22.3998, "energy": 22.3998,
- `"energy_empty"` - 0.0, "energy_empty": 0.0,
- `"energy_full"` - 52.6473, "energy_full": 52.6473,
- `"energy_full_design"` - 62.16, "energy_full_design": 62.16,
- `"energy_rate"` - 31.6905, "energy_rate": 31.6905,
- `"voltage"` - 12.191, "voltage": 12.191,
- `"time_to_full"` - 57.3, "time_to_full": 57.3,
- `"percentage"` - 42.5469, "percentage": 42.5469,
- `"capacity"` - 84.6964, "capacity": 84.6964,
- `"technology"` - "lithium-ion", "technology": "lithium-ion",
- `"energy_unit"` - "Wh", "energy_unit": "Wh",
- `"energy_empty_unit"` - "Wh", "energy_empty_unit": "Wh",
- `"energy_full_unit"` - "Wh", "energy_full_unit": "Wh",
- `"energy_full_design_unit"` - "Wh", "energy_full_design_unit": "Wh",
- `"energy_rate_unit"` - "W", "energy_rate_unit": "W",
- `"voltage_unit"` - "V", "voltage_unit": "V",
- `"time_to_full_unit"` - "minutes" "time_to_full_unit": "minutes"
}, },
- `"history_charge"` - [ "history_charge": [
{ {
- `"time"` - 1328809335, "time": 1328809335,
- `"percent_charged"` - 42.547, "percent_charged": 42.547,
- `"status"` - "charging" "status": "charging"
}, },
{ {
- `"time"` - 1328809305, "time": 1328809305,
- `"percent_charged"` - 42.02, "percent_charged": 42.02,
- `"status"` - "charging" "status": "charging"
} }
], ],
- `"history_rate"` - [ "history_rate": [
{ {
- `"time"` - 1328809335, "time": 1328809335,
- `"percent_charged"` - 31.691, "percent_charged": 31.691,
- `"status"` - "charging" "status": "charging"
} }
], ],
- `"updated_seconds_ago"` - 441975, "updated_seconds_ago": 441975,
- `"updated_epoch"` - 1615516088, "updated_epoch": 1615516088,
- `"updated_epoch_utc"` - 1615487288 "updated_epoch_utc": 1615487288
} }
] ]
$ upower -i /org/freedesktop/UPower/devices/battery | jc --upower -p -r $ upower -i /org/freedesktop/UPower/devices/battery | jc --upower -p -r
[ [
{ {
- `"native_path"` - "/sys/devices/LNXSYSTM:00/device:00/PNP0C0A:00/p...", "native_path": "/sys/devices/LNXSYSTM:00/device:00/PNP0C0A:00/p...",
- `"vendor"` - "NOTEBOOK", "vendor": "NOTEBOOK",
- `"model"` - "BAT", "model": "BAT",
- `"serial"` - "0001", "serial": "0001",
- `"power_supply"` - "yes", "power_supply": "yes",
- `"updated"` - "Thu 11 Mar 2021 06:28:08 PM UTC (441975 seconds ago)", "updated": "Thu 11 Mar 2021 06:28:08 PM UTC (441975 seconds ago)",
- `"has_history"` - "yes", "has_history": "yes",
- `"has_statistics"` - "yes", "has_statistics": "yes",
- `"detail"` - { "detail": {
- `"type"` - "battery", "type": "battery",
- `"present"` - "yes", "present": "yes",
- `"rechargeable"` - "yes", "rechargeable": "yes",
- `"state"` - "charging", "state": "charging",
- `"energy"` - "22.3998 Wh", "energy": "22.3998 Wh",
- `"energy_empty"` - "0 Wh", "energy_empty": "0 Wh",
- `"energy_full"` - "52.6473 Wh", "energy_full": "52.6473 Wh",
- `"energy_full_design"` - "62.16 Wh", "energy_full_design": "62.16 Wh",
- `"energy_rate"` - "31.6905 W", "energy_rate": "31.6905 W",
- `"voltage"` - "12.191 V", "voltage": "12.191 V",
- `"time_to_full"` - "57.3 minutes", "time_to_full": "57.3 minutes",
- `"percentage"` - "42.5469%", "percentage": "42.5469%",
- `"capacity"` - "84.6964%", "capacity": "84.6964%",
- `"technology"` - "lithium-ion" "technology": "lithium-ion"
}, },
- `"history_charge"` - [ "history_charge": [
{ {
- `"time"` - "1328809335", "time": "1328809335",
- `"percent_charged"` - "42.547", "percent_charged": "42.547",
- `"status"` - "charging" "status": "charging"
}, },
{ {
- `"time"` - "1328809305", "time": "1328809305",
- `"percent_charged"` - "42.020", "percent_charged": "42.020",
- `"status"` - "charging" "status": "charging"
} }
], ],
- `"history_rate"` - [ "history_rate": [
{ {
- `"time"` - "1328809335", "time": "1328809335",
- `"percent_charged"` - "31.691", "percent_charged": "31.691",
- `"status"` - "charging" "status": "charging"
} }
] ]
} }
@ -224,16 +223,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -41,34 +41,33 @@ Schema:
"load_15m": float "load_15m": float
} }
**Example**: Example:
$ uptime | jc --uptime -p $ uptime | jc --uptime -p
{ {
- `"time"` - "11:35", "time": "11:35",
- `"uptime"` - "3 days, 4:03", "uptime": "3 days, 4:03",
- `"users"` - 5, "users": 5,
- `"load_1m"` - 1.88, "load_1m": 1.88,
- `"load_5m"` - 2.0, "load_5m": 2.0,
- `"load_15m"` - 1.94, "load_15m": 1.94,
- `"time_hour"` - 11, "time_hour": 11,
- `"time_minute"` - 35, "time_minute": 35,
- `"time_second"` - null, "time_second": null,
- `"uptime_days"` - 3, "uptime_days": 3,
- `"uptime_hours"` - 4, "uptime_hours": 4,
- `"uptime_minutes"` - 3, "uptime_minutes": 3,
- `"uptime_total_seconds"` - 273780 "uptime_total_seconds": 273780
} }
$ uptime | jc --uptime -p -r $ uptime | jc --uptime -p -r
{ {
- `"time"` - "11:36", "time": "11:36",
- `"uptime"` - "3 days, 4:04", "uptime": "3 days, 4:04",
- `"users"` - "5", "users": "5",
- `"load_1m"` - "1.88", "load_1m": "1.88",
- `"load_5m"` - "1.99", "load_5m": "1.99",
- `"load_15m"` - "1.94" "load_15m": "1.94"
} }
<a id="jc.parsers.uptime.info"></a> <a id="jc.parsers.uptime.info"></a>
@ -91,16 +90,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
Dictionary. Raw or processed structured data Dictionary. Raw or processed structured data

View File

@ -75,60 +75,59 @@ Schema:
[0] naive timestamp if -t flag is used [0] naive timestamp if -t flag is used
[1] aware timestamp if -t flag is used and UTC TZ [1] aware timestamp if -t flag is used and UTC TZ
**Examples**: Examples:
$ vmstat | jc --vmstat -p $ vmstat | jc --vmstat -p
[ [
{ {
- `"runnable_procs"` - 2, "runnable_procs": 2,
- `"uninterruptible_sleeping_procs"` - 0, "uninterruptible_sleeping_procs": 0,
- `"virtual_mem_used"` - 0, "virtual_mem_used": 0,
- `"free_mem"` - 2794468, "free_mem": 2794468,
- `"buffer_mem"` - 2108, "buffer_mem": 2108,
- `"cache_mem"` - 741208, "cache_mem": 741208,
- `"inactive_mem"` - null, "inactive_mem": null,
- `"active_mem"` - null, "active_mem": null,
- `"swap_in"` - 0, "swap_in": 0,
- `"swap_out"` - 0, "swap_out": 0,
- `"blocks_in"` - 1, "blocks_in": 1,
- `"blocks_out"` - 3, "blocks_out": 3,
- `"interrupts"` - 29, "interrupts": 29,
- `"context_switches"` - 57, "context_switches": 57,
- `"user_time"` - 0, "user_time": 0,
- `"system_time"` - 0, "system_time": 0,
- `"idle_time"` - 99, "idle_time": 99,
- `"io_wait_time"` - 0, "io_wait_time": 0,
- `"stolen_time"` - 0, "stolen_time": 0,
- `"timestamp"` - null, "timestamp": null,
- `"timezone"` - null "timezone": null
} }
] ]
$ vmstat | jc --vmstat -p -r $ vmstat | jc --vmstat -p -r
[ [
{ {
- `"runnable_procs"` - "2", "runnable_procs": "2",
- `"uninterruptible_sleeping_procs"` - "0", "uninterruptible_sleeping_procs": "0",
- `"virtual_mem_used"` - "0", "virtual_mem_used": "0",
- `"free_mem"` - "2794468", "free_mem": "2794468",
- `"buffer_mem"` - "2108", "buffer_mem": "2108",
- `"cache_mem"` - "741208", "cache_mem": "741208",
- `"inactive_mem"` - null, "inactive_mem": null,
- `"active_mem"` - null, "active_mem": null,
- `"swap_in"` - "0", "swap_in": "0",
- `"swap_out"` - "0", "swap_out": "0",
- `"blocks_in"` - "1", "blocks_in": "1",
- `"blocks_out"` - "3", "blocks_out": "3",
- `"interrupts"` - "29", "interrupts": "29",
- `"context_switches"` - "57", "context_switches": "57",
- `"user_time"` - "0", "user_time": "0",
- `"system_time"` - "0", "system_time": "0",
- `"idle_time"` - "99", "idle_time": "99",
- `"io_wait_time"` - "0", "io_wait_time": "0",
- `"stolen_time"` - "0", "stolen_time": "0",
- `"timestamp"` - null, "timestamp": null,
- `"timezone"` - null "timezone": null
} }
] ]
@ -152,16 +151,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -95,8 +95,7 @@ Schema:
[2] false if error parsing [2] false if error parsing
[3] exists if "success" is false [3] exists if "success" is false
**Examples**: Examples:
$ vmstat | jc --vmstat-s $ vmstat | jc --vmstat-s
{"runnable_procs":2,"uninterruptible_sleeping_procs":0,"virtual_mem...} {"runnable_procs":2,"uninterruptible_sleeping_procs":0,"virtual_mem...}
@ -126,25 +125,20 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False)
Main text parsing generator function. Returns an iterator object. Main text parsing generator function. Returns an iterator object.
**Arguments**: Parameters:
data: (iterable) line-based text data to parse
- `data` - (iterable) line-based text data to parse
(e.g. sys.stdin or str.splitlines()) (e.g. sys.stdin or str.splitlines())
- `raw` - (boolean) unprocessed output if True raw: (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True quiet: (boolean) suppress warning messages if True
- `ignore_exceptions` - (boolean) ignore parsing exceptions if True ignore_exceptions: (boolean) ignore parsing exceptions if True
**Yields**:
Yields:
Dictionary. Raw or processed structured data. Dictionary. Raw or processed structured data.
Returns:
**Returns**:
Iterator object Iterator object

View File

@ -38,74 +38,73 @@ Schema:
} }
] ]
**Examples**: Examples:
$ w | jc --w -p $ w | jc --w -p
[ [
{ {
- `"user"` - "root", "user": "root",
- `"tty"` - "tty1", "tty": "tty1",
- `"from"` - null, "from": null,
- `"login_at"` - "07:49", "login_at": "07:49",
- `"idle"` - "1:15m", "idle": "1:15m",
- `"jcpu"` - "0.00s", "jcpu": "0.00s",
- `"pcpu"` - "0.00s", "pcpu": "0.00s",
- `"what"` - "-bash" "what": "-bash"
}, },
{ {
- `"user"` - "root", "user": "root",
- `"tty"` - "ttyS0", "tty": "ttyS0",
- `"from"` - null, "from": null,
- `"login_at"` - "06:24", "login_at": "06:24",
- `"idle"` - "0.00s", "idle": "0.00s",
- `"jcpu"` - "0.43s", "jcpu": "0.43s",
- `"pcpu"` - "0.00s", "pcpu": "0.00s",
- `"what"` - "w" "what": "w"
}, },
{ {
- `"user"` - "root", "user": "root",
- `"tty"` - "pts/0", "tty": "pts/0",
- `"from"` - "192.168.71.1", "from": "192.168.71.1",
- `"login_at"` - "06:29", "login_at": "06:29",
- `"idle"` - "2:35m", "idle": "2:35m",
- `"jcpu"` - "0.00s", "jcpu": "0.00s",
- `"pcpu"` - "0.00s", "pcpu": "0.00s",
- `"what"` - "-bash" "what": "-bash"
} }
] ]
$ w | jc --w -p -r $ w | jc --w -p -r
[ [
{ {
- `"user"` - "kbrazil", "user": "kbrazil",
- `"tty"` - "tty1", "tty": "tty1",
- `"from"` - "-", "from": "-",
- `"login_at"` - "07:49", "login_at": "07:49",
- `"idle"` - "1:16m", "idle": "1:16m",
- `"jcpu"` - "0.00s", "jcpu": "0.00s",
- `"pcpu"` - "0.00s", "pcpu": "0.00s",
- `"what"` - "-bash" "what": "-bash"
}, },
{ {
- `"user"` - "kbrazil", "user": "kbrazil",
- `"tty"` - "ttyS0", "tty": "ttyS0",
- `"from"` - "-", "from": "-",
- `"login_at"` - "06:24", "login_at": "06:24",
- `"idle"` - "2.00s", "idle": "2.00s",
- `"jcpu"` - "0.46s", "jcpu": "0.46s",
- `"pcpu"` - "0.00s", "pcpu": "0.00s",
- `"what"` - "w" "what": "w"
}, },
{ {
- `"user"` - "kbrazil", "user": "kbrazil",
- `"tty"` - "pts/0", "tty": "pts/0",
- `"from"` - "192.168.71.1", "from": "192.168.71.1",
- `"login_at"` - "06:29", "login_at": "06:29",
- `"idle"` - "2:36m", "idle": "2:36m",
- `"jcpu"` - "0.00s", "jcpu": "0.00s",
- `"pcpu"` - "0.00s", "pcpu": "0.00s",
- `"what"` - "-bash" "what": "-bash"
} }
] ]
@ -129,16 +128,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -34,28 +34,27 @@ Schema:
} }
] ]
**Examples**: Examples:
$ wc * | jc --wc -p $ wc * | jc --wc -p
[ [
{ {
- `"filename"` - "airport-I.json", "filename": "airport-I.json",
- `"lines"` - 1, "lines": 1,
- `"words"` - 30, "words": 30,
- `"characters"` - 307 "characters": 307
}, },
{ {
- `"filename"` - "airport-I.out", "filename": "airport-I.out",
- `"lines"` - 15, "lines": 15,
- `"words"` - 33, "words": 33,
- `"characters"` - 348 "characters": 348
}, },
{ {
- `"filename"` - "airport-s.json", "filename": "airport-s.json",
- `"lines"` - 1, "lines": 1,
- `"words"` - 202, "words": 202,
- `"characters"` - 2152 "characters": 2152
}, },
... ...
] ]
@ -80,16 +79,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -47,97 +47,96 @@ Schema:
[0] naive timestamp. null if time cannot be converted [0] naive timestamp. null if time cannot be converted
**Examples**: Examples:
$ who -a | jc --who -p $ who -a | jc --who -p
[ [
{ {
- `"event"` - "reboot", "event": "reboot",
- `"time"` - "Feb 7 23:31", "time": "Feb 7 23:31",
- `"pid"` - 1, "pid": 1,
- `"epoch"` - null "epoch": null
}, },
{ {
- `"user"` - "joeuser", "user": "joeuser",
- `"writeable_tty"` - "-", "writeable_tty": "-",
- `"tty"` - "console", "tty": "console",
- `"time"` - "Feb 7 23:32", "time": "Feb 7 23:32",
- `"idle"` - "old", "idle": "old",
- `"pid"` - 105, "pid": 105,
- `"epoch"` - null "epoch": null
}, },
{ {
- `"user"` - "joeuser", "user": "joeuser",
- `"writeable_tty"` - "+", "writeable_tty": "+",
- `"tty"` - "ttys000", "tty": "ttys000",
- `"time"` - "Feb 13 16:44", "time": "Feb 13 16:44",
- `"idle"` - ".", "idle": ".",
- `"pid"` - 51217, "pid": 51217,
- `"comment"` - "term=0 exit=0", "comment": "term=0 exit=0",
- `"epoch"` - null "epoch": null
}, },
{ {
- `"user"` - "joeuser", "user": "joeuser",
- `"writeable_tty"` - "?", "writeable_tty": "?",
- `"tty"` - "ttys003", "tty": "ttys003",
- `"time"` - "Feb 28 08:59", "time": "Feb 28 08:59",
- `"idle"` - "01:36", "idle": "01:36",
- `"pid"` - 41402, "pid": 41402,
- `"epoch"` - null "epoch": null
}, },
{ {
- `"user"` - "joeuser", "user": "joeuser",
- `"writeable_tty"` - "+", "writeable_tty": "+",
- `"tty"` - "ttys004", "tty": "ttys004",
- `"time"` - "Mar 1 16:35", "time": "Mar 1 16:35",
- `"idle"` - ".", "idle": ".",
- `"pid"` - 15679, "pid": 15679,
- `"from"` - "192.168.1.5", "from": "192.168.1.5",
- `"epoch"` - null "epoch": null
} }
] ]
$ who -a | jc --who -p -r $ who -a | jc --who -p -r
[ [
{ {
- `"event"` - "reboot", "event": "reboot",
- `"time"` - "Feb 7 23:31", "time": "Feb 7 23:31",
- `"pid"` - "1" "pid": "1"
}, },
{ {
- `"user"` - "joeuser", "user": "joeuser",
- `"writeable_tty"` - "-", "writeable_tty": "-",
- `"tty"` - "console", "tty": "console",
- `"time"` - "Feb 7 23:32", "time": "Feb 7 23:32",
- `"idle"` - "old", "idle": "old",
- `"pid"` - "105" "pid": "105"
}, },
{ {
- `"user"` - "joeuser", "user": "joeuser",
- `"writeable_tty"` - "+", "writeable_tty": "+",
- `"tty"` - "ttys000", "tty": "ttys000",
- `"time"` - "Feb 13 16:44", "time": "Feb 13 16:44",
- `"idle"` - ".", "idle": ".",
- `"pid"` - "51217", "pid": "51217",
- `"comment"` - "term=0 exit=0" "comment": "term=0 exit=0"
}, },
{ {
- `"user"` - "joeuser", "user": "joeuser",
- `"writeable_tty"` - "?", "writeable_tty": "?",
- `"tty"` - "ttys003", "tty": "ttys003",
- `"time"` - "Feb 28 08:59", "time": "Feb 28 08:59",
- `"idle"` - "01:36", "idle": "01:36",
- `"pid"` - "41402" "pid": "41402"
}, },
{ {
- `"user"` - "joeuser", "user": "joeuser",
- `"writeable_tty"` - "+", "writeable_tty": "+",
- `"tty"` - "ttys004", "tty": "ttys004",
- `"time"` - "Mar 1 16:35", "time": "Mar 1 16:35",
- `"idle"` - ".", "idle": ".",
- `"pid"` - "15679", "pid": "15679",
- `"from"` - "192.168.1.5" "from": "192.168.1.5"
} }
] ]
@ -161,16 +160,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -29,8 +29,7 @@ See https://github.com/martinblech/xmltodict for details
"key2": string/object "key2": string/object
} }
**Examples**: Examples:
$ cat cd_catalog.xml $ cat cd_catalog.xml
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
@ -55,23 +54,23 @@ See https://github.com/martinblech/xmltodict for details
$ cat cd_catalog.xml | jc --xml -p $ cat cd_catalog.xml | jc --xml -p
{ {
- `"CATALOG"` - { "CATALOG": {
- `"CD"` - [ "CD": [
{ {
- `"TITLE"` - "Empire Burlesque", "TITLE": "Empire Burlesque",
- `"ARTIST"` - "Bob Dylan", "ARTIST": "Bob Dylan",
- `"COUNTRY"` - "USA", "COUNTRY": "USA",
- `"COMPANY"` - "Columbia", "COMPANY": "Columbia",
- `"PRICE"` - "10.90", "PRICE": "10.90",
- `"YEAR"` - "1985" "YEAR": "1985"
}, },
{ {
- `"TITLE"` - "Hide your heart", "TITLE": "Hide your heart",
- `"ARTIST"` - "Bonnie Tyler", "ARTIST": "Bonnie Tyler",
- `"COUNTRY"` - "UK", "COUNTRY": "UK",
- `"COMPANY"` - "CBS Records", "COMPANY": "CBS Records",
- `"PRICE"` - "9.90", "PRICE": "9.90",
- `"YEAR"` - "1988" "YEAR": "1988"
}, },
... ...
} }
@ -96,16 +95,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
Dictionary. Raw or processed structured data. Dictionary. Raw or processed structured data.

View File

@ -31,59 +31,58 @@ See https://pypi.org/project/ruamel.yaml for details
} }
] ]
**Examples**: Examples:
$ cat istio-mtls-permissive.yaml $ cat istio-mtls-permissive.yaml
- `apiVersion` - "authentication.istio.io/v1alpha1" apiVersion: "authentication.istio.io/v1alpha1"
- `kind` - "Policy" kind: "Policy"
metadata: metadata:
- `name` - "default" name: "default"
- `namespace` - "default" namespace: "default"
spec: spec:
peers: peers:
- mtls: {} - mtls: {}
--- ---
- `apiVersion` - "networking.istio.io/v1alpha3" apiVersion: "networking.istio.io/v1alpha3"
- `kind` - "DestinationRule" kind: "DestinationRule"
metadata: metadata:
- `name` - "default" name: "default"
- `namespace` - "default" namespace: "default"
spec: spec:
- `host` - "*.default.svc.cluster.local" host: "*.default.svc.cluster.local"
trafficPolicy: trafficPolicy:
tls: tls:
- `mode` - ISTIO_MUTUAL mode: ISTIO_MUTUAL
$ cat istio-mtls-permissive.yaml | jc --yaml -p $ cat istio-mtls-permissive.yaml | jc --yaml -p
[ [
{ {
- `"apiVersion"` - "authentication.istio.io/v1alpha1", "apiVersion": "authentication.istio.io/v1alpha1",
- `"kind"` - "Policy", "kind": "Policy",
- `"metadata"` - { "metadata": {
- `"name"` - "default", "name": "default",
- `"namespace"` - "default" "namespace": "default"
}, },
- `"spec"` - { "spec": {
- `"peers"` - [ "peers": [
{ {
- `"mtls"` - {} "mtls": {}
} }
] ]
} }
}, },
{ {
- `"apiVersion"` - "networking.istio.io/v1alpha3", "apiVersion": "networking.istio.io/v1alpha3",
- `"kind"` - "DestinationRule", "kind": "DestinationRule",
- `"metadata"` - { "metadata": {
- `"name"` - "default", "name": "default",
- `"namespace"` - "default" "namespace": "default"
}, },
- `"spec"` - { "spec": {
- `"host"` - "*.default.svc.cluster.local", "host": "*.default.svc.cluster.local",
- `"trafficPolicy"` - { "trafficPolicy": {
- `"tls"` - { "tls": {
- `"mode"` - "ISTIO_MUTUAL" "mode": "ISTIO_MUTUAL"
} }
} }
} }
@ -110,16 +109,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries representing the YAML documents. List of Dictionaries representing the YAML documents.

View File

@ -56,32 +56,31 @@ Schema:
} }
] ]
**Examples**: Examples:
$ zipinfo log4j-core-2.16.0.jar | jc --zipinfo -p $ zipinfo log4j-core-2.16.0.jar | jc --zipinfo -p
[ [
{ {
- `"archive"` - "log4j-core-2.16.0.jar", "archive": "log4j-core-2.16.0.jar",
- `"size"` - 1789565, "size": 1789565,
- `"size_unit"` - "bytes", "size_unit": "bytes",
- `"number_entries"` - 1218, "number_entries": 1218,
- `"number_files"` - 1218, "number_files": 1218,
- `"bytes_uncompressed"` - 3974141, "bytes_uncompressed": 3974141,
- `"bytes_compressed"` - 1515455, "bytes_compressed": 1515455,
- `"percent_compressed"` - 61.9, "percent_compressed": 61.9,
- `"files"` - [ "files": [
{ {
- `"flags"` - "-rw-r--r--", "flags": "-rw-r--r--",
- `"zipversion"` - "2.0", "zipversion": "2.0",
- `"zipunder"` - "unx", "zipunder": "unx",
- `"filesize"` - 19810, "filesize": 19810,
- `"type"` - "bl", "type": "bl",
- `"method"` - "defN", "method": "defN",
- `"date"` - "21-Dec-12", "date": "21-Dec-12",
- `"time"` - "23:35", "time": "23:35",
- `"filename"` - "META-INF/MANIFEST.MF" "filename": "META-INF/MANIFEST.MF"
}, },
... ...
@ -105,16 +104,13 @@ def parse(data, raw=False, quiet=False)
Main text parsing function Main text parsing function
**Arguments**: Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
- `data` - (string) text data to parse Returns:
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
**Returns**:
List of Dictionaries. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.

View File

@ -16,14 +16,11 @@ Prints warning message for non-fatal issues. The first line is
prepended with 'jc: Warning - ' and subsequent lines are indented. prepended with 'jc: Warning - ' and subsequent lines are indented.
Wraps text as needed based on the terminal width. Wraps text as needed based on the terminal width.
**Arguments**: Parameters:
message: (list) list of string lines
- `message` - (list) list of string lines Returns:
**Returns**:
None - just prints output to STDERR None - just prints output to STDERR
@ -39,14 +36,11 @@ Prints an error message for fatal issues. The first line is
prepended with 'jc: Error - ' and subsequent lines are indented. prepended with 'jc: Error - ' and subsequent lines are indented.
Wraps text as needed based on the terminal width. Wraps text as needed based on the terminal width.
**Arguments**: Parameters:
message: (list) list of string lines
- `message` - (list) list of string lines Returns:
**Returns**:
None - just prints output to STDERR None - just prints output to STDERR
@ -61,20 +55,17 @@ def compatibility(mod_name, compatible, quiet=False)
Checks for the parser's compatibility with the running OS Checks for the parser's compatibility with the running OS
platform. platform.
**Arguments**: Parameters:
mod_name: (string) __name__ of the calling module
- `mod_name` - (string) __name__ of the calling module compatible: (list) sys.platform name(s) compatible with
- `compatible` - (list) sys.platform name(s) compatible with
the parser. compatible options: the parser. compatible options:
linux, darwin, cygwin, win32, aix, freebsd linux, darwin, cygwin, win32, aix, freebsd
- `quiet` - (bool) supress compatibility message if True quiet: (bool) supress compatibility message if True
**Returns**:
Returns:
None - just prints output to STDERR None - just prints output to STDERR
@ -89,14 +80,11 @@ def has_data(data)
Checks if the input contains data. If there are any non-whitespace Checks if the input contains data. If there are any non-whitespace
characters then return True, else return False. characters then return True, else return False.
**Arguments**: Parameters:
data: (string) input to check whether it contains data
- `data` - (string) input to check whether it contains data Returns:
**Returns**:
Boolean True if input string (data) contains non-whitespace Boolean True if input string (data) contains non-whitespace
characters, otherwise False characters, otherwise False
@ -112,14 +100,11 @@ def convert_to_int(value)
Converts string and float input to int. Strips all non-numeric Converts string and float input to int. Strips all non-numeric
characters from strings. characters from strings.
**Arguments**: Parameters:
value: (string/integer/float) Input value
- `value` - (string/integer/float) Input value Returns:
**Returns**:
integer/None Integer if successful conversion, otherwise None integer/None Integer if successful conversion, otherwise None
@ -134,14 +119,11 @@ def convert_to_float(value)
Converts string and int input to float. Strips all non-numeric Converts string and int input to float. Strips all non-numeric
characters from strings. characters from strings.
**Arguments**: Parameters:
value: (string) Input value
- `value` - (string) Input value Returns:
**Returns**:
float/None Float if successful conversion, otherwise None float/None Float if successful conversion, otherwise None
@ -156,14 +138,11 @@ def convert_to_bool(value)
Converts string, integer, or float input to boolean by checking Converts string, integer, or float input to boolean by checking
for 'truthy' values. for 'truthy' values.
**Arguments**: Parameters:
value: (string/integer/float) Input value
- `value` - (string/integer/float) Input value Returns:
**Returns**:
True/False False unless a 'truthy' number or string is found True/False False unless a 'truthy' number or string is found
('y', 'yes', 'true', '1', 1, -1, etc.) ('y', 'yes', 'true', '1', 1, -1, etc.)
@ -230,15 +209,12 @@ class timestamp()
Input a date-time text string of several formats and convert to a Input a date-time text string of several formats and convert to a
naive or timezone-aware epoch timestamp in UTC. naive or timezone-aware epoch timestamp in UTC.
**Arguments**: Parameters:
datetime_string: (str) a string representation of a
- `datetime_string` - (str) a string representation of a
date-time in several supported formats date-time in several supported formats
Attributes:
**Attributes**:
string (str) the input datetime string string (str) the input datetime string