1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-15 01:24:29 +02:00

Merge pull request #551 from kellyjonbrazil/dev

Dev v1.25.2
This commit is contained in:
Kelly Brazil
2024-03-23 11:11:00 -07:00
committed by GitHub
438 changed files with 4138 additions and 1705 deletions

View File

@ -1,5 +1,23 @@
jc changelog
20240323 v1.25.2
- Add `apt-cache-show` command parser
- Add `apt-get-sqq` command parser
- Add `ethtool` command parser
- Add `needrestart` command parser
- Enhance `df` parser to add human readable output support. Note: the `size`
field has been changed to an integer and all size values have been normalized
to bytes.
- Enhance `free` parser to add human readable output support. All size values
have been normalizd to bytes.
- Enhance `iptables` parser to handle -x output
- Enhance `/proc/pid/stat` parser to support "Idle" state
- Enhance `rpm_qi` and `pkg_index_deb` parsers to split list fields into arrays
- Fix `iwconfig` parser to handle more special characters in the SSID name
- Fix `xrandr` parser to ignore extra horizontal and vertical stats lines
- Add aarch64 binaries to Releases for macOS and Linux
- Documentation and doc build updates
20240212 v1.25.1
- Fix for crash when optional libraries are not installed (e.g. xmltodict)
- Fix for `ini` parser crashing with some keys with no values

View File

@ -76,7 +76,7 @@ function parameter in `parse()` when using `jc` as a python library.
Schemas for each parser can be found at the documentation link beside each
[**Parser**](#parsers) below.
Release notes can be found [here](https://blog.kellybrazil.com/category/jc-news/).
Release notes can be found in the [Releases section](https://github.com/kellyjonbrazil/jc/releases) on Github.
## Why Would Anyone Do This!?
For more information on the motivations for this project, please see my blog
@ -159,6 +159,8 @@ option.
| `--acpi` | `acpi` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/acpi) |
| `--airport` | `airport -I` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/airport) |
| `--airport-s` | `airport -s` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/airport_s) |
| `--apt-cache-show` | `apt-cache show` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/apt_cache_show) |
| `--apt-get-sqq` | `apt-get -sqq` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/apt_get_sqq) |
| `--arp` | `arp` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/arp) |
| `--asciitable` | ASCII and Unicode table parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/asciitable) |
| `--asciitable-m` | multi-line ASCII and Unicode table parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/asciitable_m) |
@ -189,6 +191,7 @@ option.
| `--efibootmgr` | `efibootmgr` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/efibootmgr) |
| `--email-address` | Email Address string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/email_address) |
| `--env` | `env` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/env) |
| `--ethtool` | `ethtool` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ethtool) |
| `--file` | `file` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/file) |
| `--find` | `find` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/find) |
| `--findmnt` | `findmnt` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/findmnt) |
@ -239,6 +242,7 @@ option.
| `--mount` | `mount` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/mount) |
| `--mpstat` | `mpstat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/mpstat) |
| `--mpstat-s` | `mpstat` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/mpstat_s) |
| `--needrestart` | `needrestart -b` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/needrestart) |
| `--netstat` | `netstat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/netstat) |
| `--nmcli` | `nmcli` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/nmcli) |
| `--nsd-control` | `nsd-control` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/nsd_control) |

View File

@ -3,8 +3,8 @@ _jc()
local cur prev words cword jc_commands jc_parsers jc_options \
jc_about_options jc_about_mod_options jc_help_options jc_special_options
jc_commands=(acpi airport arp blkid bluetoothctl cbt certbot chage cksum crontab curl date debconf-show df dig dmidecode dpkg du efibootmgr env file findmnt finger free git gpg hciconfig host id ifconfig iostat ip iptables iw iwconfig jobs last lastb ls lsattr lsb_release lsblk lsmod lsof lspci lsusb md5 md5sum mdadm mount mpstat netstat nmcli nsd-control ntpq os-prober pidstat ping ping6 pip pip3 postconf printenv ps route rpm rsync sfdisk sha1sum sha224sum sha256sum sha384sum sha512sum shasum ss ssh sshd stat sum swapon sysctl systemctl systeminfo timedatectl top tracepath tracepath6 traceroute traceroute6 tune2fs udevadm ufw uname update-alternatives upower uptime vdir veracrypt vmstat w wc who xrandr zipinfo zpool)
jc_parsers=(--acpi --airport --airport-s --arp --asciitable --asciitable-m --blkid --bluetoothctl --cbt --cef --cef-s --certbot --chage --cksum --clf --clf-s --crontab --crontab-u --csv --csv-s --curl-head --date --datetime-iso --debconf-show --df --dig --dir --dmidecode --dpkg-l --du --efibootmgr --email-address --env --file --find --findmnt --finger --free --fstab --git-log --git-log-s --git-ls-remote --gpg --group --gshadow --hash --hashsum --hciconfig --history --host --hosts --http-headers --id --ifconfig --ini --ini-dup --iostat --iostat-s --ip-address --iptables --ip-route --iw-scan --iwconfig --jar-manifest --jobs --jwt --kv --kv-dup --last --ls --ls-s --lsattr --lsb-release --lsblk --lsmod --lsof --lspci --lsusb --m3u --mdadm --mount --mpstat --mpstat-s --netstat --nmcli --nsd-control --ntpq --openvpn --os-prober --os-release --passwd --path --path-list --pci-ids --pgpass --pidstat --pidstat-s --ping --ping-s --pip-list --pip-show --pkg-index-apk --pkg-index-deb --plist --postconf --proc --proc-buddyinfo --proc-cmdline --proc-consoles --proc-cpuinfo --proc-crypto --proc-devices --proc-diskstats --proc-filesystems --proc-interrupts --proc-iomem --proc-ioports --proc-loadavg --proc-locks --proc-meminfo --proc-modules --proc-mtrr --proc-pagetypeinfo --proc-partitions --proc-slabinfo --proc-softirqs --proc-stat --proc-swaps --proc-uptime --proc-version --proc-vmallocinfo --proc-vmstat --proc-zoneinfo --proc-driver-rtc --proc-net-arp --proc-net-dev --proc-net-dev-mcast --proc-net-if-inet6 --proc-net-igmp --proc-net-igmp6 --proc-net-ipv6-route --proc-net-netlink --proc-net-netstat --proc-net-packet --proc-net-protocols --proc-net-route --proc-net-tcp --proc-net-unix --proc-pid-fdinfo --proc-pid-io --proc-pid-maps --proc-pid-mountinfo --proc-pid-numa-maps --proc-pid-smaps --proc-pid-stat --proc-pid-statm --proc-pid-status --ps --resolve-conf --route --rpm-qi --rsync --rsync-s --semver --sfdisk --shadow --srt --ss --ssh-conf --sshd-conf --stat --stat-s --swapon --sysctl --syslog --syslog-s --syslog-bsd --syslog-bsd-s --systemctl --systemctl-lj --systemctl-ls --systemctl-luf --systeminfo --time --timedatectl --timestamp --toml --top --top-s --tracepath --traceroute --tune2fs --udevadm --ufw --ufw-appinfo --uname --update-alt-gs --update-alt-q --upower --uptime --url --ver --veracrypt --vmstat --vmstat-s --w --wc --who --x509-cert --x509-csr --xml --xrandr --yaml --zipinfo --zpool-iostat --zpool-status)
jc_commands=(acpi airport apt-cache apt-get arp blkid bluetoothctl cbt certbot chage cksum crontab curl date debconf-show df dig dmidecode dpkg du efibootmgr env ethtool file findmnt finger free git gpg hciconfig host id ifconfig iostat ip iptables iw iwconfig jobs last lastb ls lsattr lsb_release lsblk lsmod lsof lspci lsusb md5 md5sum mdadm mount mpstat needrestart netstat nmcli nsd-control ntpq os-prober pidstat ping ping6 pip pip3 postconf printenv ps route rpm rsync sfdisk sha1sum sha224sum sha256sum sha384sum sha512sum shasum ss ssh sshd stat sum swapon sysctl systemctl systeminfo timedatectl top tracepath tracepath6 traceroute traceroute6 tune2fs udevadm ufw uname update-alternatives upower uptime vdir veracrypt vmstat w wc who xrandr zipinfo zpool)
jc_parsers=(--acpi --airport --airport-s --apt-cache-show --apt-get-sqq --arp --asciitable --asciitable-m --blkid --bluetoothctl --cbt --cef --cef-s --certbot --chage --cksum --clf --clf-s --crontab --crontab-u --csv --csv-s --curl-head --date --datetime-iso --debconf-show --df --dig --dir --dmidecode --dpkg-l --du --efibootmgr --email-address --env --ethtool --file --find --findmnt --finger --free --fstab --git-log --git-log-s --git-ls-remote --gpg --group --gshadow --hash --hashsum --hciconfig --history --host --hosts --http-headers --id --ifconfig --ini --ini-dup --iostat --iostat-s --ip-address --iptables --ip-route --iw-scan --iwconfig --jar-manifest --jobs --jwt --kv --kv-dup --last --ls --ls-s --lsattr --lsb-release --lsblk --lsmod --lsof --lspci --lsusb --m3u --mdadm --mount --mpstat --mpstat-s --needrestart --netstat --nmcli --nsd-control --ntpq --openvpn --os-prober --os-release --passwd --path --path-list --pci-ids --pgpass --pidstat --pidstat-s --ping --ping-s --pip-list --pip-show --pkg-index-apk --pkg-index-deb --plist --postconf --proc --proc-buddyinfo --proc-cmdline --proc-consoles --proc-cpuinfo --proc-crypto --proc-devices --proc-diskstats --proc-filesystems --proc-interrupts --proc-iomem --proc-ioports --proc-loadavg --proc-locks --proc-meminfo --proc-modules --proc-mtrr --proc-pagetypeinfo --proc-partitions --proc-slabinfo --proc-softirqs --proc-stat --proc-swaps --proc-uptime --proc-version --proc-vmallocinfo --proc-vmstat --proc-zoneinfo --proc-driver-rtc --proc-net-arp --proc-net-dev --proc-net-dev-mcast --proc-net-if-inet6 --proc-net-igmp --proc-net-igmp6 --proc-net-ipv6-route --proc-net-netlink --proc-net-netstat --proc-net-packet --proc-net-protocols --proc-net-route --proc-net-tcp --proc-net-unix --proc-pid-fdinfo --proc-pid-io --proc-pid-maps --proc-pid-mountinfo --proc-pid-numa-maps --proc-pid-smaps --proc-pid-stat --proc-pid-statm --proc-pid-status --ps --resolve-conf --route --rpm-qi --rsync --rsync-s --semver --sfdisk --shadow --srt --ss --ssh-conf --sshd-conf --stat --stat-s --swapon --sysctl --syslog --syslog-s --syslog-bsd --syslog-bsd-s --systemctl --systemctl-lj --systemctl-ls --systemctl-luf --systeminfo --time --timedatectl --timestamp --toml --top --top-s --tracepath --traceroute --tune2fs --udevadm --ufw --ufw-appinfo --uname --update-alt-gs --update-alt-q --upower --uptime --url --ver --veracrypt --vmstat --vmstat-s --w --wc --who --x509-cert --x509-csr --xml --xrandr --yaml --zipinfo --zpool-iostat --zpool-status)
jc_options=(--force-color -C --debug -d --monochrome -m --meta-out -M --pretty -p --quiet -q --raw -r --slurp -s --unbuffer -u --yaml-out -y)
jc_about_options=(--about -a)
jc_about_mod_options=(--pretty -p --yaml-out -y --monochrome -m --force-color -C)

