diff --git a/CHANGELOG b/CHANGELOG index 8d665a6b..505a8f83 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,9 +1,9 @@ jc changelog -20231209 v1.24.0 +20231210 v1.24.0 - Add `debconf-show` command parser - Add `iftop` command parser -- Add `pkg-index-alpine` parser for Alpine Linux Package Index files +- Add `pkg-index-apk` parser for Alpine Linux Package Index files - Add `pkg-index-deb` parser for Debian/Ubuntu Package Index files - Add `swapon` command parser - Add `tune2fs` command parser diff --git a/README.md b/README.md index 593f5c49..147c10f7 100644 --- a/README.md +++ b/README.md @@ -252,7 +252,7 @@ option. | `--ping-s` | `ping` and `ping6` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ping_s) | | `--pip-list` | `pip list` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pip_list) | | `--pip-show` | `pip show` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pip_show) | -| `--pkg-index-alpine` | Alpine Linux Package Index file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pkg_index_alpine) | +| `--pkg-index-apk` | Alpine Linux Package Index file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pkg_index_apk) | | `--pkg-index-deb` | Debian Package Index file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pkg_index_deb) | | `--plist` | PLIST file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/plist) | | `--postconf` | `postconf -M` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/postconf) | diff --git a/completions/jc_bash_completion.sh b/completions/jc_bash_completion.sh index 215fc4a0..75cccd50 100644 --- a/completions/jc_bash_completion.sh +++ b/completions/jc_bash_completion.sh @@ -4,7 +4,7 @@ _jc() 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 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 --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-alpine --pkg-index-deb --plist --postconf --proc --proc-buddyinfo --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 --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 --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-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_about_options=(--about -a) jc_about_mod_options=(--pretty -p --yaml-out -y --monochrome -m --force-color -C) diff --git a/completions/jc_zsh_completion.sh b/completions/jc_zsh_completion.sh index a33a96e6..ed5d34e5 100644 --- a/completions/jc_zsh_completion.sh +++ b/completions/jc_zsh_completion.sh @@ -115,7 +115,7 @@ _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 --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 --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-alpine --pkg-index-deb --plist --postconf --proc --proc-buddyinfo --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 --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 --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-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' @@ -212,7 +212,7 @@ _jc() { '--ping-s:`ping` and `ping6` command streaming parser' '--pip-list:`pip list` command parser' '--pip-show:`pip show` command parser' - '--pkg-index-alpine:Alpine Linux Package Index file parser' + '--pkg-index-apk:Alpine Linux Package Index file parser' '--pkg-index-deb:Debian Package Index file parser' '--plist:PLIST file parser' '--postconf:`postconf -M` command parser' diff --git a/jc/lib.py b/jc/lib.py index d61b6682..f82ca34f 100644 --- a/jc/lib.py +++ b/jc/lib.py @@ -107,7 +107,7 @@ parsers: List[str] = [ 'ping-s', 'pip-list', 'pip-show', - 'pkg-index-alpine', + 'pkg-index-apk', 'pkg-index-deb', 'plist', 'postconf', diff --git a/jc/parsers/pkg_index_alpine.py b/jc/parsers/pkg_index_apk.py similarity index 96% rename from jc/parsers/pkg_index_alpine.py rename to jc/parsers/pkg_index_apk.py index 1523a39e..3dd228dd 100644 --- a/jc/parsers/pkg_index_alpine.py +++ b/jc/parsers/pkg_index_apk.py @@ -2,12 +2,12 @@ Usage (cli): - $ cat APKINDEX | jc --pkg-index-alpine + $ cat APKINDEX | jc --pkg-index-apk Usage (module): import jc - result = jc.parse('pkg_index_alpine', pkg_index_alpine_output) + result = jc.parse('pkg_index_apk', pkg_index_apk_output) Schema: @@ -44,7 +44,7 @@ Schema: Example: - $ cat APKINDEX | jc --pkg-index-alpine + $ cat APKINDEX | jc --pkg-index-apk [ { "checksum": "Q1znBl9k+RKgY6gl5Eg3iz73KZbLY=", @@ -74,7 +74,7 @@ Example: } ] - $ cat APKINDEX | jc --pkg-index-alpine --raw + $ cat APKINDEX | jc --pkg-index-apk --raw [ { "C": "Q1znBl9k+RKgY6gl5Eg3iz73KZbLY=", diff --git a/man/jc.1 b/man/jc.1 index c1576ce8..547b3a53 100644 --- a/man/jc.1 +++ b/man/jc.1 @@ -514,7 +514,7 @@ PostgreSQL password file parser .TP .B -\fB--pkg-index-alpine\fP +\fB--pkg-index-apk\fP Alpine Linux Package Index file parser .TP diff --git a/tests/fixtures/generic/pkg-index-alpine-raw.json b/tests/fixtures/generic/pkg-index-apk-raw.json similarity index 100% rename from tests/fixtures/generic/pkg-index-alpine-raw.json rename to tests/fixtures/generic/pkg-index-apk-raw.json diff --git a/tests/fixtures/generic/pkg-index-alpine.json b/tests/fixtures/generic/pkg-index-apk.json similarity index 100% rename from tests/fixtures/generic/pkg-index-alpine.json rename to tests/fixtures/generic/pkg-index-apk.json diff --git a/tests/fixtures/generic/pkg-index-alpine.out b/tests/fixtures/generic/pkg-index-apk.out similarity index 100% rename from tests/fixtures/generic/pkg-index-alpine.out rename to tests/fixtures/generic/pkg-index-apk.out diff --git a/tests/test_pkg_index_alpine.py b/tests/test_pkg_index_apk.py similarity index 66% rename from tests/test_pkg_index_alpine.py rename to tests/test_pkg_index_apk.py index b4f8d314..acfe65aa 100644 --- a/tests/test_pkg_index_alpine.py +++ b/tests/test_pkg_index_apk.py @@ -2,7 +2,7 @@ import os import unittest import json from typing import Dict -from jc.parsers.pkg_index_alpine import parse +from jc.parsers.pkg_index_apk import parse THIS_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -15,11 +15,11 @@ class Apkindex(unittest.TestCase): def setUpClass(cls): fixtures = { 'normal': ( - 'fixtures/generic/pkg-index-alpine.out', - 'fixtures/generic/pkg-index-alpine.json'), + 'fixtures/generic/pkg-index-apk.out', + 'fixtures/generic/pkg-index-apk.json'), 'raw': ( - 'fixtures/generic/pkg-index-alpine.out', - 'fixtures/generic/pkg-index-alpine-raw.json') + 'fixtures/generic/pkg-index-apk.out', + 'fixtures/generic/pkg-index-apk-raw.json') } for file, filepaths in fixtures.items(): @@ -29,16 +29,16 @@ class Apkindex(unittest.TestCase): cls.f_json[file] = json.loads(b.read()) - def test_pkg_index_alpine_nodata(self): + def test_pkg_index_apk_nodata(self): """ - Test 'pkg-index-alpine' with no data + Test 'pkg-index-apk' with no data """ self.assertEqual(parse('', quiet=True), []) - def test_pkg_index_alpine(self): + def test_pkg_index_apk(self): """ - Test 'pkg-index-alpine' normal output + Test 'pkg-index-apk' normal output """ self.assertEqual( parse(self.f_in['normal'], quiet=True), @@ -46,9 +46,9 @@ class Apkindex(unittest.TestCase): ) - def test_pkg_index_alpine_raw(self): + def test_pkg_index_apk_raw(self): """ - Test 'pkg-index-alpine' raw output + Test 'pkg-index-apk' raw output """ self.assertEqual( parse(self.f_in['raw'], quiet=True, raw=True),