From 3166600ac69ddbb4ebabf5f9fd9c117e2e4809c7 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Thu, 4 Aug 2022 11:43:49 -0700 Subject: [PATCH] doc update --- CHANGELOG | 3 +++ README.md | 3 ++- completions/jc_bash_completion.sh | 2 +- completions/jc_zsh_completion.sh | 6 ++++-- docs/parsers/plist.md | 6 ++++++ docs/parsers/timestamp.md | 2 +- docs/parsers/x509_cert.md | 2 +- jc/parsers/plist.py | 2 ++ man/jc.1 | 8 ++++++-- templates/manpage_template | 4 ++++ templates/readme_template | 1 + 11 files changed, 31 insertions(+), 8 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7192d0e7..40c7e710 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,9 @@ jc changelog xxxxxxxx v1.20.5 - Add IP Address string parser +- Add PLIST file parser (XML and binary support) +- Add `mdadm` command parser tested on linux (IN PROGRESS) +- Add `--time-out` or `-t` option to add a UTC timestamp to the JSON output - Fix `lsusb` command parser for output containing a `Device Qualifier` and `Binary Object Store Descriptor` sections - Change `LANG=C` to `LC_ALL=C` in locale instructions diff --git a/README.md b/README.md index 278f6420..94df9da5 100644 --- a/README.md +++ b/README.md @@ -240,7 +240,7 @@ option. | ` --systeminfo` | `systeminfo` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/systeminfo) | | ` --time` | `/usr/bin/time` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/time) | | ` --timedatectl` | `timedatectl status` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/timedatectl) | -| ` --timestamp` | UNIX Epoch Timestamp string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/timestamp) | +| ` --timestamp` | Unix Epoch Timestamp string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/timestamp) | | ` --top` | `top -b` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/top) | | ` --top-s` | `top -b` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/top_s) | | ` --tracepath` | `tracepath` and `tracepath6` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/tracepath) | @@ -276,6 +276,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 | +| `-t` | `--time-out` | Add UTC Unix timestamp information to output | | `-u` | `--unbuffer` | Unbuffer output | | `-v` | `--version` | Version information | | `-y` | `--yaml-out` | YAML output | diff --git a/completions/jc_bash_completion.sh b/completions/jc_bash_completion.sh index 0e31b000..b1230cc8 100644 --- a/completions/jc_bash_completion.sh +++ b/completions/jc_bash_completion.sh @@ -5,7 +5,7 @@ _jc() jc_commands=(acpi airport arp blkid chage cksum crontab date df dig dmidecode dpkg du env file finger free git gpg hciconfig id ifconfig iostat iptables iw jobs last lastb ls lsblk lsmod lsof lsusb md5 md5sum mount mpstat netstat nmcli ntpq pidstat ping ping6 pip pip3 postconf printenv ps route rpm rsync sfdisk sha1sum sha224sum sha256sum sha384sum sha512sum shasum ss stat sum sysctl systemctl systeminfo timedatectl top tracepath tracepath6 traceroute traceroute6 ufw uname update-alternatives upower uptime vdir vmstat w wc who xrandr zipinfo) jc_parsers=(--acpi --airport --airport-s --arp --asciitable --asciitable-m --blkid --chage --cksum --crontab --crontab-u --csv --csv-s --date --df --dig --dir --dmidecode --dpkg-l --du --email-address --env --file --finger --free --fstab --git-log --git-log-s --gpg --group --gshadow --hash --hashsum --hciconfig --history --hosts --id --ifconfig --ini --iostat --iostat-s --ip-address --iptables --iso-datetime --iw-scan --jar-manifest --jobs --jwt --kv --last --ls --ls-s --lsblk --lsmod --lsof --lsusb --m3u --mount --mpstat --mpstat-s --netstat --nmcli --ntpq --passwd --pidstat --pidstat-s --ping --ping-s --pip-list --pip-show --plist --postconf --ps --route --rpm-qi --rsync --rsync-s --sfdisk --shadow --ss --stat --stat-s --sysctl --systemctl --systemctl-lj --systemctl-ls --systemctl-luf --systeminfo --time --timedatectl --timestamp --top --top-s --tracepath --traceroute --ufw --ufw-appinfo --uname --update-alt-gs --update-alt-q --upower --uptime --url --vmstat --vmstat-s --w --wc --who --x509-cert --xml --xrandr --yaml --zipinfo) - jc_options=(--force-color -C --debug -d --monochrome -m --pretty -p --quiet -q --raw -r --unbuffer -u --yaml-out -y) + jc_options=(--force-color -C --debug -d --monochrome -m --pretty -p --quiet -q --raw -r --time-out -t --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) diff --git a/completions/jc_zsh_completion.sh b/completions/jc_zsh_completion.sh index 38614a4d..153489df 100644 --- a/completions/jc_zsh_completion.sh +++ b/completions/jc_zsh_completion.sh @@ -186,7 +186,7 @@ _jc() { '--systeminfo:`systeminfo` command parser' '--time:`/usr/bin/time` command parser' '--timedatectl:`timedatectl status` command parser' - '--timestamp:UNIX Epoch Timestamp string parser' + '--timestamp:Unix Epoch Timestamp string parser' '--top:`top -b` command parser' '--top-s:`top -b` command streaming parser' '--tracepath:`tracepath` and `tracepath6` command parser' @@ -210,7 +210,7 @@ _jc() { '--yaml:YAML file parser' '--zipinfo:`zipinfo` command parser' ) - jc_options=(--force-color -C --debug -d --monochrome -m --pretty -p --quiet -q --raw -r --unbuffer -u --yaml-out -y) + jc_options=(--force-color -C --debug -d --monochrome -m --pretty -p --quiet -q --raw -r --time-out -t --unbuffer -u --yaml-out -y) jc_options_describe=( '--force-color:force color output even when using pipes (overrides -m)' '-C:force color output even when using pipes (overrides -m)' @@ -224,6 +224,8 @@ _jc() { '-q:suppress warnings (double to ignore streaming errors)' '--raw:raw output' '-r:raw output' + '--time-out:add UTC Unix timestamp information to output' + '-t:add UTC Unix timestamp information to output' '--unbuffer:unbuffer output' '-u:unbuffer output' '--yaml-out:YAML output' diff --git a/docs/parsers/plist.md b/docs/parsers/plist.md index 0e1869d5..3e77c28c 100644 --- a/docs/parsers/plist.md +++ b/docs/parsers/plist.md @@ -7,6 +7,12 @@ jc - JSON Convert PLIST file parser Converts binary and XML PLIST files. +Binary values are converted into an ASCII hex representation. + +Datetime objects are converted into Unix epoch timestamps and ISO strings. +The timestamp and ISO string will maintain the same naive or timezone-aware +properties as the object in the original PLIST file. + Usage (cli): $ cat file.plist | jc --plist diff --git a/docs/parsers/timestamp.md b/docs/parsers/timestamp.md index 9706a1bd..a5d07abd 100644 --- a/docs/parsers/timestamp.md +++ b/docs/parsers/timestamp.md @@ -3,7 +3,7 @@ # jc.parsers.timestamp -jc - JSON Convert UNIX Epoch Timestamp string parser +jc - JSON Convert Unix Epoch Timestamp string parser The naive fields are based on the local time of the system the parser is run on. diff --git a/docs/parsers/x509_cert.md b/docs/parsers/x509_cert.md index ad4ee7b5..e5208d85 100644 --- a/docs/parsers/x509_cert.md +++ b/docs/parsers/x509_cert.md @@ -155,7 +155,7 @@ Schema: ] } - Signed Certificate Timestamp List + Signed Certificate Timestamp List: { "extn_id": "signed_certificate_timestamp_list", "critical": boolean, diff --git a/jc/parsers/plist.py b/jc/parsers/plist.py index bf812215..0dbbab52 100644 --- a/jc/parsers/plist.py +++ b/jc/parsers/plist.py @@ -5,6 +5,8 @@ Converts binary and XML PLIST files. Binary values are converted into an ASCII hex representation. Datetime objects are converted into Unix epoch timestamps and ISO strings. +The timestamp and ISO string will maintain the same naive or timezone-aware +properties as the object in the original PLIST file. Usage (cli): diff --git a/man/jc.1 b/man/jc.1 index faaf14de..aa71bcde 100644 --- a/man/jc.1 +++ b/man/jc.1 @@ -1,4 +1,4 @@ -.TH jc 1 2022-07-31 1.20.5 "JSON Convert" +.TH jc 1 2022-08-04 1.20.5 "JSON Convert" .SH NAME \fBjc\fP \- JSON Convert JSONifies the output of many CLI tools and file-types .SH SYNOPSIS @@ -470,7 +470,7 @@ PLIST file parser .TP .B \fB--timestamp\fP -UNIX Epoch Timestamp string parser +Unix Epoch Timestamp string parser .TP .B @@ -623,6 +623,10 @@ Quiet mode. Suppresses parser warning messages (use -qq to ignore streaming pars Raw output. Provides more literal output, typically with string values and no additional semantic processing .TP .B +\fB-t\fP, \fB--time-out\fP +Add UTC Unix timestamp information to output +.TP +.B \fB-u\fP, \fB--unbuffer\fP Unbuffer output (useful for slow streaming data with streaming parsers) .TP diff --git a/templates/manpage_template b/templates/manpage_template index 5bb644b8..26a97307 100644 --- a/templates/manpage_template +++ b/templates/manpage_template @@ -63,6 +63,10 @@ Quiet mode. Suppresses parser warning messages (use -qq to ignore streaming pars Raw output. Provides more literal output, typically with string values and no additional semantic processing .TP .B +\fB-t\fP, \fB--time-out\fP +Add UTC Unix timestamp information to output +.TP +.B \fB-u\fP, \fB--unbuffer\fP Unbuffer output (useful for slow streaming data with streaming parsers) .TP diff --git a/templates/readme_template b/templates/readme_template index 27bb1e5f..32c5a0aa 100644 --- a/templates/readme_template +++ b/templates/readme_template @@ -164,6 +164,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 | +| `-t` | `--time-out` | Add UTC Unix timestamp information to output | | `-u` | `--unbuffer` | Unbuffer output | | `-v` | `--version` | Version information | | `-y` | `--yaml-out` | YAML output |