mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-13 01:20:24 +02:00
doc update
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
jc changelog
|
||||
|
||||
20240202 v1.25.0
|
||||
20240204 v1.25.0
|
||||
- Add `--slurp` functionality to wrap output from multiple lines into a single array.
|
||||
Note, this only works with single-line input parsers. (e.g. `date`, `ip-address`, `url`, etc.)
|
||||
Streaming parsers are not supported. Use `jc -hhh` to find parsers compatible with the slurp option.
|
||||
@ -11,6 +11,8 @@ jc changelog
|
||||
For `/proc` file magic syntax, this is a list of `/proc` filenames in order. This can help with
|
||||
identifying which input matches to which output when using `--slurp` or when converting multiple
|
||||
files via `/proc` file magic syntax.
|
||||
- Add `curl-head` command parser for `curl --head` or `curl -I` with verbose support
|
||||
- Add `http-headers` parser for plain HTTP header output
|
||||
- Add `kv-dup` parser for Key/Value files with duplicate keys
|
||||
- Add `path` string parser to parse posix path
|
||||
- Add `path-list` string parser to parse path list strings found in env variables
|
||||
|
@ -176,6 +176,7 @@ option.
|
||||
| `--crontab-u` | `crontab` file parser with user support | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/crontab_u) |
|
||||
| `--csv` | CSV file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/csv) |
|
||||
| `--csv-s` | CSV file streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/csv_s) |
|
||||
| `--curl-head` | `curl --head` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/curl_head) |
|
||||
| `--date` | `date` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/date) |
|
||||
| `--datetime-iso` | ISO 8601 Datetime string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/datetime_iso) |
|
||||
| `--debconf-show` | `debconf-show` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/debconf_show) |
|
||||
@ -205,6 +206,7 @@ option.
|
||||
| `--history` | `history` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/history) |
|
||||
| `--host` | `host` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/host) |
|
||||
| `--hosts` | `/etc/hosts` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/hosts) |
|
||||
| `--http-headers` | HTTP headers parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/http_headers) |
|
||||
| `--id` | `id` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/id) |
|
||||
| `--ifconfig` | `ifconfig` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ifconfig) |
|
||||
| `--ini` | INI file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ini) |
|
||||
|
@ -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 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 --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 arp blkid bluetoothctl cbt certbot chage cksum crontab curl 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 --curl-head --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 --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_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)
|
||||
|
@ -9,7 +9,7 @@ _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 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_commands=(acpi airport arp blkid bluetoothctl cbt certbot chage cksum crontab curl 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_commands_describe=(
|
||||
'acpi:run "acpi" command with magic syntax.'
|
||||
'airport:run "airport" command with magic syntax.'
|
||||
@ -21,6 +21,7 @@ _jc() {
|
||||
'chage:run "chage" command with magic syntax.'
|
||||
'cksum:run "cksum" command with magic syntax.'
|
||||
'crontab:run "crontab" command with magic syntax.'
|
||||
'curl:run "curl" command with magic syntax.'
|
||||
'date:run "date" command with magic syntax.'
|
||||
'debconf-show:run "debconf-show" command with magic syntax.'
|
||||
'df:run "df" command with magic syntax.'
|
||||
@ -115,7 +116,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 --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 --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 --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_describe=(
|
||||
'--acpi:`acpi` command parser'
|
||||
'--airport:`airport -I` command parser'
|
||||
@ -137,6 +138,7 @@ _jc() {
|
||||
'--crontab-u:`crontab` file parser with user support'
|
||||
'--csv:CSV file parser'
|
||||
'--csv-s:CSV file streaming parser'
|
||||
'--curl-head:`curl --head` command parser'
|
||||
'--date:`date` command parser'
|
||||
'--datetime-iso:ISO 8601 Datetime string parser'
|
||||
'--debconf-show:`debconf-show` command parser'
|
||||
@ -166,6 +168,7 @@ _jc() {
|
||||
'--history:`history` command parser'
|
||||
'--host:`host` command parser'
|
||||
'--hosts:`/etc/hosts` file parser'
|
||||
'--http-headers:HTTP headers parser'
|
||||
'--id:`id` command parser'
|
||||
'--ifconfig:`ifconfig` command parser'
|
||||
'--ini:INI file parser'
|
||||
|
238
docs/parsers/curl_head.md
Normal file
238
docs/parsers/curl_head.md
Normal file
@ -0,0 +1,238 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.curl_head"></a>
|
||||
|
||||
# jc.parsers.curl\_head
|
||||
|
||||
jc - JSON Convert `curl --head` command output parser
|
||||
|
||||
This parser converts standard and verbose `curl --head` output.
|
||||
|
||||
When converting verbose output from `curl` (to gather request headers, for
|
||||
example) you will need to redirect STDERR to STDOUT with `2>&1`. The magic
|
||||
syntax will not work in this case.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ curl --head www.example.com | jc --curl-head
|
||||
$ curl -Ivs www.example.com 2>&1 | jc --curl-head
|
||||
|
||||
or
|
||||
|
||||
$ jc curl --head www.example.com
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('curl_head', curl_head_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"<header>": string,
|
||||
"accept": [
|
||||
string
|
||||
],
|
||||
"accept-ch": [
|
||||
string
|
||||
],
|
||||
"accept-ch-lifetime": integer,
|
||||
"accept-encoding": [
|
||||
string
|
||||
],
|
||||
"accept-language": [
|
||||
string
|
||||
],
|
||||
"accept-patch": [
|
||||
string
|
||||
],
|
||||
"accept-post": [
|
||||
string
|
||||
],
|
||||
"accept-ranges": [
|
||||
string
|
||||
],
|
||||
"access-control-allow-headers": [
|
||||
string
|
||||
],
|
||||
"access-control-allow-methods": [
|
||||
string
|
||||
],
|
||||
"access-control-expose-headers": [
|
||||
string
|
||||
],
|
||||
"access-control-max-age": integer,
|
||||
"access-control-request-headers": [
|
||||
string
|
||||
],
|
||||
"age": integer,
|
||||
"allow": [
|
||||
string
|
||||
],
|
||||
"alt-svc": [
|
||||
string
|
||||
],
|
||||
"cache-control": [
|
||||
string
|
||||
],
|
||||
"clear-site-data": [
|
||||
string
|
||||
],
|
||||
"connection": [
|
||||
string
|
||||
],
|
||||
"content-encoding": [
|
||||
string
|
||||
],
|
||||
"content-dpr": integer,
|
||||
"content-language": [
|
||||
string
|
||||
],
|
||||
"content-length": integer,
|
||||
"content-security-policy": [
|
||||
string
|
||||
],
|
||||
"content-security-policy-report-only": [
|
||||
string
|
||||
],
|
||||
"cookie": [
|
||||
string
|
||||
],
|
||||
"critical-ch": [
|
||||
string
|
||||
],
|
||||
"date": string,
|
||||
"date_epoch_utc": integer,
|
||||
"expect-ct": [
|
||||
string
|
||||
],
|
||||
"expires": string,
|
||||
"expires_epoch_utc": integer,
|
||||
"device-memory": integer,
|
||||
"downlink": integer,
|
||||
"dpr": integer,
|
||||
"forwarded": [
|
||||
string
|
||||
],
|
||||
"if-match": [
|
||||
string
|
||||
],
|
||||
"if-modified-since": string,
|
||||
"if-modified-since_epoch_utc": integer,
|
||||
"if-none-match": [
|
||||
string
|
||||
],
|
||||
"if-range": string,
|
||||
"if-range_epoch_utc": integer,
|
||||
"if-unmodified-since": string,
|
||||
"if-unmodified-since_epoch_utc": integer,
|
||||
"im": [
|
||||
string
|
||||
],
|
||||
"keep-alive": [
|
||||
string
|
||||
],
|
||||
"large-allocation": integer,
|
||||
"last-modified": string,
|
||||
"last-modified_epoch_utc": integer,
|
||||
"link": [
|
||||
string
|
||||
],
|
||||
"max-forwards": integer,
|
||||
"memento-datetime": string,
|
||||
"memento-datetime_epoch_utc": integer,
|
||||
"permissions-policy": [
|
||||
string
|
||||
],
|
||||
"pragma": [
|
||||
string
|
||||
],
|
||||
"proxy-authenticate": [
|
||||
string
|
||||
],
|
||||
"retry-after": string,
|
||||
"retry-after_epoch_utc": integer,
|
||||
"rtt": integer,
|
||||
"sec-ch-ua": [
|
||||
string
|
||||
],
|
||||
"sec-ch-ua-full-version-list": [
|
||||
string
|
||||
],
|
||||
"server": [
|
||||
string
|
||||
],
|
||||
"server-timing": [
|
||||
string
|
||||
],
|
||||
"set-cookie": [
|
||||
string
|
||||
],
|
||||
"timing-allow-origin": [
|
||||
string
|
||||
],
|
||||
"trailer": [
|
||||
string
|
||||
],
|
||||
"transfer-encoding": [
|
||||
string
|
||||
],
|
||||
"upgrade": [
|
||||
string
|
||||
],
|
||||
"upgrade-insecure-requests": integer,
|
||||
"vary": [
|
||||
string
|
||||
],
|
||||
"via": [
|
||||
string
|
||||
],
|
||||
"warning": [
|
||||
string
|
||||
],
|
||||
"www-authenticate": [
|
||||
string
|
||||
],
|
||||
"x-cache-hits": [
|
||||
integer
|
||||
],
|
||||
"x-content-duration": float
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ curl-head | jc --curl-head -p
|
||||
[]
|
||||
|
||||
$ curl-head | jc --curl-head -p -r
|
||||
[]
|
||||
|
||||
<a id="jc.parsers.curl_head.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str,
|
||||
raw: bool = False,
|
||||
quiet: bool = False) -> List[JSONDictType]
|
||||
```
|
||||
|
||||
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, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/curl_head.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/curl_head.py)
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
243
docs/parsers/http_headers.md
Normal file
243
docs/parsers/http_headers.md
Normal file
@ -0,0 +1,243 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.http_headers"></a>
|
||||
|
||||
# jc.parsers.http\_headers
|
||||
|
||||
jc - JSON Convert HTTP headers parser
|
||||
|
||||
Converts HTTP request and response headers into a list of dictionaries.
|
||||
Well-known headers are processed to allow multiple instances which are
|
||||
aggregated into an array along with any comma-separated values. Integer,
|
||||
float, and datetimes are converted where defined in the specifications.
|
||||
|
||||
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
|
||||
https://datatracker.ietf.org/doc/html/rfc2616
|
||||
https://datatracker.ietf.org/doc/html/rfc3229
|
||||
https://datatracker.ietf.org/doc/html/rfc7089
|
||||
https://datatracker.ietf.org/doc/html/rfc7231
|
||||
https://datatracker.ietf.org/doc/html/rfc5789
|
||||
|
||||
If you are converting HTTP headers from `curl` verbose output, use the
|
||||
`curl-head` parser which will strip the `>` and `<` characters and remove
|
||||
non-header lines that begin with `*`.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cat headers.txt | jc --http-headers
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('http_headers', http_headers_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"<header>": string,
|
||||
"accept": [
|
||||
string
|
||||
],
|
||||
"accept-ch": [
|
||||
string
|
||||
],
|
||||
"accept-ch-lifetime": integer,
|
||||
"accept-encoding": [
|
||||
string
|
||||
],
|
||||
"accept-language": [
|
||||
string
|
||||
],
|
||||
"accept-patch": [
|
||||
string
|
||||
],
|
||||
"accept-post": [
|
||||
string
|
||||
],
|
||||
"accept-ranges": [
|
||||
string
|
||||
],
|
||||
"access-control-allow-headers": [
|
||||
string
|
||||
],
|
||||
"access-control-allow-methods": [
|
||||
string
|
||||
],
|
||||
"access-control-expose-headers": [
|
||||
string
|
||||
],
|
||||
"access-control-max-age": integer,
|
||||
"access-control-request-headers": [
|
||||
string
|
||||
],
|
||||
"age": integer,
|
||||
"allow": [
|
||||
string
|
||||
],
|
||||
"alt-svc": [
|
||||
string
|
||||
],
|
||||
"cache-control": [
|
||||
string
|
||||
],
|
||||
"clear-site-data": [
|
||||
string
|
||||
],
|
||||
"connection": [
|
||||
string
|
||||
],
|
||||
"content-encoding": [
|
||||
string
|
||||
],
|
||||
"content-dpr": integer,
|
||||
"content-language": [
|
||||
string
|
||||
],
|
||||
"content-length": integer,
|
||||
"content-security-policy": [
|
||||
string
|
||||
],
|
||||
"content-security-policy-report-only": [
|
||||
string
|
||||
],
|
||||
"cookie": [
|
||||
string
|
||||
],
|
||||
"critical-ch": [
|
||||
string
|
||||
],
|
||||
"date": string,
|
||||
"date_epoch_utc": integer,
|
||||
"expect-ct": [
|
||||
string
|
||||
],
|
||||
"expires": string,
|
||||
"expires_epoch_utc": integer,
|
||||
"device-memory": integer,
|
||||
"downlink": integer,
|
||||
"dpr": integer,
|
||||
"forwarded": [
|
||||
string
|
||||
],
|
||||
"if-match": [
|
||||
string
|
||||
],
|
||||
"if-modified-since": string,
|
||||
"if-modified-since_epoch_utc": integer,
|
||||
"if-none-match": [
|
||||
string
|
||||
],
|
||||
"if-range": string,
|
||||
"if-range_epoch_utc": integer,
|
||||
"if-unmodified-since": string,
|
||||
"if-unmodified-since_epoch_utc": integer,
|
||||
"im": [
|
||||
string
|
||||
],
|
||||
"keep-alive": [
|
||||
string
|
||||
],
|
||||
"large-allocation": integer,
|
||||
"last-modified": string,
|
||||
"last-modified_epoch_utc": integer,
|
||||
"link": [
|
||||
string
|
||||
],
|
||||
"max-forwards": integer,
|
||||
"memento-datetime": string,
|
||||
"memento-datetime_epoch_utc": integer,
|
||||
"permissions-policy": [
|
||||
string
|
||||
],
|
||||
"pragma": [
|
||||
string
|
||||
],
|
||||
"proxy-authenticate": [
|
||||
string
|
||||
],
|
||||
"retry-after": string,
|
||||
"retry-after_epoch_utc": integer,
|
||||
"rtt": integer,
|
||||
"sec-ch-ua": [
|
||||
string
|
||||
],
|
||||
"sec-ch-ua-full-version-list": [
|
||||
string
|
||||
],
|
||||
"server": [
|
||||
string
|
||||
],
|
||||
"server-timing": [
|
||||
string
|
||||
],
|
||||
"set-cookie": [
|
||||
string
|
||||
],
|
||||
"timing-allow-origin": [
|
||||
string
|
||||
],
|
||||
"trailer": [
|
||||
string
|
||||
],
|
||||
"transfer-encoding": [
|
||||
string
|
||||
],
|
||||
"upgrade": [
|
||||
string
|
||||
],
|
||||
"upgrade-insecure-requests": integer,
|
||||
"vary": [
|
||||
string
|
||||
],
|
||||
"via": [
|
||||
string
|
||||
],
|
||||
"warning": [
|
||||
string
|
||||
],
|
||||
"www-authenticate": [
|
||||
string
|
||||
],
|
||||
"x-cache-hits": [
|
||||
integer
|
||||
],
|
||||
"x-content-duration": float
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ curl-head | jc --curl-head -p
|
||||
[]
|
||||
|
||||
$ curl-head | jc --curl-head -p -r
|
||||
[]
|
||||
|
||||
<a id="jc.parsers.http_headers.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
```python
|
||||
def parse(data: str,
|
||||
raw: bool = False,
|
||||
quiet: bool = False) -> List[JSONDictType]
|
||||
```
|
||||
|
||||
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, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Source: [`jc/parsers/http_headers.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/http_headers.py)
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
12
man/jc.1
12
man/jc.1
@ -1,4 +1,4 @@
|
||||
.TH jc 1 2024-02-02 1.25.0 "JSON Convert"
|
||||
.TH jc 1 2024-02-04 1.25.0 "JSON Convert"
|
||||
.SH NAME
|
||||
\fBjc\fP \- JSON Convert JSONifies the output of many CLI tools, file-types,
|
||||
and strings
|
||||
@ -137,6 +137,11 @@ CSV file parser
|
||||
\fB--csv-s\fP
|
||||
CSV file streaming parser
|
||||
|
||||
.TP
|
||||
.B
|
||||
\fB--curl-head\fP
|
||||
`curl --head` command parser
|
||||
|
||||
.TP
|
||||
.B
|
||||
\fB--date\fP
|
||||
@ -282,6 +287,11 @@ hashsum command parser (`md5sum`, `shasum`, etc.)
|
||||
\fB--hosts\fP
|
||||
`/etc/hosts` file parser
|
||||
|
||||
.TP
|
||||
.B
|
||||
\fB--http-headers\fP
|
||||
HTTP headers parser
|
||||
|
||||
.TP
|
||||
.B
|
||||
\fB--id\fP
|
||||
|
Reference in New Issue
Block a user