1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-23 00:29:59 +02:00

update json syntax highlighting

This commit is contained in:
Kelly Brazil
2020-06-25 12:56:06 -07:00
parent be6864b778
commit 6a4f737a0f

203
README.md
View File

@ -299,12 +299,11 @@ $ airport -s | jc --airport-s -p # or: jc -p airport -s
"security": [ "security": [
"NONE" "NONE"
] ]
}, }
...
] ]
``` ```
### arp ### arp
``` ```json
$ arp | jc --arp -p # or: jc -p arp $ arp | jc --arp -p # or: jc -p arp
[ [
{ {
@ -330,7 +329,7 @@ $ arp | jc --arp -p # or: jc -p arp
} }
] ]
``` ```
``` ```json
$ arp -a | jc --arp -p # or: jc -p arp -a $ arp -a | jc --arp -p # or: jc -p arp -a
[ [
{ {
@ -361,7 +360,7 @@ $ arp -a | jc --arp -p # or: jc -p arp -a
] ]
``` ```
### blkid ### blkid
``` ```json
$ blkid | jc --blkid -p # or: jc -p blkid $ blkid | jc --blkid -p # or: jc -p blkid
[ [
{ {
@ -386,7 +385,7 @@ $ blkid | jc --blkid -p # or: jc -p blkid
} }
] ]
``` ```
``` ```json
# blkid -o udev -ip /dev/sda2 | jc --blkid -p # or: jc -p blkid -o udev -ip /dev/sda2 # blkid -o udev -ip /dev/sda2 | jc --blkid -p # or: jc -p blkid -o udev -ip /dev/sda2
[ [
{ {
@ -408,7 +407,7 @@ $ blkid | jc --blkid -p # or: jc -p blkid
] ]
``` ```
### crontab ### crontab
``` ```json
$ cat /etc/crontab | jc --crontab -p # or: jc -p crontab -l $ cat /etc/crontab | jc --crontab -p # or: jc -p crontab -l
{ {
"variables": [ "variables": [
@ -479,7 +478,7 @@ $ cat /etc/crontab | jc --crontab -p # or: jc -p crontab -l
} }
``` ```
### crontab-u (with user support) ### crontab-u (with user support)
``` ```json
$ cat /etc/crontab | jc --crontab-u -p $ cat /etc/crontab | jc --crontab-u -p
{ {
"variables": [ "variables": [
@ -555,7 +554,7 @@ $ cat /etc/crontab | jc --crontab-u -p
} }
``` ```
### CSV files ### CSV files
``` ```json
$ cat homes.csv $ cat homes.csv
"Sell", "List", "Living", "Rooms", "Beds", "Baths", "Age", "Acres", "Taxes" "Sell", "List", "Living", "Rooms", "Beds", "Baths", "Age", "Acres", "Taxes"
142, 160, 28, 10, 5, 3, 60, 0.28, 3167 142, 160, 28, 10, 5, 3, 60, 0.28, 3167
@ -597,12 +596,11 @@ $ cat homes.csv | jc --csv -p
"Age": "41", "Age": "41",
"Acres": "0.33", "Acres": "0.33",
"Taxes": "1471" "Taxes": "1471"
}, }
...
] ]
``` ```
### df ### df
``` ```json
$ df | jc --df -p # or: jc -p df $ df | jc --df -p # or: jc -p df
[ [
{ {
@ -620,12 +618,11 @@ $ df | jc --df -p # or: jc -p df
"available": 1930664, "available": 1930664,
"use_percent": 0, "use_percent": 0,
"mounted_on": "/dev/shm" "mounted_on": "/dev/shm"
}, }
...
] ]
``` ```
### dig ### dig
``` ```json
$ dig cnn.com www.cnn.com @205.251.194.64 | jc --dig -p # or: jc -p dig cnn.com www.cnn.com @205.251.194.64 $ dig cnn.com www.cnn.com @205.251.194.64 | jc --dig -p # or: jc -p dig cnn.com www.cnn.com @205.251.194.64
[ [
{ {
@ -745,7 +742,7 @@ $ dig cnn.com www.cnn.com @205.251.194.64 | jc --dig -p # or: jc -p di
} }
] ]
``` ```
``` ```json
$ dig -x 1.1.1.1 | jc --dig -p # or: jc -p dig -x 1.1.1.1 $ dig -x 1.1.1.1 | jc --dig -p # or: jc -p dig -x 1.1.1.1
[ [
{ {
@ -783,7 +780,7 @@ $ dig -x 1.1.1.1 | jc --dig -p # or: jc -p dig -x 1.1.1.1
] ]
``` ```
### dmidecode ### dmidecode
``` ```json
# dmidecode | jc --dmidecode -p # or: jc -p dmidecode # dmidecode | jc --dmidecode -p # or: jc -p dmidecode
[ [
{ {
@ -824,12 +821,11 @@ $ dig -x 1.1.1.1 | jc --dig -p # or: jc -p dig -x 1.1.1.1
"bios_revision": "4.6", "bios_revision": "4.6",
"firmware_revision": "0.0" "firmware_revision": "0.0"
} }
}, }
...
] ]
``` ```
### du ### du
``` ```json
$ du /usr | jc --du -p # or: jc -p du /usr $ du /usr | jc --du -p # or: jc -p du /usr
[ [
{ {
@ -855,12 +851,11 @@ $ du /usr | jc --du -p # or: jc -p du /usr
{ {
"size": 1008, "size": 1008,
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/Contents/Resources/Firmware/dfu" "name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/Contents/Resources/Firmware/dfu"
}, }
...
] ]
``` ```
### env ### env
``` ```json
$ env | jc --env -p # or: jc -p env $ env | jc --env -p # or: jc -p env
[ [
{ {
@ -882,12 +877,11 @@ $ env | jc --env -p # or: jc -p env
{ {
"name": "HISTSIZE", "name": "HISTSIZE",
"value": "1000" "value": "1000"
}, }
...
] ]
``` ```
### file ### file
``` ```json
$ file * | jc --file -p # or: jc -p file * $ file * | jc --file -p # or: jc -p file *
[ [
{ {
@ -917,12 +911,11 @@ $ file * | jc --file -p # or: jc -p file *
{ {
"filename": "centosserial.sh", "filename": "centosserial.sh",
"type": "Bourne-Again shell script text executable, UTF-8 Unicode text" "type": "Bourne-Again shell script text executable, UTF-8 Unicode text"
}, }
...
] ]
``` ```
### free ### free
``` ```json
$ free | jc --free -p # or: jc -p free $ free | jc --free -p # or: jc -p free
[ [
{ {
@ -943,7 +936,7 @@ $ free | jc --free -p # or: jc -p free
] ]
``` ```
### /etc/fstab file ### /etc/fstab file
``` ```json
$ cat /etc/fstab | jc --fstab -p $ cat /etc/fstab | jc --fstab -p
[ [
{ {
@ -973,7 +966,7 @@ $ cat /etc/fstab | jc --fstab -p
] ]
``` ```
### /etc/group file ### /etc/group file
``` ```json
$ cat /etc/group | jc --group -p $ cat /etc/group | jc --group -p
[ [
{ {
@ -1008,12 +1001,11 @@ $ cat /etc/group | jc --group -p
"_calendar", "_calendar",
"_dovecot" "_dovecot"
] ]
}, }
...
] ]
``` ```
### /etc/gshadow file ### /etc/gshadow file
``` ```json
$ cat /etc/gshadow | jc --gshadow -p $ cat /etc/gshadow | jc --gshadow -p
[ [
{ {
@ -1030,12 +1022,11 @@ $ cat /etc/gshadow | jc --gshadow -p
"syslog", "syslog",
"joeuser" "joeuser"
] ]
}, }
...
] ]
``` ```
### history ### history
``` ```json
$ history | jc --history -p $ history | jc --history -p
[ [
{ {
@ -1053,12 +1044,11 @@ $ history | jc --history -p
{ {
"line": 121, "line": 121,
"command": "docker images" "command": "docker images"
}, }
...
] ]
``` ```
### /etc/hosts file ### /etc/hosts file
``` ```json
$ cat /etc/hosts | jc --hosts -p $ cat /etc/hosts | jc --hosts -p
[ [
{ {
@ -1107,7 +1097,7 @@ $ cat /etc/hosts | jc --hosts -p
] ]
``` ```
### id ### id
``` ```json
$ id | jc --id -p # or: jc -p id $ id | jc --id -p # or: jc -p id
{ {
"uid": { "uid": {
@ -1137,7 +1127,7 @@ $ id | jc --id -p # or: jc -p id
} }
``` ```
### ifconfig ### ifconfig
``` ```json
$ ifconfig | jc --ifconfig -p # or: jc -p ifconfig $ ifconfig | jc --ifconfig -p # or: jc -p ifconfig
[ [
{ {
@ -1222,7 +1212,8 @@ User = hg
[topsecret.server.com] [topsecret.server.com]
Port = 50022 Port = 50022
ForwardX11 = no ForwardX11 = no
```
```json
$ cat example.ini | jc --ini -p $ cat example.ini | jc --ini -p
{ {
"bitbucket.org": { "bitbucket.org": {
@ -1242,7 +1233,7 @@ $ cat example.ini | jc --ini -p
} }
``` ```
### iptables ### iptables
``` ```json
# iptables --line-numbers -v -L -t nat | jc --iptables -p # or: jc -p iptables --line-numbers -v -L -t nat # iptables --line-numbers -v -L -t nat | jc --iptables -p # or: jc -p iptables --line-numbers -v -L -t nat
[ [
{ {
@ -1298,12 +1289,11 @@ $ cat example.ini | jc --ini -p
"options": "ADDRTYPE match dst-type LOCAL" "options": "ADDRTYPE match dst-type LOCAL"
} }
] ]
}, }
...
] ]
``` ```
### jobs ### jobs
``` ```json
$ jobs -l | jc --jobs -p # or: jc -p jobs $ jobs -l | jc --jobs -p # or: jc -p jobs
[ [
{ {
@ -1335,7 +1325,7 @@ $ jobs -l | jc --jobs -p # or: jc -p jobs
] ]
``` ```
### last and lastb ### last and lastb
``` ```json
$ last | jc --last -p # or: jc -p last $ last | jc --last -p # or: jc -p last
[ [
{ {
@ -1360,12 +1350,11 @@ $ last | jc --last -p # or: jc -p last
"login": "Thu Feb 27 10:18", "login": "Thu Feb 27 10:18",
"logout": "10:18", "logout": "10:18",
"duration": "00:00" "duration": "00:00"
}, }
...
] ]
``` ```
### ls ### ls
``` ```json
$ ls -l /usr/bin | jc --ls -p # or: jc -p ls -l /usr/bin $ ls -l /usr/bin | jc --ls -p # or: jc -p ls -l /usr/bin
[ [
{ {
@ -1395,12 +1384,11 @@ $ ls -l /usr/bin | jc --ls -p # or: jc -p ls -l /usr/bin
"group": "root", "group": "root",
"size": 33080, "size": 33080,
"date": "Aug 19 23:25" "date": "Aug 19 23:25"
}, }
...
] ]
``` ```
### lsblk ### lsblk
``` ```json
$ lsblk | jc --lsblk -p # or: jc -p lsblk $ lsblk | jc --lsblk -p # or: jc -p lsblk
[ [
{ {
@ -1420,15 +1408,13 @@ $ lsblk | jc --lsblk -p # or: jc -p lsblk
"ro": false, "ro": false,
"type": "part", "type": "part",
"mountpoint": "/boot" "mountpoint": "/boot"
}, }
...
] ]
``` ```
### lsmod ### lsmod
``` ```json
$ lsmod | jc --lsmod -p # or: jc -p lsmod $ lsmod | jc --lsmod -p # or: jc -p lsmod
[ [
...
{ {
"module": "nf_nat", "module": "nf_nat",
"size": 26583, "size": 26583,
@ -1467,12 +1453,11 @@ $ lsmod | jc --lsmod -p # or: jc -p lsmod
"nf_conntrack_ipv4", "nf_conntrack_ipv4",
"nf_conntrack_ipv6" "nf_conntrack_ipv6"
] ]
}, }
...
] ]
``` ```
### lsof ### lsof
``` ```json
# lsof | jc --lsof -p # or: jc -p lsof # lsof | jc --lsof -p # or: jc -p lsof
[ [
{ {
@ -1510,12 +1495,11 @@ $ lsmod | jc --lsmod -p # or: jc -p lsmod
"size_off": 1624520, "size_off": 1624520,
"node": 50360451, "node": 50360451,
"name": "/usr/lib/systemd/systemd" "name": "/usr/lib/systemd/systemd"
}, }
...
] ]
``` ```
### mount ### mount
``` ```json
$ mount | jc --mount -p # or: jc -p mount $ mount | jc --mount -p # or: jc -p mount
[ [
{ {
@ -1554,12 +1538,11 @@ $ mount | jc --mount -p # or: jc -p mount
"nr_inodes=244375", "nr_inodes=244375",
"mode=755" "mode=755"
] ]
}, }
...
] ]
``` ```
### netstat ### netstat
``` ```json
# netstat -apee | jc --netstat -p # or: jc -p netstat -apee # netstat -apee | jc --netstat -p # or: jc -p netstat -apee
[ [
{ {
@ -1706,8 +1689,7 @@ $ mount | jc --mount -p # or: jc -p mount
"path": "/run/udev/control", "path": "/run/udev/control",
"kind": "socket", "kind": "socket",
"pid": 1 "pid": 1
}, }
...
] ]
$ netstat -r | jc --netstat -p # or: jc -p netstat -r $ netstat -r | jc --netstat -p # or: jc -p netstat -r
@ -1790,7 +1772,7 @@ $ netstat -i | jc --netstat -p # or: jc -p netstat -i
] ]
``` ```
### ntpq ### ntpq
``` ```json
$ ntpq -p | jc --ntpq -p # or: jc -p ntpq -p $ ntpq -p | jc --ntpq -p # or: jc -p ntpq -p
[ [
{ {
@ -1822,7 +1804,7 @@ $ ntpq -p | jc --ntpq -p # or: jc -p ntpq -p
] ]
``` ```
### /etc/passwd file ### /etc/passwd file
``` ```json
$ cat /etc/passwd | jc --passwd -p $ cat /etc/passwd | jc --passwd -p
[ [
{ {
@ -1851,12 +1833,11 @@ $ cat /etc/passwd | jc --passwd -p
"comment": "System Services", "comment": "System Services",
"home": "/var/root", "home": "/var/root",
"shell": "/usr/bin/false" "shell": "/usr/bin/false"
}, }
...
] ]
``` ```
### pip list ### pip list
``` ```json
$ pip list | jc --pip-list -p # or: jc -p pip list # or: jc -p pip3 list $ pip list | jc --pip-list -p # or: jc -p pip list # or: jc -p pip3 list
[ [
{ {
@ -1870,13 +1851,12 @@ $ pip list | jc --pip-list -p # or: jc -p pip list # or: jc
{ {
"package": "asn1crypto", "package": "asn1crypto",
"version": "0.24.0" "version": "0.24.0"
}, }
...
] ]
``` ```
### pip show ### pip show
``` ```json
$ pip show wrapt wheel | jc --pip-show -p # or: jc -p pip show wrapt wheel # or: jc -p pip3 show wrapt wheel $ pip show wrapt wheel | jc --pip-show -p # or: jc -p pip show wrapt wheel # or: jc -p pip3 show wrapt wheel
[ [
{ {
@ -1906,7 +1886,7 @@ $ pip show wrapt wheel | jc --pip-show -p # or: jc -p pip show wrapt w
] ]
``` ```
### ps ### ps
``` ```json
$ ps -ef | jc --ps -p # or: jc -p ps -ef $ ps -ef | jc --ps -p # or: jc -p ps -ef
[ [
{ {
@ -1938,11 +1918,10 @@ $ ps -ef | jc --ps -p # or: jc -p ps -ef
"tty": null, "tty": null,
"time": "00:00:00", "time": "00:00:00",
"cmd": "[kworker/0:0H]" "cmd": "[kworker/0:0H]"
}, }
...
] ]
``` ```
``` ```json
$ ps axu | jc --ps -p # or: jc -p ps axu $ ps axu | jc --ps -p # or: jc -p ps axu
[ [
{ {
@ -1983,12 +1962,11 @@ $ ps axu | jc --ps -p # or: jc -p ps axu
"start": "Nov09", "start": "Nov09",
"time": "0:00", "time": "0:00",
"command": "[kworker/0:0H]" "command": "[kworker/0:0H]"
}, }
...
] ]
``` ```
### route ### route
``` ```json
$ route -ee | jc --route -p # or: jc -p route -ee $ route -ee | jc --route -p # or: jc -p route -ee
[ [
{ {
@ -2027,7 +2005,7 @@ $ route -ee | jc --route -p # or: jc -p route -ee
] ]
``` ```
### /etc/shadow file ### /etc/shadow file
``` ```json
# cat /etc/shadow | jc --shadow -p # cat /etc/shadow | jc --shadow -p
[ [
{ {
@ -2059,12 +2037,11 @@ $ route -ee | jc --route -p # or: jc -p route -ee
"warn": 7, "warn": 7,
"inactive": null, "inactive": null,
"expire": null "expire": null
}, }
...
] ]
``` ```
### ss ### ss
``` ```json
# ss -a | jc --ss -p # or: jc -p ss -a # ss -a | jc --ss -p # or: jc -p ss -a
[ [
{ {
@ -2084,7 +2061,6 @@ $ route -ee | jc --route -p # or: jc -p route -ee
"pid": 893, "pid": 893,
"channel": "rtnl:systemd-resolve" "channel": "rtnl:systemd-resolve"
}, },
...
{ {
"netid": "p_raw", "netid": "p_raw",
"state": "UNCONN", "state": "UNCONN",
@ -2114,7 +2090,6 @@ $ route -ee | jc --route -p # or: jc -p route -ee
"peer_port": "0", "peer_port": "0",
"path": "/run/udev/control" "path": "/run/udev/control"
}, },
...
{ {
"netid": "icmp6", "netid": "icmp6",
"state": "UNCONN", "state": "UNCONN",
@ -2183,8 +2158,8 @@ $ route -ee | jc --route -p # or: jc -p route -ee
] ]
``` ```
### stat ### stat
``` ```json
$ stat /bin/* | jc --stat -p # or: jc -p stat /bin/* $ stat /bin/ | jc --stat -p # or: jc -p stat /bin/
[ [
{ {
"file": "/bin/bash", "file": "/bin/bash",
@ -2225,12 +2200,11 @@ $ stat /bin/* | jc --stat -p # or: jc -p stat /bin/*
"modify_time": "2018-03-12 23:04:27.000000000 +0000", "modify_time": "2018-03-12 23:04:27.000000000 +0000",
"change_time": "2019-08-12 17:21:29.545944399 +0000", "change_time": "2019-08-12 17:21:29.545944399 +0000",
"birth_time": null "birth_time": null
}, }
...
] ]
``` ```
### systemctl ### systemctl
``` ```json
$ systemctl -a | jc --systemctl -p # or: jc -p systemctl -a $ systemctl -a | jc --systemctl -p # or: jc -p systemctl -a
[ [
{ {
@ -2253,12 +2227,11 @@ $ systemctl -a | jc --systemctl -p # or: jc -p systemctl -a
"active": "active", "active": "active",
"sub": "plugged", "sub": "plugged",
"description": "VMware_Virtual_IDE_CDROM_Drive" "description": "VMware_Virtual_IDE_CDROM_Drive"
}, }
...
] ]
``` ```
### systemctl list-jobs ### systemctl list-jobs
``` ```json
$ systemctl list-jobs | jc --systemctl-lj -p # or: jc -p systemctl list-jobs $ systemctl list-jobs | jc --systemctl-lj -p # or: jc -p systemctl list-jobs
[ [
{ {
@ -2282,7 +2255,7 @@ $ systemctl list-jobs | jc --systemctl-lj -p # or: jc -p systemctl lis
] ]
``` ```
### systemctl list-sockets ### systemctl list-sockets
``` ```json
$ systemctl list-sockets | jc --systemctl-ls -p # or: jc -p systemctl list-sockets $ systemctl list-sockets | jc --systemctl-ls -p # or: jc -p systemctl list-sockets
[ [
{ {
@ -2299,12 +2272,11 @@ $ systemctl list-sockets | jc --systemctl-ls -p # or: jc -p systemctl
"listen": "/run/dmeventd-client", "listen": "/run/dmeventd-client",
"unit": "dm-event.socket", "unit": "dm-event.socket",
"activates": "dm-event.service" "activates": "dm-event.service"
}, }
...
] ]
``` ```
### systemctl list-unit-files ### systemctl list-unit-files
``` ```json
$ systemctl list-unit-files | jc --systemctl-luf -p # or: jc -p systemctl list-unit-files $ systemctl list-unit-files | jc --systemctl-luf -p # or: jc -p systemctl list-unit-files
[ [
{ {
@ -2318,12 +2290,11 @@ $ systemctl list-unit-files | jc --systemctl-luf -p # or: jc -p system
{ {
"unit_file": "dev-mqueue.mount", "unit_file": "dev-mqueue.mount",
"state": "static" "state": "static"
}, }
...
] ]
``` ```
### timedatectl status ### timedatectl status
``` ```json
$ timedatectl | jc --timedatectl -p # or: jc -p timedatectl $ timedatectl | jc --timedatectl -p # or: jc -p timedatectl
{ {
"local_time": "Tue 2020-03-10 17:53:21 PDT", "local_time": "Tue 2020-03-10 17:53:21 PDT",
@ -2337,7 +2308,7 @@ $ timedatectl | jc --timedatectl -p # or: jc -p timedatectl
} }
``` ```
### uname -a ### uname -a
``` ```json
$ uname -a | jc --uname -p # or: jc -p uname -a $ uname -a | jc --uname -p # or: jc -p uname -a
{ {
"kernel_name": "Linux", "kernel_name": "Linux",
@ -2351,7 +2322,7 @@ $ uname -a | jc --uname -p # or: jc -p uname -a
} }
``` ```
### uptime ### uptime
``` ```json
$ uptime | jc --uptime -p # or: jc -p uptime $ uptime | jc --uptime -p # or: jc -p uptime
{ {
"time": "11:30:44", "time": "11:30:44",
@ -2363,7 +2334,7 @@ $ uptime | jc --uptime -p # or: jc -p uptime
} }
``` ```
### w ### w
``` ```json
$ w | jc --w -p # or: jc -p w $ w | jc --w -p # or: jc -p w
[ [
{ {
@ -2399,7 +2370,7 @@ $ w | jc --w -p # or: jc -p w
] ]
``` ```
### who ### who
``` ```json
$ who | jc --who -p # or: jc -p who $ who | jc --who -p # or: jc -p who
[ [
{ {
@ -2414,8 +2385,7 @@ $ who | jc --who -p # or: jc -p who
"from": "192.168.71.1" "from": "192.168.71.1"
} }
] ]
```
```
$ who -a | jc --who -p # or: jc -p who -a $ who -a | jc --who -p # or: jc -p who -a
[ [
{ {
@ -2481,7 +2451,8 @@ $ cat cd_catalog.xml
<YEAR>1988</YEAR> <YEAR>1988</YEAR>
</CD> </CD>
... ...
```
```json
$ cat cd_catalog.xml | jc --xml -p $ cat cd_catalog.xml | jc --xml -p
{ {
"CATALOG": { "CATALOG": {
@ -2501,8 +2472,9 @@ $ cat cd_catalog.xml | jc --xml -p
"COMPANY": "CBS Records", "COMPANY": "CBS Records",
"PRICE": "9.90", "PRICE": "9.90",
"YEAR": "1988" "YEAR": "1988"
}, }
... ]
}
} }
``` ```
### YAML files ### YAML files
@ -2527,7 +2499,8 @@ spec:
trafficPolicy: trafficPolicy:
tls: tls:
mode: ISTIO_MUTUAL mode: ISTIO_MUTUAL
```
```json
$ cat istio.yaml | jc --yaml -p $ cat istio.yaml | jc --yaml -p
[ [
{ {