View File

@ -9,10 +9,12 @@ _jc() {
jc_help_options jc_help_options_describe \
jc_special_options jc_special_options_describe
jc_commands=(acpi airport arp blkid bluetoothctl cbt certbot chage cksum crontab curl date debconf-show df dig dmidecode dpkg du efibootmgr env file findmnt finger free git gpg hciconfig host id ifconfig iostat ip iptables iw iwconfig jobs last lastb ls lsattr lsb_release lsblk lsmod lsof lspci lsusb md5 md5sum mdadm mount mpstat netstat nmcli nsd-control ntpq os-prober pidstat ping ping6 pip pip3 postconf printenv ps route rpm rsync sfdisk sha1sum sha224sum sha256sum sha384sum sha512sum shasum ss ssh sshd stat sum swapon sysctl systemctl systeminfo timedatectl top tracepath tracepath6 traceroute traceroute6 tune2fs udevadm ufw uname update-alternatives upower uptime vdir veracrypt vmstat w wc who xrandr zipinfo zpool)
jc_commands=(acpi airport apt-cache apt-get arp blkid bluetoothctl cbt certbot chage cksum crontab curl date debconf-show df dig dmidecode dpkg du efibootmgr env ethtool file findmnt finger free git gpg hciconfig host id ifconfig iostat ip iptables iw iwconfig jobs last lastb ls lsattr lsb_release lsblk lsmod lsof lspci lsusb md5 md5sum mdadm mount mpstat needrestart netstat nmcli nsd-control ntpq os-prober pidstat ping ping6 pip pip3 postconf printenv ps route rpm rsync sfdisk sha1sum sha224sum sha256sum sha384sum sha512sum shasum ss ssh sshd stat sum swapon sysctl systemctl systeminfo timedatectl top tracepath tracepath6 traceroute traceroute6 tune2fs udevadm ufw uname update-alternatives upower uptime vdir veracrypt vmstat w wc who xrandr zipinfo zpool)
jc_commands_describe=(
'acpi:run "acpi" command with magic syntax.'
'airport:run "airport" command with magic syntax.'
'apt-cache:run "apt-cache" command with magic syntax.'
'apt-get:run "apt-get" command with magic syntax.'
'arp:run "arp" command with magic syntax.'
'blkid:run "blkid" command with magic syntax.'
'bluetoothctl:run "bluetoothctl" command with magic syntax.'
@ -31,6 +33,7 @@ _jc() {
'du:run "du" command with magic syntax.'
'efibootmgr:run "efibootmgr" command with magic syntax.'
'env:run "env" command with magic syntax.'
'ethtool:run "ethtool" command with magic syntax.'
'file:run "file" command with magic syntax.'
'findmnt:run "findmnt" command with magic syntax.'
'finger:run "finger" command with magic syntax.'
@ -62,6 +65,7 @@ _jc() {
'mdadm:run "mdadm" command with magic syntax.'
'mount:run "mount" command with magic syntax.'
'mpstat:run "mpstat" command with magic syntax.'
'needrestart:run "needrestart" command with magic syntax.'
'netstat:run "netstat" command with magic syntax.'
'nmcli:run "nmcli" command with magic syntax.'
'nsd-control:run "nsd-control" command with magic syntax.'
@ -117,11 +121,13 @@ _jc() {
'zipinfo:run "zipinfo" command with magic syntax.'
'zpool:run "zpool" command with magic syntax.'
)
jc_parsers=(--acpi --airport --airport-s --arp --asciitable --asciitable-m --blkid --bluetoothctl --cbt --cef --cef-s --certbot --chage --cksum --clf --clf-s --crontab --crontab-u --csv --csv-s --curl-head --date --datetime-iso --debconf-show --df --dig --dir --dmidecode --dpkg-l --du --efibootmgr --email-address --env --file --find --findmnt --finger --free --fstab --git-log --git-log-s --git-ls-remote --gpg --group --gshadow --hash --hashsum --hciconfig --history --host --hosts --http-headers --id --ifconfig --ini --ini-dup --iostat --iostat-s --ip-address --iptables --ip-route --iw-scan --iwconfig --jar-manifest --jobs --jwt --kv --kv-dup --last --ls --ls-s --lsattr --lsb-release --lsblk --lsmod --lsof --lspci --lsusb --m3u --mdadm --mount --mpstat --mpstat-s --netstat --nmcli --nsd-control --ntpq --openvpn --os-prober --os-release --passwd --path --path-list --pci-ids --pgpass --pidstat --pidstat-s --ping --ping-s --pip-list --pip-show --pkg-index-apk --pkg-index-deb --plist --postconf --proc --proc-buddyinfo --proc-cmdline --proc-consoles --proc-cpuinfo --proc-crypto --proc-devices --proc-diskstats --proc-filesystems --proc-interrupts --proc-iomem --proc-ioports --proc-loadavg --proc-locks --proc-meminfo --proc-modules --proc-mtrr --proc-pagetypeinfo --proc-partitions --proc-slabinfo --proc-softirqs --proc-stat --proc-swaps --proc-uptime --proc-version --proc-vmallocinfo --proc-vmstat --proc-zoneinfo --proc-driver-rtc --proc-net-arp --proc-net-dev --proc-net-dev-mcast --proc-net-if-inet6 --proc-net-igmp --proc-net-igmp6 --proc-net-ipv6-route --proc-net-netlink --proc-net-netstat --proc-net-packet --proc-net-protocols --proc-net-route --proc-net-tcp --proc-net-unix --proc-pid-fdinfo --proc-pid-io --proc-pid-maps --proc-pid-mountinfo --proc-pid-numa-maps --proc-pid-smaps --proc-pid-stat --proc-pid-statm --proc-pid-status --ps --resolve-conf --route --rpm-qi --rsync --rsync-s --semver --sfdisk --shadow --srt --ss --ssh-conf --sshd-conf --stat --stat-s --swapon --sysctl --syslog --syslog-s --syslog-bsd --syslog-bsd-s --systemctl --systemctl-lj --systemctl-ls --systemctl-luf --systeminfo --time --timedatectl --timestamp --toml --top --top-s --tracepath --traceroute --tune2fs --udevadm --ufw --ufw-appinfo --uname --update-alt-gs --update-alt-q --upower --uptime --url --ver --veracrypt --vmstat --vmstat-s --w --wc --who --x509-cert --x509-csr --xml --xrandr --yaml --zipinfo --zpool-iostat --zpool-status)
jc_parsers=(--acpi --airport --airport-s --apt-cache-show --apt-get-sqq --arp --asciitable --asciitable-m --blkid --bluetoothctl --cbt --cef --cef-s --certbot --chage --cksum --clf --clf-s --crontab --crontab-u --csv --csv-s --curl-head --date --datetime-iso --debconf-show --df --dig --dir --dmidecode --dpkg-l --du --efibootmgr --email-address --env --ethtool --file --find --findmnt --finger --free --fstab --git-log --git-log-s --git-ls-remote --gpg --group --gshadow --hash --hashsum --hciconfig --history --host --hosts --http-headers --id --ifconfig --ini --ini-dup --iostat --iostat-s --ip-address --iptables --ip-route --iw-scan --iwconfig --jar-manifest --jobs --jwt --kv --kv-dup --last --ls --ls-s --lsattr --lsb-release --lsblk --lsmod --lsof --lspci --lsusb --m3u --mdadm --mount --mpstat --mpstat-s --needrestart --netstat --nmcli --nsd-control --ntpq --openvpn --os-prober --os-release --passwd --path --path-list --pci-ids --pgpass --pidstat --pidstat-s --ping --ping-s --pip-list --pip-show --pkg-index-apk --pkg-index-deb --plist --postconf --proc --proc-buddyinfo --proc-cmdline --proc-consoles --proc-cpuinfo --proc-crypto --proc-devices --proc-diskstats --proc-filesystems --proc-interrupts --proc-iomem --proc-ioports --proc-loadavg --proc-locks --proc-meminfo --proc-modules --proc-mtrr --proc-pagetypeinfo --proc-partitions --proc-slabinfo --proc-softirqs --proc-stat --proc-swaps --proc-uptime --proc-version --proc-vmallocinfo --proc-vmstat --proc-zoneinfo --proc-driver-rtc --proc-net-arp --proc-net-dev --proc-net-dev-mcast --proc-net-if-inet6 --proc-net-igmp --proc-net-igmp6 --proc-net-ipv6-route --proc-net-netlink --proc-net-netstat --proc-net-packet --proc-net-protocols --proc-net-route --proc-net-tcp --proc-net-unix --proc-pid-fdinfo --proc-pid-io --proc-pid-maps --proc-pid-mountinfo --proc-pid-numa-maps --proc-pid-smaps --proc-pid-stat --proc-pid-statm --proc-pid-status --ps --resolve-conf --route --rpm-qi --rsync --rsync-s --semver --sfdisk --shadow --srt --ss --ssh-conf --sshd-conf --stat --stat-s --swapon --sysctl --syslog --syslog-s --syslog-bsd --syslog-bsd-s --systemctl --systemctl-lj --systemctl-ls --systemctl-luf --systeminfo --time --timedatectl --timestamp --toml --top --top-s --tracepath --traceroute --tune2fs --udevadm --ufw --ufw-appinfo --uname --update-alt-gs --update-alt-q --upower --uptime --url --ver --veracrypt --vmstat --vmstat-s --w --wc --who --x509-cert --x509-csr --xml --xrandr --yaml --zipinfo --zpool-iostat --zpool-status)
jc_parsers_describe=(
'--acpi:`acpi` command parser'
'--airport:`airport -I` command parser'
'--airport-s:`airport -s` command parser'
'--apt-cache-show:`apt-cache show` command parser'
'--apt-get-sqq:`apt-get -sqq` command parser'
'--arp:`arp` command parser'
'--asciitable:ASCII and Unicode table parser'
'--asciitable-m:multi-line ASCII and Unicode table parser'
@ -152,6 +158,7 @@ _jc() {
'--efibootmgr:`efibootmgr` command parser'
'--email-address:Email Address string parser'
'--env:`env` command parser'
'--ethtool:`ethtool` command parser'
'--file:`file` command parser'
'--find:`find` command parser'
'--findmnt:`findmnt` command parser'
@ -202,6 +209,7 @@ _jc() {
'--mount:`mount` command parser'
'--mpstat:`mpstat` command parser'
'--mpstat-s:`mpstat` command streaming parser'
'--needrestart:`needrestart -b` command parser'
'--netstat:`netstat` command parser'
'--nmcli:`nmcli` command parser'
'--nsd-control:`nsd-control` command parser'

86
doc2md.py Executable file
View File

@ -0,0 +1,86 @@
#!/usr/bin/env python3
"""
Convert parser doc string to markdown
"""
import sys
import importlib
from inspect import isfunction, signature, cleandoc
import yapf # type: ignore
ignore_lib_functions = [
'cast',
'wraps',
'lru_cache',
'namedtuple'
]
mod_path = sys.argv[1]
mod_name = mod_path.split('.')[-1]
module = importlib.import_module(f'{mod_path}')
######## HEADER ########
header = f'''[Home](https://kellyjonbrazil.github.io/jc/)
<a id="{mod_path}"></a>
# {mod_path}
'''
summary = module.__doc__ or ''
functions = []
for attribute in dir(module):
if isfunction(getattr(module, attribute)) \
and not getattr(module, attribute).__name__.startswith('_'):
if 'jc.parsers.' in mod_path and not 'universal' in mod_path:
if attribute == 'parse':
functions.append(attribute)
else:
if not attribute in ignore_lib_functions:
functions.append(attribute)
######## TABLE OF CONTENTS ########
toc = f'## Table of Contents\n\n* [{mod_path}](#{mod_path})\n'
for api in functions:
toc = f'{toc} * [{api}](#{mod_path}.{api})\n'
######## API DOCS ########
api_docs = ''
for api in functions:
api_function = getattr(module, api)
this_header = f'<a id="{mod_path}.{api}"></a>\n\n### {api}\n'
this_sig = str(signature(api_function))
formatted_sig = yapf.yapf_api.FormatCode(f'def {api_function.__name__}{this_sig}:\n pass' )
formatted_sig = formatted_sig[0].split(':\n pass')[0]
this_name_and_sig = f'{this_header}\n```python\n{formatted_sig}\n```'
this_doc = cleandoc(api_function.__doc__)
api_docs = api_docs + this_name_and_sig + '\n\n' + this_doc + '\n\n'
######## FOOTER ########
footer = ''
if 'jc.parsers.' in mod_path and not 'universal' in mod_path:
footer = '### Parser Information\n'
comp = ', '.join(module.info.compatible)
ver = module.info.version
author = module.info.author
author_email = module.info.author_email
slurpable = 'slurpable' in module.info.tags
footer = footer + f'Compatibility: {comp}\n\n'
footer = footer + f'Source: [`jc/parsers/{mod_name}.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/{mod_name}.py)\n\n'
if slurpable:
footer = footer + 'This parser can be used with the `--slurp` command-line option.\n\n'
footer = footer + f'Version {ver} by {author} ({author_email})'
final_doc = ''
if 'jc.parsers.' in mod_path and not 'universal' in mod_path:
final_doc = header + '\n' + summary + '\n' + api_docs + footer
elif mod_path == 'jc':
final_doc = header + '\n' + summary
else:
final_doc = header + '\n' + toc + '\n' + summary + '\n\n' + api_docs
print(final_doc)

110
docgen.sh
View File

@ -1,107 +1,32 @@
#!/bin/bash
# Generate docs.md
# requires pydoc-markdown 4.6.1
# Generate markdown document files (*.md)
# Requires the yapf python library
# use ./docgen all to generate all docs
readme_config=$(cat <<'EOF'
{
"processors": [
{
"type": "filter"
},
{
"type": "pydocmd"
}
],
"renderer": {
"type": "markdown",
"header_level_by_type": {
"Module": 1,
"Class": 3,
"Method": 3,
"Function": 3,
"Variable": 3
}
}
}
EOF
)
toc_config=$(cat <<'EOF'
{
"processors": [
{
"type": "filter"
},
{
"type": "pydocmd"
}
],
"renderer": {
"type": "markdown",
"render_toc": true,
"header_level_by_type": {
"Module": 1,
"Class": 3,
"Method": 3,
"Function": 3,
"Variable": 3
}
}
}
EOF
)
parser_config=$(cat <<'EOF'
{
"processors": [
{
"type": "filter",
"expression": "not name == \"info\" and not name.startswith(\"_\") and default()"
},
{
"type": "pydocmd"
}
],
"renderer": {
"type": "markdown",
"header_level_by_type": {
"Module": 1,
"Class": 3,
"Method": 3,
"Function": 3,
"Variable": 3
}
}
}
EOF
)
cd jc
(
echo Building docs for: package
pydoc-markdown -m jc "${readme_config}" > ../docs/readme.md; echo "+++ package docs complete"
../doc2md.py jc > ../docs/readme.md && echo "+++ package docs complete" || echo "*** PACKAGE DOCS FAILED ***"
) &
(
echo Building docs for: lib
pydoc-markdown -m jc.lib "${toc_config}" > ../docs/lib.md; echo "+++ lib docs complete"
../doc2md.py jc.lib > ../docs/lib.md && echo "+++ lib docs complete" || echo "*** LIB DOCS FAILED ***"
) &
(
echo Building docs for: utils
pydoc-markdown -m jc.utils "${toc_config}" > ../docs/utils.md; echo "+++ utils docs complete"
../doc2md.py jc.utils > ../docs/utils.md && echo "+++ utils docs complete" || echo "*** UTILS DOCS FAILED ***"
) &
(
echo Building docs for: streaming
pydoc-markdown -m jc.streaming "${toc_config}" > ../docs/streaming.md; echo "+++ streaming docs complete"
../doc2md.py jc.streaming > ../docs/streaming.md && echo "+++ streaming docs complete" || echo "*** STREAMING DOCS FAILED ***"
) &
(
echo Building docs for: universal parser
pydoc-markdown -m jc.parsers.universal "${toc_config}" > ../docs/parsers/universal.md; echo "+++ universal parser docs complete"
../doc2md.py jc.parsers.universal > ../docs/parsers/universal.md && echo "+++ universal parser docs complete" || echo "*** UNIVERSAL PARSER DOCS FAILED ***"
) &
# a bit of inception here... jc is being used to help
@ -119,27 +44,8 @@ for parser in "${parsers[@]}"; do
parser_name=$(jq -r '.name' <<< "$parser")
{
if [[ $1 == "all" ]] || ! git diff --quiet --exit-code HEAD~5 -- "parsers/${parser_name}.py"; then
compatible=$(jq -r '.compatible | join(", ")' <<< "$parser")
version=$(jq -r '.version' <<< "$parser")
author=$(jq -r '.author' <<< "$parser")
author_email=$(jq -r '.author_email' <<< "$parser")
echo "Building docs for: ${parser_name}"
echo "[Home](https://kellyjonbrazil.github.io/jc/)" > ../docs/parsers/"${parser_name}".md
pydoc-markdown -m jc.parsers."${parser_name}" "${parser_config}" >> ../docs/parsers/"${parser_name}".md
echo "### Parser Information" >> ../docs/parsers/"${parser_name}".md
echo "Compatibility: ${compatible}" >> ../docs/parsers/"${parser_name}".md
echo >> ../docs/parsers/"${parser_name}".md
echo "Source: [\`jc/parsers/${parser_name}.py\`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/${parser_name}.py)" >> ../docs/parsers/"${parser_name}".md
echo >> ../docs/parsers/"${parser_name}".md
if $(jq -e '.tags | contains(["slurpable"])' <<< "$parser"); then
echo "This parser can be used with the \`--slurp\` command-line option." >> ../docs/parsers/"${parser_name}".md
echo >> ../docs/parsers/"${parser_name}".md
fi
echo "Version ${version} by ${author} (${author_email})" >> ../docs/parsers/"${parser_name}".md
echo "+++ ${parser_name} docs complete"
../doc2md.py jc.parsers."${parser_name}" > ../docs/parsers/"${parser_name}".md && echo "+++ ${parser_name} docs complete" || echo "*** ${parser_name} DOCS FAILED ***"
fi
} &
done

View File

@ -1,29 +1,67 @@
# Table of Contents
* [jc.lib](#jc.lib)
* [get\_parser](#jc.lib.get_parser)
* [parse](#jc.lib.parse)
* [parser\_mod\_list](#jc.lib.parser_mod_list)
* [plugin\_parser\_mod\_list](#jc.lib.plugin_parser_mod_list)
* [standard\_parser\_mod\_list](#jc.lib.standard_parser_mod_list)
* [streaming\_parser\_mod\_list](#jc.lib.streaming_parser_mod_list)
* [slurpable\_parser\_mod\_list](#jc.lib.slurpable_parser_mod_list)
* [parser\_info](#jc.lib.parser_info)
* [all\_parser\_info](#jc.lib.all_parser_info)
* [get\_help](#jc.lib.get_help)
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.lib"></a>
# jc.lib
## Table of Contents
* [jc.lib](#jc.lib)
* [all_parser_info](#jc.lib.all_parser_info)
* [get_help](#jc.lib.get_help)
* [get_parser](#jc.lib.get_parser)
* [parse](#jc.lib.parse)
* [parser_info](#jc.lib.parser_info)
* [parser_mod_list](#jc.lib.parser_mod_list)
* [plugin_parser_mod_list](#jc.lib.plugin_parser_mod_list)
* [slurpable_parser_mod_list](#jc.lib.slurpable_parser_mod_list)
* [standard_parser_mod_list](#jc.lib.standard_parser_mod_list)
* [streaming_parser_mod_list](#jc.lib.streaming_parser_mod_list)
jc - JSON Convert lib module
<a id="jc.lib.all_parser_info"></a>
### all_parser_info
```python
def all_parser_info(
documentation: bool = False,
show_hidden: bool = False,
show_deprecated: bool = False) -> List[jc.jc_types.ParserInfoType]
```
Returns a list of dictionaries that includes metadata for all parser
modules. By default only non-hidden, non-deprecated parsers are
returned.
Parameters:
documentation: (boolean) include parser docstrings if True
show_hidden: (boolean) also show parsers marked as hidden
in their info metadata.
show_deprecated: (boolean) also show parsers marked as
deprecated in their info metadata.
<a id="jc.lib.get_help"></a>
### get_help
```python
def get_help(parser_mod_name: Union[str, module]) -> None
```
Show help screen for the selected parser.
This function will accept **module_name**, **cli-name**, and
**--argument-name** variants of the module name string as well as a
parser module object.
<a id="jc.lib.get_parser"></a>
### get\_parser
### get_parser
```python
def get_parser(parser_mod_name: Union[str, ModuleType]) -> ModuleType
def get_parser(parser_mod_name: Union[str, module]) -> module
```
Return the parser module object and check that the module is a valid
@ -56,13 +94,13 @@ Raises:
```python
def parse(
parser_mod_name: Union[str, ModuleType],
parser_mod_name: Union[str, module],
data: Union[str, bytes, Iterable[str]],
quiet: bool = False,
raw: bool = False,
ignore_exceptions: Optional[bool] = None,
**kwargs
) -> Union[JSONDictType, List[JSONDictType], Iterator[JSONDictType]]
) -> Union[Dict[str, Any], List[Dict[str, Any]], Iterator[Dict[str, Any]]]
```
Parse the data (string or bytes) using the supplied parser (string or
@ -152,73 +190,13 @@ Returns:
Standard Parsers: Dictionary or List of Dictionaries
Streaming Parsers: Generator Object containing Dictionaries
<a id="jc.lib.parser_mod_list"></a>
### parser\_mod\_list
```python
def parser_mod_list(show_hidden: bool = False,
show_deprecated: bool = False) -> List[str]
```
Returns a list of all available parser module names.
<a id="jc.lib.plugin_parser_mod_list"></a>
### plugin\_parser\_mod\_list
```python
def plugin_parser_mod_list(show_hidden: bool = False,
show_deprecated: bool = False) -> List[str]
```
Returns a list of plugin parser module names. This function is a
subset of `parser_mod_list()`.
<a id="jc.lib.standard_parser_mod_list"></a>
### standard\_parser\_mod\_list
```python
def standard_parser_mod_list(show_hidden: bool = False,
show_deprecated: bool = False) -> List[str]
```
Returns a list of standard parser module names. This function is a
subset of `parser_mod_list()` and does not contain any streaming
parsers.
<a id="jc.lib.streaming_parser_mod_list"></a>
### streaming\_parser\_mod\_list
```python
def streaming_parser_mod_list(show_hidden: bool = False,
show_deprecated: bool = False) -> List[str]
```
Returns a list of streaming parser module names. This function is a
subset of `parser_mod_list()`.
<a id="jc.lib.slurpable_parser_mod_list"></a>
### slurpable\_parser\_mod\_list
```python
def slurpable_parser_mod_list(show_hidden: bool = False,
show_deprecated: bool = False) -> List[str]
```
Returns a list of slurpable parser module names. This function is a
subset of `parser_mod_list()`.
<a id="jc.lib.parser_info"></a>
### parser\_info
### parser_info
```python
def parser_info(parser_mod_name: Union[str, ModuleType],
documentation: bool = False) -> ParserInfoType
def parser_info(parser_mod_name: Union[str, module],
documentation: bool = False) -> jc.jc_types.ParserInfoType
```
Returns a dictionary that includes the parser module metadata.
@ -233,39 +211,64 @@ Parameters:
documentation: (boolean) include parser docstring if True
<a id="jc.lib.all_parser_info"></a>
<a id="jc.lib.parser_mod_list"></a>
### all\_parser\_info
### parser_mod_list
```python
def all_parser_info(documentation: bool = False,
show_hidden: bool = False,
show_deprecated: bool = False) -> List[ParserInfoType]
def parser_mod_list(show_hidden: bool = False,
show_deprecated: bool = False) -> List[str]
```
Returns a list of dictionaries that includes metadata for all parser
modules. By default only non-hidden, non-deprecated parsers are
returned.
Returns a list of all available parser module names.
Parameters:
<a id="jc.lib.plugin_parser_mod_list"></a>
documentation: (boolean) include parser docstrings if True
show_hidden: (boolean) also show parsers marked as hidden
in their info metadata.
show_deprecated: (boolean) also show parsers marked as
deprecated in their info metadata.
<a id="jc.lib.get_help"></a>
### get\_help
### plugin_parser_mod_list
```python
def get_help(parser_mod_name: Union[str, ModuleType]) -> None
def plugin_parser_mod_list(show_hidden: bool = False,
show_deprecated: bool = False) -> List[str]
```
Show help screen for the selected parser.
Returns a list of plugin parser module names. This function is a
subset of `parser_mod_list()`.
<a id="jc.lib.slurpable_parser_mod_list"></a>
### slurpable_parser_mod_list
```python
def slurpable_parser_mod_list(show_hidden: bool = False,
show_deprecated: bool = False) -> List[str]
```
Returns a list of slurpable parser module names. This function is a
subset of `parser_mod_list()`.
<a id="jc.lib.standard_parser_mod_list"></a>
### standard_parser_mod_list
```python
def standard_parser_mod_list(show_hidden: bool = False,
show_deprecated: bool = False) -> List[str]
```
Returns a list of standard parser module names. This function is a
subset of `parser_mod_list()` and does not contain any streaming
parsers.
<a id="jc.lib.streaming_parser_mod_list"></a>
### streaming_parser_mod_list
```python
def streaming_parser_mod_list(show_hidden: bool = False,
show_deprecated: bool = False) -> List[str]
```
Returns a list of streaming parser module names. This function is a
subset of `parser_mod_list()`.
This function will accept **module_name**, **cli-name**, and
**--argument-name** variants of the module name string as well as a
parser module object.

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.airport_s"></a>
# jc.parsers.airport\_s
# jc.parsers.airport_s
jc - JSON Convert `airport -s` command output parser

View File

@ -0,0 +1,180 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.apt_cache_show"></a>
# jc.parsers.apt_cache_show
jc - JSON Convert `apt-cache show` command parser
Usage (cli):
$ apt-cache show | jc --apt-cache-show
Usage (module):
import jc
result = jc.parse('apt_cache_show', apt_cache_show_output)
Schema:
[
{
"package": string,
"version": string,
"installed_size": integer,
"maintainer": string,
"architecture": string,
"depends": [
string
],
"pre_depends": [
string
],
"recommends": [
string
],
"suggests": [
string
],
"conflicts": [
string
],
"breaks": [
string
],
"description_md5": string,
"multi_arch": string,
"homepage": string,
"section": string,
"priority": string,
"filename": string,
"size": integer,
"sha256": string,
"description": string
}
]
Examples:
$ apt-cache show | jc --apt-cache-show -p
[
{
"package": "systemd",
"version": "247.3-6~bpo10+1",
"installed_size": 16121,
"maintainer": "Debian systemd Maintainers <pkg-systemd-maintaine..",
"architecture": "amd64",
"depends": [
"libacl1 (>= 2.2.23)",
"libapparmor1 (>= 2.13)",
"libaudit1 (>= 1:2.2.1)",
"libcap2 (>= 1:2.10)",
"libcryptsetup12 (>= 2:2.0.1)",
"libgnutls30 (>= 3.6.6)",
"libgpg-error0 (>= 1.14)",
"libip4tc0 (>= 1.6.0+snapshot20161117)",
"libkmod2 (>= 5~)",
"liblz4-1 (>= 0.0~r130)",
"libmount1 (>= 2.30)",
"libpam0g (>= 0.99.7.1)",
"libseccomp2 (>= 2.3.1)",
"libsystemd0 (= 247.3-6~bpo10+1)",
"systemd-timesyncd | time-daemon",
"util-linux (>= 2.27.1)",
"mount (>= 2.26)",
"adduser"
],
"pre_depends": [
"libblkid1 (>= 2.24)",
"libc6 (>= 2.28)",
"libgcrypt20 (>= 1.8.0)",
"liblz4-1 (>= 0.0~r122)",
"liblzma5 (>= 5.1.1alpha+20120614)",
"libselinux1 (>= 2.1.9)",
"libzstd1 (>= 1.4.0)"
],
"recommends": [
"dbus"
],
"suggests": [
"systemd-container",
"policykit-1"
],
"conflicts": [
"consolekit",
"libpam-ck-connector"
],
"breaks": [
"python-dbusmock (<< 0.18)",
"python3-dbusmock (<< 0.18)",
"resolvconf (<< 1.83~)",
"systemd-shim (<< 10-4~)",
"udev (<< 247~)"
],
"description_md5": "19399579cbc0c47a303288bf15eadcd4",
"multi_arch": "foreign",
"homepage": "https://www.freedesktop.org/wiki/Software/systemd",
"section": "admin",
"priority": "important",
"filename": "pool/main/s/systemd/systemd_247.3-6~bpo10+1_amd64.deb",
"size": 4382056,
"sha256": "2035450655ad02faa0f75dc952128b503e51df5795c67273c0f6...",
"description": "system and service manager systemd is a system..."
},
...
]
$ apt-cache show | jc --apt-cache-show -p -r
[
{
"package": "systemd",
"version": "247.3-6~bpo10+1",
"installed_size": "16121",
"maintainer": "Debian systemd Maintainers <pkg-systemd-maintain...",
"architecture": "amd64",
"depends": "libacl1 (>= 2.2.23), libapparmor1 (>= 2.13), libaud...",
"pre_depends": "libblkid1 (>= 2.24), libc6 (>= 2.28), libgcrypt...",
"recommends": "dbus",
"suggests": "systemd-container, policykit-1",
"conflicts": "consolekit, libpam-ck-connector",
"breaks": "python-dbusmock (<< 0.18), python3-dbusmock (<< 0.18...",
"description_md5": "19399579cbc0c47a303288bf15eadcd4",
"multi_arch": "foreign",
"homepage": "https://www.freedesktop.org/wiki/Software/systemd",
"section": "admin",
"priority": "important",
"filename": "pool/main/s/systemd/systemd_247.3-6~bpo10+1_amd64.deb",
"size": "4382056",
"sha256": "2035450655ad02faa0f75dc952128b503e51df5795c67273c0f6...",
"description": "system and service manager systemd is a system..."
},
...
]
<a id="jc.parsers.apt_cache_show.parse"></a>
### parse
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Source: [`jc/parsers/apt_cache_show.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/apt_cache_show.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

201
docs/parsers/apt_get_sqq.md Normal file
View File

@ -0,0 +1,201 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.apt_get_sqq"></a>
# jc.parsers.apt_get_sqq
jc - JSON Convert `apt-get -sqq` command output parser
Requires the `-sqq` options in `apt-get`.
Usage (cli):
$ apt-get -sqq | jc --apt-get-sqq
or
$ jc apt-get -sqq
Usage (module):
import jc
result = jc.parse('apt_get_sqq', apt_get_sqq_command_output)
Schema:
[
{
"operation": string, # configure, remove, or unpack
"package": string,
"broken": string/null,
"proposed_pkg_ver": string,
"existing_pkg_ver": string/null,
"architecture": string
}
]
Examples:
$ apt-get -sqq | jc --apt-get-sqq -p
[
{
"operation": "unpack",
"package": "dpkg",
"broken": "1.19.7",
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
},
{
"operation": "unpack",
"package": "dpkg",
"broken": null,
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
},
{
"operation": "configure",
"package": "dpkg",
"broken": "1.19.7",
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
},
{
"operation": "remove",
"package": "dpkg",
"broken": "1.19.7",
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
},
{
"operation": "unpack",
"package": "base-files",
"broken": "10.3+deb10u4",
"proposed_pkg_ver": "10.3+deb10u13 Debian:10.13/oldstable",
"existing_pkg_ver": null,
"architecture": "amd64"
},
{
"operation": "configure",
"package": "base-files",
"broken": null,
"proposed_pkg_ver": "10.3+deb10u13 Debian:10.13/oldstable",
"existing_pkg_ver": null,
"architecture": "amd64"
},
{
"operation": "unpack",
"package": "dpkg",
"broken": "1.19.7",
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
},
{
"operation": "configure",
"package": "dpkg",
"broken": null,
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
}
]
$ apt-get -sqq | jc --apt-get-sqq -p -r
[
{
"operation": "Inst",
"package": "dpkg",
"broken": "1.19.7",
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
},
{
"operation": "Inst",
"package": "dpkg",
"broken": null,
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
},
{
"operation": "Conf",
"package": "dpkg",
"broken": "1.19.7",
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
},
{
"operation": "Remv",
"package": "dpkg",
"broken": "1.19.7",
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
},
{
"operation": "Inst",
"package": "base-files",
"broken": "10.3+deb10u4",
"proposed_pkg_ver": "10.3+deb10u13 Debian:10.13/oldstable",
"existing_pkg_ver": null,
"architecture": "amd64"
},
{
"operation": "Conf",
"package": "base-files",
"broken": null,
"proposed_pkg_ver": "10.3+deb10u13 Debian:10.13/oldstable",
"existing_pkg_ver": null,
"architecture": "amd64"
},
{
"operation": "Inst",
"package": "dpkg",
"broken": "1.19.7",
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
},
{
"operation": "Conf",
"package": "dpkg",
"broken": null,
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
}
]
<a id="jc.parsers.apt_get_sqq.parse"></a>
### parse
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Source: [`jc/parsers/apt_get_sqq.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/apt_get_sqq.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.asciitable_m"></a>
# jc.parsers.asciitable\_m
# jc.parsers.asciitable_m
jc - JSON Convert `asciitable-m` parser

View File

@ -112,7 +112,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function

View File

@ -104,7 +104,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.cef_s"></a>
# jc.parsers.cef\_s
# jc.parsers.cef_s
jc - JSON Convert CEF string output streaming parser
@ -95,7 +95,6 @@ Examples:
### parse
```python
@add_jc_meta
def parse(data: Iterable[str],
raw: bool = False,
quiet: bool = False,

View File

@ -140,7 +140,7 @@ Examples:
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> JSONDictType
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
```
Main text parsing function

View File

@ -178,7 +178,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.clf_s"></a>
# jc.parsers.clf\_s
# jc.parsers.clf_s
jc - JSON Convert Common Log Format file streaming parser
@ -88,11 +88,12 @@ Examples:
### parse
```python
@add_jc_meta
def parse(data: Iterable[str],
raw: bool = False,
quiet: bool = False,
ignore_exceptions: bool = False) -> StreamingOutputType
def parse(
data: Iterable[str],
raw: bool = False,
quiet: bool = False,
ignore_exceptions: bool = False
) -> Iterator[Union[Dict[str, Any], Tuple[BaseException, str]]]
```
Main text parsing generator function. Returns an iterable object.

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.crontab_u"></a>
# jc.parsers.crontab\_u
# jc.parsers.crontab_u
jc - JSON Convert `crontab -l` command output and crontab
file parser

View File

@ -84,7 +84,7 @@ Examples:
```python
def parse(data: Union[str, bytes],
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.csv_s"></a>
# jc.parsers.csv\_s
# jc.parsers.csv_s
jc - JSON Convert `csv` file streaming parser
@ -64,7 +64,6 @@ Examples:
### parse
```python
@add_jc_meta
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
```

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.curl_head"></a>
# jc.parsers.curl\_head
# jc.parsers.curl_head
jc - JSON Convert `curl --head` command output parser
@ -286,7 +286,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.datetime_iso"></a>
# jc.parsers.datetime\_iso
# jc.parsers.datetime_iso
jc - JSON Convert ISO 8601 Datetime string parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.debconf_show"></a>
# jc.parsers.debconf\_show
# jc.parsers.debconf_show
jc - JSON Convert `debconf-show` command output parser
@ -84,7 +84,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function

View File

@ -5,6 +5,8 @@
jc - JSON Convert `df` command output parser
Values are normalized to bytes when using `df -h`.
Usage (cli):
$ df | jc --df
@ -23,7 +25,7 @@ Schema:
[
{
"filesystem": string,
"size": string,
"size": integer,
"1k_blocks": integer,
"512_blocks": integer,
"used": integer,
@ -122,4 +124,4 @@ Compatibility: linux, darwin, freebsd
Source: [`jc/parsers/df.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/df.py)
Version 1.11 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 2.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.dpkg_l"></a>
# jc.parsers.dpkg\_l
# jc.parsers.dpkg_l
jc - JSON Convert `dpkg -l` command output parser

View File

@ -81,7 +81,7 @@ Examples:
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> JSONDictType
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
```
Main text parsing function

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.email_address"></a>
# jc.parsers.email\_address
# jc.parsers.email_address
jc - JSON Convert Email Address string parser

197
docs/parsers/ethtool.md Normal file
View File

@ -0,0 +1,197 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ethtool"></a>
# jc.parsers.ethtool
jc - JSON Convert `ethtool` command output parser
Supports standard `ethtool` output and the `--module-info` option.
Usage (cli):
$ ethtool <interface> | jc --ethtool
$ ethtool --module-info <interface> | jc --ethtool
or
$ jc ethtool <interface>
$ jc ethtool --module-info <interface>
Usage (module):
import jc
result = jc.parse('ethtool', ethtool_command_output)
Schema:
Note: many units fields are converted to integers and floats
when detected. Use raw output for the original string values.
{
"name": string,
"supported_ports": [
string
],
"supported_link_modes": [
string
],
"supported_pause_frame_use": string,
"supports_auto_negotiation": boolean,
"supported_fec_modes": [
string
],
"advertised_link_modes": [
string
],
"advertised_pause_frame_use": boolean,
"advertised_auto_negotiation": boolean,
"advertised_fec_modes": [
string
],
"speed": string,
"speed_bps": integer,
"duplex": string,
"auto_negotiation": boolean,
"port": string,
"phyad": string,
"mdi_x": string,
"transceiver": string,
"supports_wake_on": string,
"wake_on": string,
"current_message_level": [
string
],
"link_detected": boolean,
"identifier": string,
"extended_identifier": string,
"connector": string,
"transceiver_codes": string,
"transceiver_type": [
string
],
"encoding": string,
"br_nominal": string,
"rate_identifier": string,
"length_smf_km": string,
"length_smf": string,
"length_50um": string,
"length_62_5um": string,
"length_copper": string,
"length_om3": string,
"passive_cu_cmplnce": string,
"vendor_name": string,
"vendor_oui": string,
"vendor_pn": string,
"vendor_rev": string,
"option_values": string,
"br_margin_max": string,
"br_margin_min": string
}
Examples:
$ ethtool enp0s3 | jc --ethtool -p
{
"name": "enp0s3",
"supported_pause_frame_use": "No",
"supports_auto_negotiation": true,
"supported_fec_modes": "Not reported",
"advertised_pause_frame_use": false,
"advertised_auto_negotiation": true,
"advertised_fec_modes": "Not reported",
"speed": "1000Mb/s",
"duplex": "Full",
"port": "Twisted Pair",
"phyad": "0",
"transceiver": "internal",
"auto_negotiation": false,
"mdi_x": "off (auto)",
"supports_wake_on": "umbg",
"wake_on": "d",
"link_detected": true,
"supported_ports": [
"TP"
],
"supported_link_modes": [
"10baseT/Half",
"10baseT/Full",
"100baseT/Half",
"100baseT/Full",
"1000baseT/Full"
],
"advertised_link_modes": [
"10baseT/Half",
"10baseT/Full",
"100baseT/Half",
"100baseT/Full",
"1000baseT/Full"
],
"current_message_level": [
"0x00000007 (7)",
"drv probe link"
],
"speed_bps": 1000000000
}
$ ethtool --module-info enp0s3 | jc --ethtool -p
{
"identifier": "0x03 (SFP)",
"extended_identifier": "0x04 (GBIC/SFP defined by 2-wire interface ID)",
"connector": "0x21 (Copper pigtail)",
"transceiver_codes": "0x01 0x00 0x00 0x04 0x00 0x04 0x80 0xd5 0x00",
"transceiver_type": [
"Infiniband: 1X Copper Passive",
"Ethernet: 1000BASE-CX",
"Passive Cable",
"FC: Twin Axial Pair (TW)",
"FC: 1200 MBytes/sec",
"FC: 800 MBytes/sec",
"FC: 400 MBytes/sec",
"FC: 200 MBytes/sec",
"FC: 100 MBytes/sec"
],
"encoding": "0x00 (unspecified)",
"br_nominal": "10300MBd",
"rate_identifier": "0x00 (unspecified)",
"length_smf_km": "0km",
"length_smf": "0m",
"length_50um": "0m",
"length_62_5um": "0m",
"length_copper": "2m",
"length_om3": "0m",
"passive_cu_cmplnce": "0x01 (SFF-8431 appendix E) [SFF-8472 rev10.4 only]",
"vendor_name": "UbiquitiNetworks",
"vendor_oui": "00:40:20",
"vendor_pn": "UDC-2",
"vendor_rev": "",
"option_values": "0x00 0x00",
"br_margin_max": "0%",
"br_margin_min": "0%"
}
<a id="jc.parsers.ethtool.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Source: [`jc/parsers/ethtool.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ethtool.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -96,7 +96,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function

View File

@ -5,6 +5,8 @@
jc - JSON Convert `free` command output parser
Values are normalized to bytes when using `free -h`.
Usage (cli):
$ free | jc --free
@ -22,13 +24,13 @@ Schema:
[
{
"type": string,
"total": integer,
"used": integer,
"free": integer,
"shared": integer,
"buff_cache": integer,
"available": integer
"type": string,
"total": integer,
"used": integer,
"free": integer,
"shared": integer,
"buff_cache": integer,
"available": integer
}
]
@ -97,4 +99,4 @@ Compatibility: linux
Source: [`jc/parsers/free.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/free.py)
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.git_log"></a>
# jc.parsers.git\_log
# jc.parsers.git_log
jc - JSON Convert `git log` command output parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.git_log_s"></a>
# jc.parsers.git\_log\_s
# jc.parsers.git_log_s
jc - JSON Convert `git log` command output streaming parser
@ -82,7 +82,6 @@ Examples:
### parse
```python
@add_jc_meta
def parse(data: Iterable[str],
raw: bool = False,
quiet: bool = False,

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.git_ls_remote"></a>
# jc.parsers.git\_ls\_remote
# jc.parsers.git_ls_remote
jc - JSON Convert `git ls-remote` command output parser
@ -71,7 +71,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> Union[JSONDictType, List[JSONDictType]]
quiet: bool = False) -> Union[Dict[str, Any], List[Dict[str, Any]]]
```
Main text parsing function

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.http_headers"></a>
# jc.parsers.http\_headers
# jc.parsers.http_headers
jc - JSON Convert HTTP headers parser
@ -313,7 +313,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function

View File

@ -222,7 +222,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ini_dup"></a>
# jc.parsers.ini\_dup
# jc.parsers.ini_dup
jc - JSON Convert INI with duplicate key file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.iostat_s"></a>
# jc.parsers.iostat\_s
# jc.parsers.iostat_s
jc - JSON Convert `iostat` command output streaming parser
@ -108,7 +108,6 @@ Examples:
### parse
```python
@add_jc_meta
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
```

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ip_address"></a>
# jc.parsers.ip\_address
# jc.parsers.ip_address
jc - JSON Convert IP Address string parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ip_route"></a>
# jc.parsers.ip\_route
# jc.parsers.ip_route
jc - JSON Convert `ip route` command output parser

View File

@ -5,7 +5,7 @@
jc - JSON Convert `iptables` command output parser
Supports `-vLn` and `--line-numbers` for all tables.
Supports `-vLnx` and `--line-numbers` for all tables.
Usage (cli):
@ -188,4 +188,4 @@ Compatibility: linux
Source: [`jc/parsers/iptables.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/iptables.py)
Version 1.10 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.11 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.iw_scan"></a>
# jc.parsers.iw\_scan
# jc.parsers.iw_scan
jc - JSON Convert `iw dev <device> scan` command output parser

View File

@ -90,7 +90,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function
@ -110,4 +110,4 @@ Compatibility: linux
Source: [`jc/parsers/iwconfig.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/iwconfig.py)
Version 1.1 by Thomas Vincent (vrince@gmail.com)
Version 1.2 by Thomas Vincent (vrince@gmail.com)

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.jar_manifest"></a>
# jc.parsers.jar\_manifest
# jc.parsers.jar_manifest
jc - JSON Convert Java `MANIFEST.MF` file parser

View File

@ -81,4 +81,4 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Source: [`jc/parsers/kv.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/kv.py)
Version 2.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 2.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.kv_dup"></a>
# jc.parsers.kv\_dup
# jc.parsers.kv_dup
jc - JSON Convert `Key/Value` with duplicate key file and string parser
@ -88,4 +88,4 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Source: [`jc/parsers/kv_dup.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/kv_dup.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ls_s"></a>
# jc.parsers.ls\_s
# jc.parsers.ls_s
jc - JSON Convert `ls` and `vdir` command output streaming parser
@ -77,7 +77,6 @@ Examples:
### parse
```python
@add_jc_meta
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
```

View File

@ -69,7 +69,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.lsb_release"></a>
# jc.parsers.lsb\_release
# jc.parsers.lsb_release
jc - JSON Convert `lsb_release` command parser
@ -40,7 +40,7 @@ Examples:
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> JSONDictType
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
```
Main text parsing function
@ -60,4 +60,4 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Source: [`jc/parsers/lsb_release.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/lsb_release.py)
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -127,7 +127,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.mpstat_s"></a>
# jc.parsers.mpstat\_s
# jc.parsers.mpstat_s
jc - JSON Convert `mpstat` command output streaming parser
@ -100,7 +100,6 @@ Examples:
### parse
```python
@add_jc_meta
def parse(data: Iterable[str],
raw: bool = False,
quiet: bool = False,

101
docs/parsers/needrestart.md Normal file
View File

@ -0,0 +1,101 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.needrestart"></a>
# jc.parsers.needrestart
jc - JSON Convert `needrestart -b` command output parser
Usage (cli):
$ needrestart -b | jc --needrestart
or
$ jc needrestart -b
Usage (module):
import jc
result = jc.parse('needrestart', needrestart_command_output)
Schema:
{
"version": string,
"running_kernel_version": string,
"expected_kernel_version": string,
"kernel_status": integer,
"container": string,
"session": [
string
],
"service": [
string
],
"pid": [
string
]
}
Examples:
$ needrestart -b | jc --needrestart -p
{
"version": "2.1",
"running_kernel_version": "3.19.3-tl1+",
"expected_kernel_version": "3.19.3-tl1+",
"kernel_status": 1,
"container": "LXC web1",
"session": [
"metabase @ user manager service",
"root @ session #28017"
],
"service": [
"systemd-journald.service",
"systemd-machined.service"
]
}
$ needrestart -b | jc --needrestart -p -r
{
"needrestart_ver": "2.1",
"needrestart_kcur": "3.19.3-tl1+",
"needrestart_kexp": "3.19.3-tl1+",
"needrestart_ksta": "1",
"needrestart_cont": "LXC web1",
"needrestart_sess": [
"metabase @ user manager service",
"root @ session #28017"
],
"needrestart_svc": [
"systemd-journald.service",
"systemd-machined.service"
]
}
<a id="jc.parsers.needrestart.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux
Source: [`jc/parsers/needrestart.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/needrestart.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.nsd_control"></a>
# jc.parsers.nsd\_control
# jc.parsers.nsd_control
jc - JSON Convert `nsd-control` command output parser

View File

@ -157,7 +157,7 @@ Examples:
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> JSONDictType
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
```
Main text parsing function

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.os_prober"></a>
# jc.parsers.os\_prober
# jc.parsers.os_prober
jc - JSON Convert `os-prober` command output parser
@ -45,7 +45,7 @@ Examples:
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> JSONDictType
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
```
Main text parsing function

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.os_release"></a>
# jc.parsers.os\_release
# jc.parsers.os_release
jc - JSON Convert `/etc/os-release` file parser
@ -65,7 +65,7 @@ Examples:
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> JSONDictType
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
```
Main text parsing function
@ -85,4 +85,4 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Source: [`jc/parsers/os_release.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/os_release.py)
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.path_list"></a>
# jc.parsers.path\_list
# jc.parsers.path_list
jc - JSON Convert POSIX path list string parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.pci_ids"></a>
# jc.parsers.pci\_ids
# jc.parsers.pci_ids
jc - JSON Convert `pci.ids` file parser
@ -78,7 +78,7 @@ Examples:
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> JSONDictType
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
```
Main text parsing function

View File

@ -54,7 +54,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.pidstat_s"></a>
# jc.parsers.pidstat\_s
# jc.parsers.pidstat_s
jc - JSON Convert `pidstat -H` command output streaming parser
@ -86,7 +86,6 @@ Examples:
### parse
```python
@add_jc_meta
def parse(data: Iterable[str],
raw: bool = False,
quiet: bool = False,

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ping_s"></a>
# jc.parsers.ping\_s
# jc.parsers.ping_s
jc - JSON Convert `ping` command output streaming parser
@ -86,7 +86,6 @@ Examples:
### parse
```python
@add_jc_meta
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
```

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.pip_list"></a>
# jc.parsers.pip\_list
# jc.parsers.pip_list
jc - JSON Convert `pip-list` command output parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.pip_show"></a>
# jc.parsers.pip\_show
# jc.parsers.pip_show
jc - JSON Convert `pip-show` command output parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.pkg_index_apk"></a>
# jc.parsers.pkg\_index\_apk
# jc.parsers.pkg_index_apk
jc - JSON Convert Alpine Linux Package Index files

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.pkg_index_deb"></a>
# jc.parsers.pkg\_index\_deb
# jc.parsers.pkg_index_deb
jc - JSON Convert Debian Package Index file parser
@ -27,9 +27,15 @@ Schema:
"maintainer": string,
"description": string,
"homepage": string,
"depends": string,
"conflicts": string,
"replaces": string,
"depends": [
string
],
"conflicts": [
string
],
"replaces": [
string
],
"vcs_git": string,
"sha256": string,
"size": integer,
@ -43,35 +49,44 @@ Examples:
$ cat Packages | jc --pkg-index-deb
[
{
"package": "aspnetcore-runtime-2.1",
"version": "2.1.22-1",
"package": "dotnet-host",
"version": "3.1.16-1",
"architecture": "amd64",
"section": "libs",
"priority": "standard",
"installed_size": 146,
"maintainer": ".NET Core Team <dotnetpackages@dotnetfoundation.org>",
"description": "Microsoft .NET Core Host - 3.1.16",
"homepage": "https://dot.net/core",
"conflicts": [
"dotnet",
"dotnet-nightly"
],
"depends": [
"libgcc1",
"libstdc++6",
"libc6"
],
"sha256": "2557da13447d61382f255eb751ba29cc1a8220899c1e3e640a7bb3d2a0c1d297",
"size": 32594,
"filename": "pool/main/d/dotnet-host/dotnet-host-3.1.16-x64.deb"
},
{
"package": "aspnetcore-runtime-5.0",
"version": "5.0.10-1",
"architecture": "amd64",
"section": "devel",
"priority": "standard",
"installed_size": 71081,
"installed_size": 18551,
"maintainer": "Microsoft <nugetaspnet@microsoft.com>",
"description": "Microsoft ASP.NET Core 2.1.22 Shared Framework",
"homepage": "https://www.asp.net/",
"depends": "libc6 (>= 2.14), dotnet-runtime-2.1 (>= 2.1.22)",
"sha256": "48d4e78a7ceff34105411172f4c3e91a0359b3929d84d26a493...",
"size": 21937036,
"filename": "pool/main/a/aspnetcore-runtime-2.1/aspnetcore-run..."
},
{
"package": "azure-functions-core-tools-4",
"version": "4.0.4590-1",
"architecture": "amd64",
"section": "devel",
"priority": "optional",
"maintainer": "Ahmed ElSayed <ahmels@microsoft.com>",
"description": "Azure Function Core Tools v4",
"homepage": "https://docs.microsoft.com/en-us/azure/azure-func...",
"conflicts": "azure-functions-core-tools-2, azure-functions-co...",
"replaces": "azure-functions-core-tools-2, azure-functions-cor...",
"vcs_git": "https://github.com/Azure/azure-functions-core-tool...",
"sha256": "a2a4f99d6d98ba0a46832570285552f2a93bab06cebbda2afc7...",
"size": 124417844,
"filename": "pool/main/a/azure-functions-core-tools-4/azure-fu..."
"description": "Shared Framework for hosting of Microsoft ASP.NET Core applications. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/aspnetcore). We happily accept issues and PRs.",
"homepage": "https://asp.net",
"depends": [
"dotnet-runtime-5.0 (>= 5.0.10)"
],
"sha256": "1d9869f862cb4e9c46b245a343d8e39fbbc84d9f8ab9ef357c4643da20805ad3",
"size": 6084188,
"filename": "pool/main/a/aspnetcore-runtime-5.0/aspnetcore-runtime-5.0.10-x64.deb"
}
]
@ -117,7 +132,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function
@ -137,4 +152,4 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Source: [`jc/parsers/pkg_index_deb.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/pkg_index_deb.py)
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -52,7 +52,7 @@ Specific Proc file parser names can be found with `jc -hh` or `jc -a`.
Schemas can also be found online at:
https://kellyjonbrazil.github.io/jc/docs/parsers/proc_<name>
https://kellyjonbrazil.github.io/jc/docs/parsers/proc_<name>
For example:
@ -151,4 +151,4 @@ Source: [`jc/parsers/proc.py`](https://github.com/kellyjonbrazil/jc/blob/master/
This parser can be used with the `--slurp` command-line option.
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_buddyinfo"></a>
# jc.parsers.proc\_buddyinfo
# jc.parsers.proc_buddyinfo
jc - JSON Convert `/proc/buddyinfo` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_cmdline"></a>
# jc.parsers.proc\_cmdline
# jc.parsers.proc_cmdline
jc - JSON Convert `/proc/cmdline` file parser
@ -71,7 +71,7 @@ Examples:
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> JSONDictType
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
```
Main text parsing function

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_consoles"></a>
# jc.parsers.proc\_consoles
# jc.parsers.proc_consoles
jc - JSON Convert `/proc/consoles` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_cpuinfo"></a>
# jc.parsers.proc\_cpuinfo
# jc.parsers.proc_cpuinfo
jc - JSON Convert `/proc/cpuinfo` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_crypto"></a>
# jc.parsers.proc\_crypto
# jc.parsers.proc_crypto
jc - JSON Convert `/proc/crypto` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_devices"></a>
# jc.parsers.proc\_devices
# jc.parsers.proc_devices
jc - JSON Convert `/proc/devices` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_diskstats"></a>
# jc.parsers.proc\_diskstats
# jc.parsers.proc_diskstats
jc - JSON Convert `/proc/diskstats` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_driver_rtc"></a>
# jc.parsers.proc\_driver\_rtc
# jc.parsers.proc_driver_rtc
jc - JSON Convert `/proc/driver/rtc` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_filesystems"></a>
# jc.parsers.proc\_filesystems
# jc.parsers.proc_filesystems
jc - JSON Convert `/proc/filesystems` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_interrupts"></a>
# jc.parsers.proc\_interrupts
# jc.parsers.proc_interrupts
jc - JSON Convert `/proc/interrupts` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_iomem"></a>
# jc.parsers.proc\_iomem
# jc.parsers.proc_iomem
jc - JSON Convert `/proc/iomem` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_ioports"></a>
# jc.parsers.proc\_ioports
# jc.parsers.proc_ioports
jc - JSON Convert `/proc/ioports` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_loadavg"></a>
# jc.parsers.proc\_loadavg
# jc.parsers.proc_loadavg
jc - JSON Convert `/proc/loadavg` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_locks"></a>
# jc.parsers.proc\_locks
# jc.parsers.proc_locks
jc - JSON Convert `/proc/locks` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_meminfo"></a>
# jc.parsers.proc\_meminfo
# jc.parsers.proc_meminfo
jc - JSON Convert `/proc/meminfo` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_modules"></a>
# jc.parsers.proc\_modules
# jc.parsers.proc_modules
jc - JSON Convert `/proc/modules` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_mtrr"></a>
# jc.parsers.proc\_mtrr
# jc.parsers.proc_mtrr
jc - JSON Convert `/proc/mtrr` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_arp"></a>
# jc.parsers.proc\_net\_arp
# jc.parsers.proc_net_arp
jc - JSON Convert `/proc/net/arp` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_dev"></a>
# jc.parsers.proc\_net\_dev
# jc.parsers.proc_net_dev
jc - JSON Convert `/proc/net/dev` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_dev_mcast"></a>
# jc.parsers.proc\_net\_dev\_mcast
# jc.parsers.proc_net_dev_mcast
jc - JSON Convert `/proc/net/dev_mcast` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_if_inet6"></a>
# jc.parsers.proc\_net\_if\_inet6
# jc.parsers.proc_net_if_inet6
jc - JSON Convert `/proc/net/if_inet6` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_igmp"></a>
# jc.parsers.proc\_net\_igmp
# jc.parsers.proc_net_igmp
jc - JSON Convert `/proc/net/igmp` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_igmp6"></a>
# jc.parsers.proc\_net\_igmp6
# jc.parsers.proc_net_igmp6
jc - JSON Convert `/proc/net/igmp6` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_ipv6_route"></a>
# jc.parsers.proc\_net\_ipv6\_route
# jc.parsers.proc_net_ipv6_route
jc - JSON Convert `/proc/net/ipv6_route` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_netlink"></a>
# jc.parsers.proc\_net\_netlink
# jc.parsers.proc_net_netlink
jc - JSON Convert `/proc/net/netlink` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_netstat"></a>
# jc.parsers.proc\_net\_netstat
# jc.parsers.proc_net_netstat
jc - JSON Convert `/proc/net/netstat` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_packet"></a>
# jc.parsers.proc\_net\_packet
# jc.parsers.proc_net_packet
jc - JSON Convert `/proc/net/packet` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_protocols"></a>
# jc.parsers.proc\_net\_protocols
# jc.parsers.proc_net_protocols
jc - JSON Convert `/proc/net/protocols` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_route"></a>
# jc.parsers.proc\_net\_route
# jc.parsers.proc_net_route
jc - JSON Convert `/proc/net/route` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_tcp"></a>
# jc.parsers.proc\_net\_tcp
# jc.parsers.proc_net_tcp
jc - JSON Convert `/proc/net/tcp` and `proc/net/tcp6` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_unix"></a>
# jc.parsers.proc\_net\_unix
# jc.parsers.proc_net_unix
jc - JSON Convert `/proc/net/unix` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_pagetypeinfo"></a>
# jc.parsers.proc\_pagetypeinfo
# jc.parsers.proc_pagetypeinfo
jc - JSON Convert `/proc/pagetypeinfo` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_partitions"></a>
# jc.parsers.proc\_partitions
# jc.parsers.proc_partitions
jc - JSON Convert `/proc/partitions` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_pid_fdinfo"></a>
# jc.parsers.proc\_pid\_fdinfo
# jc.parsers.proc_pid_fdinfo
jc - JSON Convert `/proc/<pid>/fdinfo/<fd>` file parser

View File

@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_pid_io"></a>
# jc.parsers.proc\_pid\_io
# jc.parsers.proc_pid_io
jc - JSON Convert `/proc/<pid>/io` file parser

Some files were not shown because too many files have changed in this diff Show More