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

version bump and doc update

This commit is contained in:
Kelly Brazil
2024-01-03 15:57:08 -08:00
parent a260ceba1c
commit 2d5d87c73d
21 changed files with 76 additions and 21 deletions

View File

@ -13,7 +13,7 @@ jc changelog
- Add source link to online parser documentation
- Refactor parser aliases for `kv`, `pkg_index_deb`, `lsb_release`, and `os-release`
- TODO: Add `line_slice` function to `utils.py`
- TODO: Update copyright date
- Update copyright date
20231216 v1.24.0
- Add `debconf-show` command parser

View File

@ -331,6 +331,7 @@ option.
| `-p` | `--pretty` | Pretty format the JSON output |
| `-q` | `--quiet` | Quiet mode. Suppresses parser warning messages (use `-qq` to ignore streaming parser errors) |
| `-r` | `--raw` | Raw output. Provides more literal output, typically with string values and no additional semantic processing |
| `-s` | `--slurp` | Slurp multiple lines into an array. (use `-hhh` to find compatible parsers) |
| `-u` | `--unbuffer` | Unbuffer output |
| `-v` | `--version` | Version information |
| `-y` | `--yaml-out` | YAML output |
@ -1314,4 +1315,4 @@ cat istio.yaml | jc -p --yaml
]
```
© 2019-2023 Kelly Brazil
© 2019-2024 Kelly Brazil

View File

@ -5,7 +5,7 @@ _jc()
jc_commands=(acpi airport arp blkid bluetoothctl cbt certbot chage cksum crontab date debconf-show df dig dmidecode dpkg du 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 --date --datetime-iso --debconf-show --df --dig --dir --dmidecode --dpkg-l --du --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 --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 --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 --unbuffer -u --yaml-out -y)
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)
jc_help_options=(--help -h)

View File

@ -329,7 +329,7 @@ _jc() {
'--zpool-iostat:`zpool iostat` command parser'
'--zpool-status:`zpool status` command parser'
)
jc_options=(--force-color -C --debug -d --monochrome -m --meta-out -M --pretty -p --quiet -q --raw -r --unbuffer -u --yaml-out -y)
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_options_describe=(
'--force-color:force color output (overrides -m)'
'-C:force color output (overrides -m)'
@ -345,6 +345,8 @@ _jc() {
'-q:suppress warnings (double to ignore streaming errors)'
'--raw:raw output'
'-r:raw output'
'--slurp:slurp multiple lines into an array'
'-s:slurp multiple lines into an array'
'--unbuffer:unbuffer output'
'-u:unbuffer output'
'--yaml-out:YAML output'

View File

@ -132,6 +132,12 @@ for parser in "${parsers[@]}"; do
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"
fi

View File

@ -6,6 +6,7 @@
* [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)
@ -156,6 +157,18 @@ def streaming_parser_mod_list(show_hidden: bool = False,
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

View File

@ -102,4 +102,6 @@ Compatibility: linux, darwin, freebsd
Source: [`jc/parsers/date.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/date.py)
Version 2.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
This parser can be used with the `--slurp` command-line option.
Version 2.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -90,4 +90,6 @@ Compatibility: linux, aix, freebsd, darwin, win32, cygwin
Source: [`jc/parsers/datetime_iso.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/datetime_iso.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
This parser can be used with the `--slurp` command-line option.
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -66,4 +66,6 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Source: [`jc/parsers/email_address.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/email_address.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
This parser can be used with the `--slurp` command-line option.
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -554,4 +554,6 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Source: [`jc/parsers/ip_address.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ip_address.py)
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
This parser can be used with the `--slurp` command-line option.
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -72,4 +72,6 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Source: [`jc/parsers/jwt.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/jwt.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
This parser can be used with the `--slurp` command-line option.
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -76,4 +76,6 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Source: [`jc/parsers/semver.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/semver.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
This parser can be used with the `--slurp` command-line option.
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -121,4 +121,6 @@ Compatibility: linux, aix, freebsd, darwin, win32, cygwin
Source: [`jc/parsers/timestamp.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/timestamp.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
This parser can be used with the `--slurp` command-line option.
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -259,4 +259,6 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Source: [`jc/parsers/url.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/url.py)
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
This parser can be used with the `--slurp` command-line option.
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -111,4 +111,6 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Source: [`jc/parsers/ver.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ver.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
This parser can be used with the `--slurp` command-line option.
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -55,7 +55,7 @@ class info():
author: str = 'Kelly Brazil'
author_email: str = 'kellyjonbrazil@gmail.com'
website: str = 'https://github.com/kellyjonbrazil/jc'
copyright: str = '© 2019-2023 Kelly Brazil'
copyright: str = '© 2019-2024 Kelly Brazil'
license: str = 'MIT License'
@ -283,6 +283,7 @@ class JcCli():
'standard_parser_count': len(standard_parser_mod_list(show_hidden=True, show_deprecated=True)),
'streaming_parser_count': len(streaming_parser_mod_list(show_hidden=True, show_deprecated=True)),
'plugin_parser_count': len(plugin_parser_mod_list(show_hidden=True, show_deprecated=True)),
'slurpable_parser_count': len(slurpable_parser_mod_list(show_hidden=True, show_deprecated=True)),
'parsers': all_parser_info(show_hidden=True, show_deprecated=True)
}
@ -315,9 +316,15 @@ class JcCli():
version: str = p_info.get('version', 'unknown')
author: str = p_info.get('author', 'unknown')
author_email: str = p_info.get('author_email', 'unknown')
slurpy = ''
if 'slurpable' in p_info.get('tags', []):
slurpy = 'This parser can be used with the --slurp command-line option.\n\n'
doc_text: str = \
f'{docs}\n'\
f'Compatibility: {compatible}\n\n'\
f'{docs}\n' \
f'Compatibility: {compatible}\n\n' \
f'{slurpy}' \
f'Version {version} by {author} ({author_email})\n'
utils._safe_pager(doc_text)
@ -770,7 +777,6 @@ class JcCli():
if self.parser_module:
if self.slurp:
self.create_slurp_output()
else:
self.create_normal_output()

View File

@ -9,7 +9,7 @@ from .jc_types import ParserInfoType, JSONDictType
from jc import appdirs
__version__ = '1.24.0'
__version__ = '1.24.1'
parsers: List[str] = [
'acpi',

View File

@ -1,4 +1,4 @@
.TH jc 1 2023-12-22 1.24.0 "JSON Convert"
.TH jc 1 2024-01-03 1.24.1 "JSON Convert"
.SH NAME
\fBjc\fP \- JSON Convert JSONifies the output of many CLI tools, file-types,
and strings
@ -1142,6 +1142,10 @@ Raw output. Provides more literal output, typically with string values and no
additional semantic processing
.TP
.B
\fB-s\fP, \fB--slurp\fP
Slurp multiple lines into an array. (use \fB-hhh\fP` to find compatible parsers)
.TP
.B
\fB-u\fP, \fB--unbuffer\fP
Unbuffer output (useful for slow streaming data with streaming parsers)
.TP
@ -1510,6 +1514,6 @@ Kelly Brazil (kellyjonbrazil@gmail.com)
https://github.com/kellyjonbrazil/jc
.SH COPYRIGHT
Copyright (c) 2019-2023 Kelly Brazil
Copyright (c) 2019-2024 Kelly Brazil
License: MIT License

View File

@ -5,7 +5,7 @@ with open('README.md', 'r') as f:
setuptools.setup(
name='jc',
version='1.24.0',
version='1.24.1',
author='Kelly Brazil',
author_email='kellyjonbrazil@gmail.com',
description='Converts the output of popular command-line tools and file-types to JSON.',

View File

@ -92,6 +92,10 @@ Raw output. Provides more literal output, typically with string values and no
additional semantic processing
.TP
.B
\fB-s\fP, \fB--slurp\fP
Slurp multiple lines into an array. (use \fB-hhh\fP` to find compatible parsers)
.TP
.B
\fB-u\fP, \fB--unbuffer\fP
Unbuffer output (useful for slow streaming data with streaming parsers)
.TP

View File

@ -172,6 +172,7 @@ option.
| `-p` | `--pretty` | Pretty format the JSON output |
| `-q` | `--quiet` | Quiet mode. Suppresses parser warning messages (use `-qq` to ignore streaming parser errors) |
| `-r` | `--raw` | Raw output. Provides more literal output, typically with string values and no additional semantic processing |
| `-s` | `--slurp` | Slurp multiple lines into an array. (use `-hhh` to find compatible parsers) |
| `-u` | `--unbuffer` | Unbuffer output |
| `-v` | `--version` | Version information |
| `-y` | `--yaml-out` | YAML output |