From 59b105580805d78516abe1c1069d52a6f0a8131a Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Wed, 5 Aug 2020 16:51:58 -0700 Subject: [PATCH] enhance docs --- docs/parsers/airport_s.md | 2 +- docs/parsers/arp.md | 12 +++++++----- docs/parsers/blkid.md | 8 ++++++-- docs/parsers/crontab.md | 10 ++++++++-- docs/parsers/crontab_u.md | 6 ++++-- docs/parsers/csv.md | 9 ++++----- docs/parsers/date.md | 8 ++++++-- docs/parsers/df.md | 8 ++++++-- docs/parsers/dig.md | 8 ++++++-- docs/parsers/dmidecode.md | 8 ++++++-- docs/parsers/du.md | 8 ++++++-- docs/parsers/env.md | 8 ++++++-- docs/parsers/file.md | 8 ++++++-- docs/parsers/free.md | 8 ++++++-- docs/parsers/fstab.md | 4 ++-- docs/parsers/group.md | 4 ++-- docs/parsers/gshadow.md | 4 ++-- docs/parsers/history.md | 4 ++-- docs/parsers/hosts.md | 4 ++-- docs/parsers/id.md | 8 ++++++-- docs/parsers/ifconfig.md | 10 +++++++--- docs/parsers/ini.md | 10 ++++++---- docs/parsers/iptables.md | 10 +++++++--- docs/parsers/jobs.md | 10 +++++++--- docs/parsers/kv.md | 11 +++++++---- docs/parsers/last.md | 8 ++++++-- docs/parsers/ls.md | 21 ++++++++++----------- docs/parsers/lsblk.md | 8 ++++++-- docs/parsers/lsmod.md | 8 ++++++-- docs/parsers/lsof.md | 8 ++++++-- docs/parsers/mount.md | 8 ++++++-- docs/parsers/netstat.md | 17 ++++++++++------- docs/parsers/ntpq.md | 8 ++++++-- docs/parsers/passwd.md | 4 ++-- docs/parsers/ping.md | 12 +++++++++--- docs/parsers/pip_list.md | 8 ++++++-- docs/parsers/pip_show.md | 8 ++++++-- docs/parsers/ps.md | 14 +++++++++----- docs/parsers/route.md | 8 ++++++-- docs/parsers/shadow.md | 4 ++-- docs/parsers/ss.md | 8 ++++++-- docs/parsers/stat.md | 8 ++++++-- docs/parsers/sysctl.md | 16 +++++++++------- docs/parsers/systemctl.md | 8 ++++++-- docs/parsers/systemctl_lj.md | 8 ++++++-- docs/parsers/systemctl_ls.md | 8 ++++++-- docs/parsers/systemctl_luf.md | 8 ++++++-- docs/parsers/timedatectl.md | 8 ++++++-- docs/parsers/tracepath.md | 10 ++++++++-- docs/parsers/traceroute.md | 16 ++++++++++------ docs/parsers/uname.md | 8 ++++++-- docs/parsers/uptime.md | 8 ++++++-- docs/parsers/w.md | 8 ++++++-- docs/parsers/who.md | 10 +++++++--- docs/parsers/xml.md | 4 ++-- docs/parsers/yaml.md | 4 ++-- jc/parsers/group.py | 4 ++-- jc/parsers/gshadow.py | 4 ++-- jc/parsers/history.py | 4 ++-- jc/parsers/hosts.py | 4 ++-- jc/parsers/id.py | 8 ++++++-- jc/parsers/ifconfig.py | 10 +++++++--- jc/parsers/ini.py | 10 ++++++---- jc/parsers/iptables.py | 10 +++++++--- jc/parsers/jobs.py | 10 +++++++--- jc/parsers/kv.py | 11 +++++++---- jc/parsers/last.py | 8 ++++++-- jc/parsers/ls.py | 21 ++++++++++----------- jc/parsers/lsblk.py | 8 ++++++-- jc/parsers/lsmod.py | 8 ++++++-- jc/parsers/lsof.py | 8 ++++++-- jc/parsers/mount.py | 8 ++++++-- jc/parsers/netstat.py | 17 ++++++++++------- jc/parsers/ntpq.py | 8 ++++++-- jc/parsers/passwd.py | 4 ++-- jc/parsers/ping.py | 12 +++++++++--- jc/parsers/pip_list.py | 8 ++++++-- jc/parsers/pip_show.py | 8 ++++++-- jc/parsers/ps.py | 14 +++++++++----- jc/parsers/route.py | 8 ++++++-- jc/parsers/shadow.py | 4 ++-- jc/parsers/ss.py | 8 ++++++-- jc/parsers/stat.py | 8 ++++++-- jc/parsers/sysctl.py | 16 +++++++++------- jc/parsers/systemctl.py | 8 ++++++-- jc/parsers/systemctl_lj.py | 8 ++++++-- jc/parsers/systemctl_ls.py | 8 ++++++-- jc/parsers/systemctl_luf.py | 8 ++++++-- jc/parsers/timedatectl.py | 8 ++++++-- jc/parsers/tracepath.py | 10 ++++++++-- jc/parsers/traceroute.py | 16 ++++++++++------ jc/parsers/uname.py | 8 ++++++-- jc/parsers/uptime.py | 8 ++++++-- jc/parsers/w.py | 8 ++++++-- jc/parsers/who.py | 10 +++++++--- jc/parsers/xml.py | 4 ++-- jc/parsers/yaml.py | 4 ++-- 97 files changed, 564 insertions(+), 269 deletions(-) diff --git a/docs/parsers/airport_s.md b/docs/parsers/airport_s.md index 89daa3e7..bf436e1a 100644 --- a/docs/parsers/airport_s.md +++ b/docs/parsers/airport_s.md @@ -1,6 +1,6 @@ # jc.parsers.airport_s -jc - JSON CLI output utility `airport -s` command parser +jc - JSON CLI output utility `airport -s` command output parser The `airport` program can be found at `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport`. diff --git a/docs/parsers/arp.md b/docs/parsers/arp.md index 2ca3ea26..95669611 100644 --- a/docs/parsers/arp.md +++ b/docs/parsers/arp.md @@ -1,14 +1,16 @@ # jc.parsers.arp -jc - JSON CLI output utility arp Parser +jc - JSON CLI output utility `arp` command output parser + +Supports `arp` and `arp -a` output. Usage (cli): - specify --arp as the first argument if the piped input is coming from: + $ arp | jc --arp - arp - or - arp -a + or + + $ jc arp Usage (module): diff --git a/docs/parsers/blkid.md b/docs/parsers/blkid.md index 660ce04d..243d40c8 100644 --- a/docs/parsers/blkid.md +++ b/docs/parsers/blkid.md @@ -1,10 +1,14 @@ # jc.parsers.blkid -jc - JSON CLI output utility blkid Parser +jc - JSON CLI output utility `blkid` command output parser Usage (cli): - specify --blkid as the first argument if the piped input is coming from blkid + $ blkid | jc --blkid + + or + + $ jc blkid Usage (module): diff --git a/docs/parsers/crontab.md b/docs/parsers/crontab.md index 2e630ac3..be58d445 100644 --- a/docs/parsers/crontab.md +++ b/docs/parsers/crontab.md @@ -1,10 +1,16 @@ # jc.parsers.crontab -jc - JSON CLI output utility crontab command and file Parser +jc - JSON CLI output utility `crontab -l` command output and crontab file parser + +Supports `crontab -l` command output and crontab files. Usage (cli): - specify --crontab as the first argument if the piped input is coming from crontab -l or a crontab file + $ crontab -l | jc --crontab + + or + + $ jc crontab -l Usage (module): diff --git a/docs/parsers/crontab_u.md b/docs/parsers/crontab_u.md index c506b09e..c29c7837 100644 --- a/docs/parsers/crontab_u.md +++ b/docs/parsers/crontab_u.md @@ -1,10 +1,12 @@ # jc.parsers.crontab_u -jc - JSON CLI output utility crontab file Parser +jc - JSON CLI output utility `crontab -l` command output and crontab file parser + +This version of the `crontab -l` parser supports output that contains user information for processes. Usage (cli): - specify --crontab-u as the first argument if the piped input is coming from a crontab file with User specified + $ crontab -l | jc --crontab-u Usage (module): diff --git a/docs/parsers/csv.md b/docs/parsers/csv.md index 4f564103..6ea2099f 100644 --- a/docs/parsers/csv.md +++ b/docs/parsers/csv.md @@ -1,13 +1,12 @@ # jc.parsers.csv -jc - JSON CLI output utility csv Parser +jc - JSON CLI output utility `csv` file parser + +The `csv` parser will attempt to automatically detect the delimiter character. If the delimiter cannot be detected it will default to comma. The first row of the file must be a header row. Usage (cli): - specify --csv as the first argument if the piped input is coming from a csv file. - the csv parser will attempt to automatically detect the delimiter character. - if the delimiter cannot be detected it will default to comma. - the first row of the file must be a header row. + $ cat file.csv | jc --csv Usage (module): diff --git a/docs/parsers/date.md b/docs/parsers/date.md index b0d92dc1..61cc6897 100644 --- a/docs/parsers/date.md +++ b/docs/parsers/date.md @@ -1,10 +1,14 @@ # jc.parsers.date -jc - JSON CLI output utility date Parser +jc - JSON CLI output utility `date` command output parser Usage (cli): - specify --date as the first argument if the piped input is coming from date + $ date | jc --date + + or + + $ jc date Usage (module): diff --git a/docs/parsers/df.md b/docs/parsers/df.md index bf54c8df..826ea81f 100644 --- a/docs/parsers/df.md +++ b/docs/parsers/df.md @@ -1,10 +1,14 @@ # jc.parsers.df -jc - JSON CLI output utility df Parser +jc - JSON CLI output utility `df` command output parser Usage (cli): - specify --df as the first argument if the piped input is coming from df + $ df | jc --df + + or + + $ jc df Usage (module): diff --git a/docs/parsers/dig.md b/docs/parsers/dig.md index b3429204..c8d57bcb 100644 --- a/docs/parsers/dig.md +++ b/docs/parsers/dig.md @@ -1,10 +1,14 @@ # jc.parsers.dig -jc - JSON CLI output utility dig Parser +jc - JSON CLI output utility `dig` command output parser Usage (cli): - Specify --dig as the first argument if the piped input is coming from dig + $ dig example.com | jc --dig + + or + + $ jc dig example.com Usage (module): diff --git a/docs/parsers/dmidecode.md b/docs/parsers/dmidecode.md index 5f672ef4..7528b26e 100644 --- a/docs/parsers/dmidecode.md +++ b/docs/parsers/dmidecode.md @@ -1,10 +1,14 @@ # jc.parsers.dmidecode -jc - JSON CLI output utility dmidecode Parser +jc - JSON CLI output utility `dmidecode` command output parser Usage (cli): - specify --dmidecode as the first argument if the piped input is coming from dmidecode + $ dmidecode | jc --dmidecode + + or + + $ jc dmidecode Usage (module): diff --git a/docs/parsers/du.md b/docs/parsers/du.md index f4a833fd..9d802eb8 100644 --- a/docs/parsers/du.md +++ b/docs/parsers/du.md @@ -1,10 +1,14 @@ # jc.parsers.du -jc - JSON CLI output utility du Parser +jc - JSON CLI output utility `du` command output parser Usage (cli): - specify --du as the first argument if the piped input is coming from du + $ du | jc --du + + or + + $ jc du Usage (module): diff --git a/docs/parsers/env.md b/docs/parsers/env.md index 6abc175b..096af3e7 100644 --- a/docs/parsers/env.md +++ b/docs/parsers/env.md @@ -1,10 +1,14 @@ # jc.parsers.env -jc - JSON CLI output utility env Parser +jc - JSON CLI output utility `env` command output parser Usage (cli): - specify --env as the first argument if the piped input is coming from env + $ env | jc --env + + or + + $ jc env Usage (module): diff --git a/docs/parsers/file.md b/docs/parsers/file.md index 2350c443..8f37f654 100644 --- a/docs/parsers/file.md +++ b/docs/parsers/file.md @@ -1,10 +1,14 @@ # jc.parsers.file -jc - JSON CLI output utility file command Parser +jc - JSON CLI output utility `file` command output parser Usage (cli): - specify --file as the first argument if the piped input is coming from file. + $ file * | jc --file + + or + + $ jc file * Usage (module): diff --git a/docs/parsers/free.md b/docs/parsers/free.md index 0dbdb952..e9bc3cdb 100644 --- a/docs/parsers/free.md +++ b/docs/parsers/free.md @@ -1,10 +1,14 @@ # jc.parsers.free -jc - JSON CLI output utility free Parser +jc - JSON CLI output utility `free` command output parser Usage (cli): - specify --free as the first argument if the piped input is coming from free + $ free | jc --free + + or + + $ jc free Usage (module): diff --git a/docs/parsers/fstab.md b/docs/parsers/fstab.md index d686ffa3..e86d81d0 100644 --- a/docs/parsers/fstab.md +++ b/docs/parsers/fstab.md @@ -1,10 +1,10 @@ # jc.parsers.fstab -jc - JSON CLI output utility fstab Parser +jc - JSON CLI output utility `fstab` file parser Usage (cli): - specify --fstab as the first argument if the piped input is coming from a fstab file + $ cat /etc/fstab | jc --fstab Usage (module): diff --git a/docs/parsers/group.md b/docs/parsers/group.md index 5ee1678c..768d0898 100644 --- a/docs/parsers/group.md +++ b/docs/parsers/group.md @@ -1,10 +1,10 @@ # jc.parsers.group -jc - JSON CLI output utility /etc/group file Parser +jc - JSON CLI output utility `/etc/group` file parser Usage (cli): - specify --group as the first argument if the piped input is coming from /etc/group + $ cat /etc/group | jc --group Usage (module): diff --git a/docs/parsers/gshadow.md b/docs/parsers/gshadow.md index 49bb0739..6b80d493 100644 --- a/docs/parsers/gshadow.md +++ b/docs/parsers/gshadow.md @@ -1,10 +1,10 @@ # jc.parsers.gshadow -jc - JSON CLI output utility /etc/gshadow file Parser +jc - JSON CLI output utility `/etc/gshadow` file parser Usage (cli): - specify --gshadow as the first argument if the piped input is coming from /etc/gshadow + $ cat /etc/gshadow | jc --gshadow Usage (module): diff --git a/docs/parsers/history.md b/docs/parsers/history.md index 8fc0623b..77e3459d 100644 --- a/docs/parsers/history.md +++ b/docs/parsers/history.md @@ -1,10 +1,10 @@ # jc.parsers.history -jc - JSON CLI output utility history Parser +jc - JSON CLI output utility `history` command output parser Usage (cli): - specify --history as the first argument if the piped input is coming from history + $ history | jc --history Usage (module): diff --git a/docs/parsers/hosts.md b/docs/parsers/hosts.md index 7dbade0c..459d695d 100644 --- a/docs/parsers/hosts.md +++ b/docs/parsers/hosts.md @@ -1,10 +1,10 @@ # jc.parsers.hosts -jc - JSON CLI output utility hosts Parser +jc - JSON CLI output utility `/etc/hosts` file parser Usage (cli): - specify --hosts as the first argument if the piped input is coming from a hosts file + $ cat /etc/hosts | jc --hosts Usage (module): diff --git a/docs/parsers/id.md b/docs/parsers/id.md index 828f4420..c392353d 100644 --- a/docs/parsers/id.md +++ b/docs/parsers/id.md @@ -1,10 +1,14 @@ # jc.parsers.id -jc - JSON CLI output utility id Parser +jc - JSON CLI output utility `id` command output parser Usage (cli): - specify --id as the first argument if the piped input is coming from id + $ id | jc --id + + or + + $ jc id Usage (module): diff --git a/docs/parsers/ifconfig.md b/docs/parsers/ifconfig.md index 7bbd6860..58a01c46 100644 --- a/docs/parsers/ifconfig.md +++ b/docs/parsers/ifconfig.md @@ -1,12 +1,16 @@ # jc.parsers.ifconfig -jc - JSON CLI output utility ifconfig Parser +jc - JSON CLI output utility `ifconfig` command output parser + +Note: No `ifconfig` options are supported. Usage (cli): - specify --ifconfig as the first argument if the piped input is coming from ifconfig + $ ifconfig | jc --ifconfig - no ifconfig options are supported. + or + + $ jc ifconfig Usage (module): diff --git a/docs/parsers/ini.md b/docs/parsers/ini.md index e341f2c4..fbd5cbb7 100644 --- a/docs/parsers/ini.md +++ b/docs/parsers/ini.md @@ -1,12 +1,14 @@ # jc.parsers.ini -jc - JSON CLI output utility INI Parser +jc - JSON CLI output utility `INI` file parser + +Parses standard `INI` files and files containing simple key/value pairs. Delimiter can be `=` or `:`. Missing values are supported. Comment prefix can be `#` or `;`. Comments must be on their own line. + +Note: Values starting and ending with quotation marks will have the marks removed. If you would like to keep the quotation marks, use the `-r` command-line argument or the `raw=True` argument in `parse()`. Usage (cli): - Specify --ini as the first argument if the piped input is coming from an INI file or any - simple key/value pair file. Delimiter can be '=' or ':'. Missing values are supported. - Comment prefix can be '#' or ';'. Comments must be on their own line. + $ cat foo.ini | jc --ini Usage (module): diff --git a/docs/parsers/iptables.md b/docs/parsers/iptables.md index b3c25139..0206ce50 100644 --- a/docs/parsers/iptables.md +++ b/docs/parsers/iptables.md @@ -1,12 +1,16 @@ # jc.parsers.iptables -jc - JSON CLI output utility ipables Parser +jc - JSON CLI output utility `ipables` command output parser + +Supports `-vLn` and `--line-numbers` for all tables. Usage (cli): - Specify --iptables as the first argument if the piped input is coming from iptables + $ sudo iptables -L -t nat | jc --iptables - Supports -vLn and --line-numbers for all tables + or + + $ jc iptables -L -t nat Usage (module): diff --git a/docs/parsers/jobs.md b/docs/parsers/jobs.md index c140a455..19dbc81f 100644 --- a/docs/parsers/jobs.md +++ b/docs/parsers/jobs.md @@ -1,12 +1,16 @@ # jc.parsers.jobs -jc - JSON CLI output utility jobs Parser +jc - JSON CLI output utility `jobs` command output parser + +Also supports the `-l` option. Usage (cli): - specify --jobs as the first argument if the piped input is coming from jobs + $ jobs | jc --jobs - Also supports the -l option + or + + $ jc jobs Usage (module): diff --git a/docs/parsers/kv.md b/docs/parsers/kv.md index 95f07c31..2ba6e825 100644 --- a/docs/parsers/kv.md +++ b/docs/parsers/kv.md @@ -1,12 +1,15 @@ # jc.parsers.kv -jc - JSON CLI output utility Key/Value File Parser +jc - JSON CLI output utility `Key/Value` file parser + +Supports files containing simple key/value pairs. Delimiter can be `=` or `:`. Missing values are supported. Comment prefix can be `#` or `;`. Comments must be on their own line. + +Note: Values starting and ending with quotation marks will have the marks removed. If you would like to keep the quotation marks, use the `-r` command-line argument or the `raw=True` argument in `parse()`. + Usage (cli): - Specify --kv as the first argument if the piped input is coming from a simple - key/value pair file. Delimiter can be '=' or ':'. Missing values are supported. - Comment prefix can be '#' or ';'. Comments must be on their own line. + $ cat foo.txt | jc --kv Usage (module): diff --git a/docs/parsers/last.md b/docs/parsers/last.md index 0c0901b1..16ad5070 100644 --- a/docs/parsers/last.md +++ b/docs/parsers/last.md @@ -1,10 +1,14 @@ # jc.parsers.last -jc - JSON CLI output utility last Parser +jc - JSON CLI output utility `last` and `lastb` command output parser Usage (cli): - specify --last as the first argument if the piped input is coming from last or lastb + $ last | jc --last + + or + + $ jc last Usage (module): diff --git a/docs/parsers/ls.md b/docs/parsers/ls.md index a93868af..c46ee00c 100644 --- a/docs/parsers/ls.md +++ b/docs/parsers/ls.md @@ -1,22 +1,21 @@ # jc.parsers.ls -jc - JSON CLI output utility ls Parser +jc - JSON CLI output utility `ls` command output parser -Note: The -l or -b option of ls should be used to correctly parse filenames that include newline characters. - Since ls does not encode newlines in filenames when outputting to a pipe it will cause jc to see - multiple files instead of a single file if -l or -b is not used. +Options supported: +- `lbaR` +- `--time-style=full-iso` +- `-h`: File sizes will be available in text form with `-r` but larger file sizes with human readable suffixes will be converted to `Null` in the default view since the parser attempts to convert this field to an integer. + +Note: The `-l` or `-b` option of `ls` should be used to correctly parse filenames that include newline characters. Since `ls` does not encode newlines in filenames when outputting to a pipe it will cause `jc` to see multiple files instead of a single file if `-l` or `-b` is not used. Usage (cli): - specify --ls as the first argument if the piped input is coming from ls + $ ls | jc --ls - ls options supported: + or - -lbaR - --time-style=full-iso - -h file sizes will be available in text form with -r but larger file sizes - with human readable suffixes will be converted to Null in default view - since the parser attempts to convert this field to an integer. + $ jc ls Usage (module): diff --git a/docs/parsers/lsblk.md b/docs/parsers/lsblk.md index 5b7548a9..8f96273a 100644 --- a/docs/parsers/lsblk.md +++ b/docs/parsers/lsblk.md @@ -1,10 +1,14 @@ # jc.parsers.lsblk -jc - JSON CLI output utility lsblk Parser +jc - JSON CLI output utility `lsblk` command output parser Usage (cli): - specify --lsblk as the first argument if the piped input is coming from lsblk + $ lsblk | jc --lsblk + + or + + $ jc lsblk Usage (module): diff --git a/docs/parsers/lsmod.md b/docs/parsers/lsmod.md index 3bdb63d1..ebec2dc6 100644 --- a/docs/parsers/lsmod.md +++ b/docs/parsers/lsmod.md @@ -1,10 +1,14 @@ # jc.parsers.lsmod -jc - JSON CLI output utility lsmod Parser +jc - JSON CLI output utility `lsmod` command output parser Usage (cli): - specify --lsmod as the first argument if the piped input is coming from lsmod + $ lsmod | jc --lsmod + + or + + $ jc lsmod Usage (module): diff --git a/docs/parsers/lsof.md b/docs/parsers/lsof.md index 8bee4d4f..fc3e7c6e 100644 --- a/docs/parsers/lsof.md +++ b/docs/parsers/lsof.md @@ -1,10 +1,14 @@ # jc.parsers.lsof -jc - JSON CLI output utility lsof Parser +jc - JSON CLI output utility `lsof` command output parser Usage (cli): - specify --lsof as the first argument if the piped input is coming from lsof + $ lsof | jc --lsof + + or + + $ jc lsof Usage (module): diff --git a/docs/parsers/mount.md b/docs/parsers/mount.md index a39a7b33..fbf01a1d 100644 --- a/docs/parsers/mount.md +++ b/docs/parsers/mount.md @@ -1,10 +1,14 @@ # jc.parsers.mount -jc - JSON CLI output utility mount Parser +jc - JSON CLI output utility `mount` command output parser Usage (cli): - specify --mount as the first argument if the piped input is coming from mount + $ mount | jc --mount + + or + + $ jc mount Usage (module): diff --git a/docs/parsers/netstat.md b/docs/parsers/netstat.md index 393f6152..ef297b9a 100644 --- a/docs/parsers/netstat.md +++ b/docs/parsers/netstat.md @@ -1,21 +1,24 @@ # jc.parsers.netstat -jc - JSON CLI output utility netstat Parser +jc - JSON CLI output utility `netstat` command output parser + +Caveats: +- Use of multiple `l` options is not supported on OSX (e.g. `netstat -rlll`) +- Use of the `A` option is not supported on OSX when using the `r` option (e.g. `netstat -rA`) Usage (cli): - Specify --netstat as the first argument if the piped input is coming from netstat + $ netstat | jc --netstat + + or + + $ jc netstat Usage (module): import jc.parsers.netstat result = jc.parsers.netstat.parse(netstat_command_output) -Caveats: - - - Use of multiple 'l' options is not supported on OSX (e.g. 'netstat -rlll') - - Use of the 'A' option is not supported on OSX when using the 'r' option (e.g. netstat -rA) - Compatibility: 'linux', 'darwin', 'freebsd' diff --git a/docs/parsers/ntpq.md b/docs/parsers/ntpq.md index 2594608b..78544261 100644 --- a/docs/parsers/ntpq.md +++ b/docs/parsers/ntpq.md @@ -1,10 +1,14 @@ # jc.parsers.ntpq -jc - JSON CLI output utility ntpq Parser +jc - JSON CLI output utility `ntpq -p` command output parser Usage (cli): - specify --ntpq as the first argument if the piped input is coming from ntpq -p + $ ntpq -p | jc --ntpq + + or + + $ jc ntpq -p Usage (module): diff --git a/docs/parsers/passwd.md b/docs/parsers/passwd.md index 79a26240..f10b6dd6 100644 --- a/docs/parsers/passwd.md +++ b/docs/parsers/passwd.md @@ -1,10 +1,10 @@ # jc.parsers.passwd -jc - JSON CLI output utility /etc/passwd file Parser +jc - JSON CLI output utility `/etc/passwd` file Parser Usage (cli): - specify --passwd as the first argument if the piped input is coming from /etc/passwd + $ cat /etc/passwd | jc --passwd Usage (module): diff --git a/docs/parsers/ping.md b/docs/parsers/ping.md index dc8f2c49..464c239c 100644 --- a/docs/parsers/ping.md +++ b/docs/parsers/ping.md @@ -1,12 +1,18 @@ # jc.parsers.ping -jc - JSON CLI output utility ping Parser +jc - JSON CLI output utility `ping` command output parser + +Supports `ping` and `ping6` output. Usage (cli): - specify --ping as the first argument if the piped input is coming from ping + Note: Use the ping `-c` (count) option, otherwise data will not be piped to `jc`. - Note: Use the ping -c (count) option, otherwise data will not be piped to jc. + $ ping -c 3 1.2.3.4 | jc --ping + + or + + $ jc ping -c 3 1.2.3.4 Usage (module): diff --git a/docs/parsers/pip_list.md b/docs/parsers/pip_list.md index 928f0c45..d57f3b65 100644 --- a/docs/parsers/pip_list.md +++ b/docs/parsers/pip_list.md @@ -1,10 +1,14 @@ # jc.parsers.pip_list -jc - JSON CLI output utility pip-list Parser +jc - JSON CLI output utility `pip-list` command output parser Usage (cli): - specify --pip-list as the first argument if the piped input is coming from pip list + $ pip list | jc --pip-list + + or + + $ jc pip list Usage (module): diff --git a/docs/parsers/pip_show.md b/docs/parsers/pip_show.md index f170ce1d..1efde887 100644 --- a/docs/parsers/pip_show.md +++ b/docs/parsers/pip_show.md @@ -1,10 +1,14 @@ # jc.parsers.pip_show -jc - JSON CLI output utility pip-show Parser +jc - JSON CLI output utility `pip-show` command output parser Usage (cli): - specify --pip-show as the first argument if the piped input is coming from pip show + $ pip show | jc --pip-show + + or + + $ jc pip show Usage (module): diff --git a/docs/parsers/ps.md b/docs/parsers/ps.md index c4b3bc65..2a5d1690 100644 --- a/docs/parsers/ps.md +++ b/docs/parsers/ps.md @@ -1,14 +1,18 @@ # jc.parsers.ps -jc - JSON CLI output utility ps Parser +jc - JSON CLI output utility `ps` command output parser + +`ps` options supported: +- `ef` +- `axu` Usage (cli): - specify --ps as the first argument if the piped input is coming from ps + $ ps | jc --ps - ps options supported: - - ef - - axu + or + + $ jc ps Usage (module): diff --git a/docs/parsers/route.md b/docs/parsers/route.md index b36643e3..957ab3bf 100644 --- a/docs/parsers/route.md +++ b/docs/parsers/route.md @@ -1,10 +1,14 @@ # jc.parsers.route -jc - JSON CLI output utility route Parser +jc - JSON CLI output utility `route` command output parser Usage (cli): - specify --route as the first argument if the piped input is coming from route + $ route | jc --route + + or + + $ jc route Usage (module): diff --git a/docs/parsers/shadow.md b/docs/parsers/shadow.md index f0692db1..bda7bca8 100644 --- a/docs/parsers/shadow.md +++ b/docs/parsers/shadow.md @@ -1,10 +1,10 @@ # jc.parsers.shadow -jc - JSON CLI output utility /etc/shadow file Parser +jc - JSON CLI output utility `/etc/shadow` file parser Usage (cli): - specify --shadow as the first argument if the piped input is coming from /etc/shadow + $ sudo cat /etc/shadow | jc --shadow Usage (module): diff --git a/docs/parsers/ss.md b/docs/parsers/ss.md index a6adb12a..7a9c2035 100644 --- a/docs/parsers/ss.md +++ b/docs/parsers/ss.md @@ -1,10 +1,14 @@ # jc.parsers.ss -jc - JSON CLI output utility ss Parser +jc - JSON CLI output utility `ss` command output parser Usage (cli): - specify --ss as the first argument if the piped input is coming from ss + $ ss | jc --ss + + or + + $ jc ss Usage (module): diff --git a/docs/parsers/stat.md b/docs/parsers/stat.md index 51cb1632..5f6ae105 100644 --- a/docs/parsers/stat.md +++ b/docs/parsers/stat.md @@ -1,10 +1,14 @@ # jc.parsers.stat -jc - JSON CLI output utility stat Parser +jc - JSON CLI output utility `stat` command output parser Usage (cli): - specify --stat as the first argument if the piped input is coming from stat + $ stat * | jc --stat + + or + + $ jc stat * Usage (module): diff --git a/docs/parsers/sysctl.md b/docs/parsers/sysctl.md index 78f1d530..60fcd47b 100644 --- a/docs/parsers/sysctl.md +++ b/docs/parsers/sysctl.md @@ -1,14 +1,16 @@ # jc.parsers.sysctl -jc - JSON CLI output utility sysctl -a Parser +jc - JSON CLI output utility `sysctl -a` command output parser + +Note: Since `sysctl` output is not easily parsable only a very simple key/value object will be output. An attempt is made to convert obvious integers and floats. If no conversion is desired, use the `-r` command-line argument or the `raw=True` argument in `parse()`. Usage (cli): - specify --sysctl as the first argument if the piped input is coming from sysctl -a + $ sysctl -a | jc --sysctl - Note: since sysctl output is not easily parsable only a very simple key/value object - will be output. An attempt is made to convert obvious integers and floats. If no - conversion is desired, use the -r (raw) option. + or + + $ jc sysctl -a Usage (module): @@ -21,7 +23,7 @@ Compatibility: Examples: - $ sysctl | jc --sysctl -p + $ sysctl -a | jc --sysctl -p { "user.cs_path": "/usr/bin:/bin:/usr/sbin:/sbin", "user.bc_base_max": 99, @@ -33,7 +35,7 @@ Examples: ... } - $ sysctl | jc --sysctl -p -r + $ sysctl -a | jc --sysctl -p -r { "user.cs_path": "/usr/bin:/bin:/usr/sbin:/sbin", "user.bc_base_max": "99", diff --git a/docs/parsers/systemctl.md b/docs/parsers/systemctl.md index b062c238..bb50a8f7 100644 --- a/docs/parsers/systemctl.md +++ b/docs/parsers/systemctl.md @@ -1,10 +1,14 @@ # jc.parsers.systemctl -jc - JSON CLI output utility systemctl Parser +jc - JSON CLI output utility `systemctl` command output parser Usage (cli): - specify --systemctl as the first argument if the piped input is coming from systemctl + $ systemctl | jc --systemctl + + or + + $ jc systemctl Usage (module): diff --git a/docs/parsers/systemctl_lj.md b/docs/parsers/systemctl_lj.md index 0b441a55..a83d9f00 100644 --- a/docs/parsers/systemctl_lj.md +++ b/docs/parsers/systemctl_lj.md @@ -1,10 +1,14 @@ # jc.parsers.systemctl_lj -jc - JSON CLI output utility systemctl-lj Parser +jc - JSON CLI output utility `systemctl list-jobs` command output parser Usage (cli): - specify --systemctl-lj as the first argument if the piped input is coming from systemctl list-jobs + $ systemctl list-jobs | jc --systemctl-lj + + or + + $ jc systemctl list-jobs Usage (module): diff --git a/docs/parsers/systemctl_ls.md b/docs/parsers/systemctl_ls.md index ae1bd9e8..ab611814 100644 --- a/docs/parsers/systemctl_ls.md +++ b/docs/parsers/systemctl_ls.md @@ -1,10 +1,14 @@ # jc.parsers.systemctl_ls -jc - JSON CLI output utility systemctl-ls Parser +jc - JSON CLI output utility `systemctl list-sockets` command output parser Usage (cli): - specify --systemctl-ls as the first argument if the piped input is coming from systemctl list-sockets + $ systemctl list-sockets | jc --systemctl-ls + + or + + $ jc systemctl list-sockets Usage (module): diff --git a/docs/parsers/systemctl_luf.md b/docs/parsers/systemctl_luf.md index adb76aa1..af198663 100644 --- a/docs/parsers/systemctl_luf.md +++ b/docs/parsers/systemctl_luf.md @@ -1,10 +1,14 @@ # jc.parsers.systemctl_luf -jc - JSON CLI output utility systemctl-luf Parser +jc - JSON CLI output utility `systemctl list-unit-files` command output parser Usage (cli): - specify --systemctl-luf as the first argument if the piped input is coming from systemctl list-unit-files + $ systemctl list-unit-files | jc --systemctl-luf + + or + + $ jc systemctl list-unit-files Usage (module): diff --git a/docs/parsers/timedatectl.md b/docs/parsers/timedatectl.md index 55ba1d9d..c3ac81aa 100644 --- a/docs/parsers/timedatectl.md +++ b/docs/parsers/timedatectl.md @@ -1,10 +1,14 @@ # jc.parsers.timedatectl -jc - JSON CLI output utility timedatectl Parser +jc - JSON CLI output utility `timedatectl` command output parser Usage (cli): - specify --timedatectl as the first argument if the piped input is coming from timedatectl or timedatectl status + $ timedatectl | jc --timedatectl + + or + + $ jc timedatectl Usage (module): diff --git a/docs/parsers/tracepath.md b/docs/parsers/tracepath.md index 8217668c..2d5f2937 100644 --- a/docs/parsers/tracepath.md +++ b/docs/parsers/tracepath.md @@ -1,10 +1,16 @@ # jc.parsers.tracepath -jc - JSON CLI output utility tracepath Parser +jc - JSON CLI output utility `tracepath` command output parser + +Supports `tracepath` and `tracepath6` output. Usage (cli): - specify --tracepath as the first argument if the piped input is coming from tracepath + $ tracepath 1.2.3.4 | jc --tracepath + + or + + $ jc tracepath 1.2.3.4 Usage (module): diff --git a/docs/parsers/traceroute.md b/docs/parsers/traceroute.md index 50ce54d4..4969a455 100644 --- a/docs/parsers/traceroute.md +++ b/docs/parsers/traceroute.md @@ -1,16 +1,20 @@ # jc.parsers.traceroute -jc - JSON CLI output utility traceroute Parser +jc - JSON CLI output utility `traceroute` command output parser + +Supports `traceroute` and `traceroute6` output. + +Note: On some operating systems you will need to redirect `STDERR` to `STDOUT` for destination info since the header line is sent to `STDERR`. A warning message will be printed to `STDERR` if the header row is not found. + +e.g. `$ traceroute 8.8.8.8 2>&1 | jc --traceroute` Usage (cli): - specify --traceroute as the first argument if the piped input is coming from traceroute + $ traceroute 1.2.3.4 | jc --traceroute - Note: On some operating systems you will need to redirect STDERR to STDOUT for destination - info since the header line is sent to STDERR. A warning message will be printed to - STDERR if the header row is not found. + or - e.g. $ traceroute 8.8.8.8 2>&1 | jc --traceroute + $ jc traceroute 1.2.3.4 Usage (module): diff --git a/docs/parsers/uname.md b/docs/parsers/uname.md index e41815b9..ffbe51e2 100644 --- a/docs/parsers/uname.md +++ b/docs/parsers/uname.md @@ -1,10 +1,14 @@ # jc.parsers.uname -jc - JSON CLI output utility uname Parser +jc - JSON CLI output utility `uname -a` command output parser Usage (cli): - specify --uname as the first argument if the piped input is coming from uname -a + $ uname -a | jc --uname + + or + + $ jc uname -a Usage (module): diff --git a/docs/parsers/uptime.md b/docs/parsers/uptime.md index 07a1d969..48235230 100644 --- a/docs/parsers/uptime.md +++ b/docs/parsers/uptime.md @@ -1,10 +1,14 @@ # jc.parsers.uptime -jc - JSON CLI output utility uptime Parser +jc - JSON CLI output utility `uptime` command output parser Usage (cli): - specify --uptime as the first argument if the piped input is coming from uptime + $ uptime | jc --uptime + + or + + $ jc uptime Usage (module): diff --git a/docs/parsers/w.md b/docs/parsers/w.md index 7fa0644a..c64e99d2 100644 --- a/docs/parsers/w.md +++ b/docs/parsers/w.md @@ -1,10 +1,14 @@ # jc.parsers.w -jc - JSON CLI output utility w Parser +jc - JSON CLI output utility `w` command output parser Usage (cli): - specify --w as the first argument if the piped input is coming from w + $ w | jc --w + + or + + $ jc w Usage (module): diff --git a/docs/parsers/who.md b/docs/parsers/who.md index 30fa9941..012a8d18 100644 --- a/docs/parsers/who.md +++ b/docs/parsers/who.md @@ -1,12 +1,16 @@ # jc.parsers.who -jc - JSON CLI output utility who Parser +jc - JSON CLI output utility `who` command output parser + +Accepts any of the following who options (or no options): `-aTH` Usage (cli): - specify --who as the first argument if the piped input is coming from who + $ who | jc --who - accepts any of the following who options (or no options): -aTH + or + + $ jc who Usage (module): diff --git a/docs/parsers/xml.md b/docs/parsers/xml.md index 97d92926..eacf6c64 100644 --- a/docs/parsers/xml.md +++ b/docs/parsers/xml.md @@ -1,10 +1,10 @@ # jc.parsers.xml -jc - JSON CLI output utility XML Parser +jc - JSON CLI output utility `XML` file parser Usage (cli): - specify --xml as the first argument if the piped input is coming from an XML file + $ cat foo.xml| jc --xml Usage (module): diff --git a/docs/parsers/yaml.md b/docs/parsers/yaml.md index fca532dd..1e990b86 100644 --- a/docs/parsers/yaml.md +++ b/docs/parsers/yaml.md @@ -1,10 +1,10 @@ # jc.parsers.yaml -jc - JSON CLI output utility YAML Parser +jc - JSON CLI output utility `YAML` file parser Usage (cli): - specify --yaml as the first argument if the piped input is coming from a YAML file + $ cat foo.yaml| jc --yaml Usage (module): diff --git a/jc/parsers/group.py b/jc/parsers/group.py index 577088fd..8235374e 100644 --- a/jc/parsers/group.py +++ b/jc/parsers/group.py @@ -1,8 +1,8 @@ -"""jc - JSON CLI output utility /etc/group file Parser +"""jc - JSON CLI output utility `/etc/group` file parser Usage (cli): - specify --group as the first argument if the piped input is coming from /etc/group + $ cat /etc/group | jc --group Usage (module): diff --git a/jc/parsers/gshadow.py b/jc/parsers/gshadow.py index c6a073db..21859736 100644 --- a/jc/parsers/gshadow.py +++ b/jc/parsers/gshadow.py @@ -1,8 +1,8 @@ -"""jc - JSON CLI output utility /etc/gshadow file Parser +"""jc - JSON CLI output utility `/etc/gshadow` file parser Usage (cli): - specify --gshadow as the first argument if the piped input is coming from /etc/gshadow + $ cat /etc/gshadow | jc --gshadow Usage (module): diff --git a/jc/parsers/history.py b/jc/parsers/history.py index 0666d459..bb10b5e5 100644 --- a/jc/parsers/history.py +++ b/jc/parsers/history.py @@ -1,8 +1,8 @@ -"""jc - JSON CLI output utility history Parser +"""jc - JSON CLI output utility `history` command output parser Usage (cli): - specify --history as the first argument if the piped input is coming from history + $ history | jc --history Usage (module): diff --git a/jc/parsers/hosts.py b/jc/parsers/hosts.py index 4a617b02..5b54b4e6 100644 --- a/jc/parsers/hosts.py +++ b/jc/parsers/hosts.py @@ -1,8 +1,8 @@ -"""jc - JSON CLI output utility hosts Parser +"""jc - JSON CLI output utility `/etc/hosts` file parser Usage (cli): - specify --hosts as the first argument if the piped input is coming from a hosts file + $ cat /etc/hosts | jc --hosts Usage (module): diff --git a/jc/parsers/id.py b/jc/parsers/id.py index 34ab86bd..fba69571 100644 --- a/jc/parsers/id.py +++ b/jc/parsers/id.py @@ -1,8 +1,12 @@ -"""jc - JSON CLI output utility id Parser +"""jc - JSON CLI output utility `id` command output parser Usage (cli): - specify --id as the first argument if the piped input is coming from id + $ id | jc --id + + or + + $ jc id Usage (module): diff --git a/jc/parsers/ifconfig.py b/jc/parsers/ifconfig.py index 1418f022..3afbd037 100644 --- a/jc/parsers/ifconfig.py +++ b/jc/parsers/ifconfig.py @@ -1,10 +1,14 @@ -"""jc - JSON CLI output utility ifconfig Parser +"""jc - JSON CLI output utility `ifconfig` command output parser + +Note: No `ifconfig` options are supported. Usage (cli): - specify --ifconfig as the first argument if the piped input is coming from ifconfig + $ ifconfig | jc --ifconfig - no ifconfig options are supported. + or + + $ jc ifconfig Usage (module): diff --git a/jc/parsers/ini.py b/jc/parsers/ini.py index cce3774a..35bd3820 100644 --- a/jc/parsers/ini.py +++ b/jc/parsers/ini.py @@ -1,10 +1,12 @@ -"""jc - JSON CLI output utility INI Parser +"""jc - JSON CLI output utility `INI` file parser + +Parses standard `INI` files and files containing simple key/value pairs. Delimiter can be `=` or `:`. Missing values are supported. Comment prefix can be `#` or `;`. Comments must be on their own line. + +Note: Values starting and ending with quotation marks will have the marks removed. If you would like to keep the quotation marks, use the `-r` command-line argument or the `raw=True` argument in `parse()`. Usage (cli): - Specify --ini as the first argument if the piped input is coming from an INI file or any - simple key/value pair file. Delimiter can be '=' or ':'. Missing values are supported. - Comment prefix can be '#' or ';'. Comments must be on their own line. + $ cat foo.ini | jc --ini Usage (module): diff --git a/jc/parsers/iptables.py b/jc/parsers/iptables.py index 073c2cbb..4f3da1cb 100644 --- a/jc/parsers/iptables.py +++ b/jc/parsers/iptables.py @@ -1,10 +1,14 @@ -"""jc - JSON CLI output utility ipables Parser +"""jc - JSON CLI output utility `ipables` command output parser + +Supports `-vLn` and `--line-numbers` for all tables. Usage (cli): - Specify --iptables as the first argument if the piped input is coming from iptables + $ sudo iptables -L -t nat | jc --iptables - Supports -vLn and --line-numbers for all tables + or + + $ jc iptables -L -t nat Usage (module): diff --git a/jc/parsers/jobs.py b/jc/parsers/jobs.py index e94c34a2..32c465b0 100644 --- a/jc/parsers/jobs.py +++ b/jc/parsers/jobs.py @@ -1,10 +1,14 @@ -"""jc - JSON CLI output utility jobs Parser +"""jc - JSON CLI output utility `jobs` command output parser + +Also supports the `-l` option. Usage (cli): - specify --jobs as the first argument if the piped input is coming from jobs + $ jobs | jc --jobs - Also supports the -l option + or + + $ jc jobs Usage (module): diff --git a/jc/parsers/kv.py b/jc/parsers/kv.py index 87828e74..a884cc09 100644 --- a/jc/parsers/kv.py +++ b/jc/parsers/kv.py @@ -1,10 +1,13 @@ -"""jc - JSON CLI output utility Key/Value File Parser +"""jc - JSON CLI output utility `Key/Value` file parser + +Supports files containing simple key/value pairs. Delimiter can be `=` or `:`. Missing values are supported. Comment prefix can be `#` or `;`. Comments must be on their own line. + +Note: Values starting and ending with quotation marks will have the marks removed. If you would like to keep the quotation marks, use the `-r` command-line argument or the `raw=True` argument in `parse()`. + Usage (cli): - Specify --kv as the first argument if the piped input is coming from a simple - key/value pair file. Delimiter can be '=' or ':'. Missing values are supported. - Comment prefix can be '#' or ';'. Comments must be on their own line. + $ cat foo.txt | jc --kv Usage (module): diff --git a/jc/parsers/last.py b/jc/parsers/last.py index 89703239..fea684c5 100644 --- a/jc/parsers/last.py +++ b/jc/parsers/last.py @@ -1,8 +1,12 @@ -"""jc - JSON CLI output utility last Parser +"""jc - JSON CLI output utility `last` and `lastb` command output parser Usage (cli): - specify --last as the first argument if the piped input is coming from last or lastb + $ last | jc --last + + or + + $ jc last Usage (module): diff --git a/jc/parsers/ls.py b/jc/parsers/ls.py index 35a7d0fa..f7a6e38d 100644 --- a/jc/parsers/ls.py +++ b/jc/parsers/ls.py @@ -1,20 +1,19 @@ -"""jc - JSON CLI output utility ls Parser +"""jc - JSON CLI output utility `ls` command output parser -Note: The -l or -b option of ls should be used to correctly parse filenames that include newline characters. - Since ls does not encode newlines in filenames when outputting to a pipe it will cause jc to see - multiple files instead of a single file if -l or -b is not used. +Options supported: +- `lbaR` +- `--time-style=full-iso` +- `-h`: File sizes will be available in text form with `-r` but larger file sizes with human readable suffixes will be converted to `Null` in the default view since the parser attempts to convert this field to an integer. + +Note: The `-l` or `-b` option of `ls` should be used to correctly parse filenames that include newline characters. Since `ls` does not encode newlines in filenames when outputting to a pipe it will cause `jc` to see multiple files instead of a single file if `-l` or `-b` is not used. Usage (cli): - specify --ls as the first argument if the piped input is coming from ls + $ ls | jc --ls - ls options supported: + or - -lbaR - --time-style=full-iso - -h file sizes will be available in text form with -r but larger file sizes - with human readable suffixes will be converted to Null in default view - since the parser attempts to convert this field to an integer. + $ jc ls Usage (module): diff --git a/jc/parsers/lsblk.py b/jc/parsers/lsblk.py index cb197657..62cc8273 100644 --- a/jc/parsers/lsblk.py +++ b/jc/parsers/lsblk.py @@ -1,8 +1,12 @@ -"""jc - JSON CLI output utility lsblk Parser +"""jc - JSON CLI output utility `lsblk` command output parser Usage (cli): - specify --lsblk as the first argument if the piped input is coming from lsblk + $ lsblk | jc --lsblk + + or + + $ jc lsblk Usage (module): diff --git a/jc/parsers/lsmod.py b/jc/parsers/lsmod.py index e2c756ab..338a7798 100644 --- a/jc/parsers/lsmod.py +++ b/jc/parsers/lsmod.py @@ -1,8 +1,12 @@ -"""jc - JSON CLI output utility lsmod Parser +"""jc - JSON CLI output utility `lsmod` command output parser Usage (cli): - specify --lsmod as the first argument if the piped input is coming from lsmod + $ lsmod | jc --lsmod + + or + + $ jc lsmod Usage (module): diff --git a/jc/parsers/lsof.py b/jc/parsers/lsof.py index df334fe3..38181d2f 100644 --- a/jc/parsers/lsof.py +++ b/jc/parsers/lsof.py @@ -1,8 +1,12 @@ -"""jc - JSON CLI output utility lsof Parser +"""jc - JSON CLI output utility `lsof` command output parser Usage (cli): - specify --lsof as the first argument if the piped input is coming from lsof + $ lsof | jc --lsof + + or + + $ jc lsof Usage (module): diff --git a/jc/parsers/mount.py b/jc/parsers/mount.py index 67c9bf80..bc39067a 100644 --- a/jc/parsers/mount.py +++ b/jc/parsers/mount.py @@ -1,8 +1,12 @@ -"""jc - JSON CLI output utility mount Parser +"""jc - JSON CLI output utility `mount` command output parser Usage (cli): - specify --mount as the first argument if the piped input is coming from mount + $ mount | jc --mount + + or + + $ jc mount Usage (module): diff --git a/jc/parsers/netstat.py b/jc/parsers/netstat.py index 927ecab3..5fd58725 100644 --- a/jc/parsers/netstat.py +++ b/jc/parsers/netstat.py @@ -1,19 +1,22 @@ -"""jc - JSON CLI output utility netstat Parser +"""jc - JSON CLI output utility `netstat` command output parser + +Caveats: +- Use of multiple `l` options is not supported on OSX (e.g. `netstat -rlll`) +- Use of the `A` option is not supported on OSX when using the `r` option (e.g. `netstat -rA`) Usage (cli): - Specify --netstat as the first argument if the piped input is coming from netstat + $ netstat | jc --netstat + + or + + $ jc netstat Usage (module): import jc.parsers.netstat result = jc.parsers.netstat.parse(netstat_command_output) -Caveats: - - - Use of multiple 'l' options is not supported on OSX (e.g. 'netstat -rlll') - - Use of the 'A' option is not supported on OSX when using the 'r' option (e.g. netstat -rA) - Compatibility: 'linux', 'darwin', 'freebsd' diff --git a/jc/parsers/ntpq.py b/jc/parsers/ntpq.py index 521f83cd..dbcc8dc1 100644 --- a/jc/parsers/ntpq.py +++ b/jc/parsers/ntpq.py @@ -1,8 +1,12 @@ -"""jc - JSON CLI output utility ntpq Parser +"""jc - JSON CLI output utility `ntpq -p` command output parser Usage (cli): - specify --ntpq as the first argument if the piped input is coming from ntpq -p + $ ntpq -p | jc --ntpq + + or + + $ jc ntpq -p Usage (module): diff --git a/jc/parsers/passwd.py b/jc/parsers/passwd.py index 5df9678a..8aed1b9c 100644 --- a/jc/parsers/passwd.py +++ b/jc/parsers/passwd.py @@ -1,8 +1,8 @@ -"""jc - JSON CLI output utility /etc/passwd file Parser +"""jc - JSON CLI output utility `/etc/passwd` file Parser Usage (cli): - specify --passwd as the first argument if the piped input is coming from /etc/passwd + $ cat /etc/passwd | jc --passwd Usage (module): diff --git a/jc/parsers/ping.py b/jc/parsers/ping.py index 574059e2..3faf5dab 100644 --- a/jc/parsers/ping.py +++ b/jc/parsers/ping.py @@ -1,10 +1,16 @@ -"""jc - JSON CLI output utility ping Parser +"""jc - JSON CLI output utility `ping` command output parser + +Supports `ping` and `ping6` output. Usage (cli): - specify --ping as the first argument if the piped input is coming from ping + Note: Use the ping `-c` (count) option, otherwise data will not be piped to `jc`. + + $ ping -c 3 1.2.3.4 | jc --ping - Note: Use the ping -c (count) option, otherwise data will not be piped to jc. + or + + $ jc ping -c 3 1.2.3.4 Usage (module): diff --git a/jc/parsers/pip_list.py b/jc/parsers/pip_list.py index c5972a0b..470992b3 100644 --- a/jc/parsers/pip_list.py +++ b/jc/parsers/pip_list.py @@ -1,8 +1,12 @@ -"""jc - JSON CLI output utility pip-list Parser +"""jc - JSON CLI output utility `pip-list` command output parser Usage (cli): - specify --pip-list as the first argument if the piped input is coming from pip list + $ pip list | jc --pip-list + + or + + $ jc pip list Usage (module): diff --git a/jc/parsers/pip_show.py b/jc/parsers/pip_show.py index ec6d51dc..f279314d 100644 --- a/jc/parsers/pip_show.py +++ b/jc/parsers/pip_show.py @@ -1,8 +1,12 @@ -"""jc - JSON CLI output utility pip-show Parser +"""jc - JSON CLI output utility `pip-show` command output parser Usage (cli): - specify --pip-show as the first argument if the piped input is coming from pip show + $ pip show | jc --pip-show + + or + + $ jc pip show Usage (module): diff --git a/jc/parsers/ps.py b/jc/parsers/ps.py index d8c2035c..45230670 100644 --- a/jc/parsers/ps.py +++ b/jc/parsers/ps.py @@ -1,12 +1,16 @@ -"""jc - JSON CLI output utility ps Parser +"""jc - JSON CLI output utility `ps` command output parser + +`ps` options supported: +- `ef` +- `axu` Usage (cli): - specify --ps as the first argument if the piped input is coming from ps + $ ps | jc --ps - ps options supported: - - ef - - axu + or + + $ jc ps Usage (module): diff --git a/jc/parsers/route.py b/jc/parsers/route.py index b8e4cde3..18f2835b 100644 --- a/jc/parsers/route.py +++ b/jc/parsers/route.py @@ -1,8 +1,12 @@ -"""jc - JSON CLI output utility route Parser +"""jc - JSON CLI output utility `route` command output parser Usage (cli): - specify --route as the first argument if the piped input is coming from route + $ route | jc --route + + or + + $ jc route Usage (module): diff --git a/jc/parsers/shadow.py b/jc/parsers/shadow.py index 9f9d435a..02fe620a 100644 --- a/jc/parsers/shadow.py +++ b/jc/parsers/shadow.py @@ -1,8 +1,8 @@ -"""jc - JSON CLI output utility /etc/shadow file Parser +"""jc - JSON CLI output utility `/etc/shadow` file parser Usage (cli): - specify --shadow as the first argument if the piped input is coming from /etc/shadow + $ sudo cat /etc/shadow | jc --shadow Usage (module): diff --git a/jc/parsers/ss.py b/jc/parsers/ss.py index 3b37bd20..78d6180f 100644 --- a/jc/parsers/ss.py +++ b/jc/parsers/ss.py @@ -1,8 +1,12 @@ -"""jc - JSON CLI output utility ss Parser +"""jc - JSON CLI output utility `ss` command output parser Usage (cli): - specify --ss as the first argument if the piped input is coming from ss + $ ss | jc --ss + + or + + $ jc ss Usage (module): diff --git a/jc/parsers/stat.py b/jc/parsers/stat.py index a6f29f60..98801519 100644 --- a/jc/parsers/stat.py +++ b/jc/parsers/stat.py @@ -1,8 +1,12 @@ -"""jc - JSON CLI output utility stat Parser +"""jc - JSON CLI output utility `stat` command output parser Usage (cli): - specify --stat as the first argument if the piped input is coming from stat + $ stat * | jc --stat + + or + + $ jc stat * Usage (module): diff --git a/jc/parsers/sysctl.py b/jc/parsers/sysctl.py index 81b63b46..42bdb31c 100644 --- a/jc/parsers/sysctl.py +++ b/jc/parsers/sysctl.py @@ -1,12 +1,14 @@ -"""jc - JSON CLI output utility sysctl -a Parser +"""jc - JSON CLI output utility `sysctl -a` command output parser + +Note: Since `sysctl` output is not easily parsable only a very simple key/value object will be output. An attempt is made to convert obvious integers and floats. If no conversion is desired, use the `-r` command-line argument or the `raw=True` argument in `parse()`. Usage (cli): - specify --sysctl as the first argument if the piped input is coming from sysctl -a + $ sysctl -a | jc --sysctl - Note: since sysctl output is not easily parsable only a very simple key/value object - will be output. An attempt is made to convert obvious integers and floats. If no - conversion is desired, use the -r (raw) option. + or + + $ jc sysctl -a Usage (module): @@ -19,7 +21,7 @@ Compatibility: Examples: - $ sysctl | jc --sysctl -p + $ sysctl -a | jc --sysctl -p { "user.cs_path": "/usr/bin:/bin:/usr/sbin:/sbin", "user.bc_base_max": 99, @@ -31,7 +33,7 @@ Examples: ... } - $ sysctl | jc --sysctl -p -r + $ sysctl -a | jc --sysctl -p -r { "user.cs_path": "/usr/bin:/bin:/usr/sbin:/sbin", "user.bc_base_max": "99", diff --git a/jc/parsers/systemctl.py b/jc/parsers/systemctl.py index ab0535db..6c645cf5 100644 --- a/jc/parsers/systemctl.py +++ b/jc/parsers/systemctl.py @@ -1,8 +1,12 @@ -"""jc - JSON CLI output utility systemctl Parser +"""jc - JSON CLI output utility `systemctl` command output parser Usage (cli): - specify --systemctl as the first argument if the piped input is coming from systemctl + $ systemctl | jc --systemctl + + or + + $ jc systemctl Usage (module): diff --git a/jc/parsers/systemctl_lj.py b/jc/parsers/systemctl_lj.py index 898623c9..cad74177 100644 --- a/jc/parsers/systemctl_lj.py +++ b/jc/parsers/systemctl_lj.py @@ -1,8 +1,12 @@ -"""jc - JSON CLI output utility systemctl-lj Parser +"""jc - JSON CLI output utility `systemctl list-jobs` command output parser Usage (cli): - specify --systemctl-lj as the first argument if the piped input is coming from systemctl list-jobs + $ systemctl list-jobs | jc --systemctl-lj + + or + + $ jc systemctl list-jobs Usage (module): diff --git a/jc/parsers/systemctl_ls.py b/jc/parsers/systemctl_ls.py index c36f02b9..ee9d069c 100644 --- a/jc/parsers/systemctl_ls.py +++ b/jc/parsers/systemctl_ls.py @@ -1,8 +1,12 @@ -"""jc - JSON CLI output utility systemctl-ls Parser +"""jc - JSON CLI output utility `systemctl list-sockets` command output parser Usage (cli): - specify --systemctl-ls as the first argument if the piped input is coming from systemctl list-sockets + $ systemctl list-sockets | jc --systemctl-ls + + or + + $ jc systemctl list-sockets Usage (module): diff --git a/jc/parsers/systemctl_luf.py b/jc/parsers/systemctl_luf.py index 84569848..11d309cb 100644 --- a/jc/parsers/systemctl_luf.py +++ b/jc/parsers/systemctl_luf.py @@ -1,8 +1,12 @@ -"""jc - JSON CLI output utility systemctl-luf Parser +"""jc - JSON CLI output utility `systemctl list-unit-files` command output parser Usage (cli): - specify --systemctl-luf as the first argument if the piped input is coming from systemctl list-unit-files + $ systemctl list-unit-files | jc --systemctl-luf + + or + + $ jc systemctl list-unit-files Usage (module): diff --git a/jc/parsers/timedatectl.py b/jc/parsers/timedatectl.py index 8b277824..338548f8 100644 --- a/jc/parsers/timedatectl.py +++ b/jc/parsers/timedatectl.py @@ -1,8 +1,12 @@ -"""jc - JSON CLI output utility timedatectl Parser +"""jc - JSON CLI output utility `timedatectl` command output parser Usage (cli): - specify --timedatectl as the first argument if the piped input is coming from timedatectl or timedatectl status + $ timedatectl | jc --timedatectl + + or + + $ jc timedatectl Usage (module): diff --git a/jc/parsers/tracepath.py b/jc/parsers/tracepath.py index 6630aa97..a343800c 100644 --- a/jc/parsers/tracepath.py +++ b/jc/parsers/tracepath.py @@ -1,8 +1,14 @@ -"""jc - JSON CLI output utility tracepath Parser +"""jc - JSON CLI output utility `tracepath` command output parser + +Supports `tracepath` and `tracepath6` output. Usage (cli): - specify --tracepath as the first argument if the piped input is coming from tracepath + $ tracepath 1.2.3.4 | jc --tracepath + + or + + $ jc tracepath 1.2.3.4 Usage (module): diff --git a/jc/parsers/traceroute.py b/jc/parsers/traceroute.py index c7ea9437..7dae7e2d 100644 --- a/jc/parsers/traceroute.py +++ b/jc/parsers/traceroute.py @@ -1,14 +1,18 @@ -"""jc - JSON CLI output utility traceroute Parser +"""jc - JSON CLI output utility `traceroute` command output parser + +Supports `traceroute` and `traceroute6` output. + +Note: On some operating systems you will need to redirect `STDERR` to `STDOUT` for destination info since the header line is sent to `STDERR`. A warning message will be printed to `STDERR` if the header row is not found. + +e.g. `$ traceroute 8.8.8.8 2>&1 | jc --traceroute` Usage (cli): - specify --traceroute as the first argument if the piped input is coming from traceroute + $ traceroute 1.2.3.4 | jc --traceroute - Note: On some operating systems you will need to redirect STDERR to STDOUT for destination - info since the header line is sent to STDERR. A warning message will be printed to - STDERR if the header row is not found. + or - e.g. $ traceroute 8.8.8.8 2>&1 | jc --traceroute + $ jc traceroute 1.2.3.4 Usage (module): diff --git a/jc/parsers/uname.py b/jc/parsers/uname.py index c9787100..81ce7b2e 100644 --- a/jc/parsers/uname.py +++ b/jc/parsers/uname.py @@ -1,8 +1,12 @@ -"""jc - JSON CLI output utility uname Parser +"""jc - JSON CLI output utility `uname -a` command output parser Usage (cli): - specify --uname as the first argument if the piped input is coming from uname -a + $ uname -a | jc --uname + + or + + $ jc uname -a Usage (module): diff --git a/jc/parsers/uptime.py b/jc/parsers/uptime.py index cbb71b19..c49fd8e8 100644 --- a/jc/parsers/uptime.py +++ b/jc/parsers/uptime.py @@ -1,8 +1,12 @@ -"""jc - JSON CLI output utility uptime Parser +"""jc - JSON CLI output utility `uptime` command output parser Usage (cli): - specify --uptime as the first argument if the piped input is coming from uptime + $ uptime | jc --uptime + + or + + $ jc uptime Usage (module): diff --git a/jc/parsers/w.py b/jc/parsers/w.py index 9a4e0fa1..fcf6210f 100644 --- a/jc/parsers/w.py +++ b/jc/parsers/w.py @@ -1,8 +1,12 @@ -"""jc - JSON CLI output utility w Parser +"""jc - JSON CLI output utility `w` command output parser Usage (cli): - specify --w as the first argument if the piped input is coming from w + $ w | jc --w + + or + + $ jc w Usage (module): diff --git a/jc/parsers/who.py b/jc/parsers/who.py index 56eecc5f..7a6448ed 100644 --- a/jc/parsers/who.py +++ b/jc/parsers/who.py @@ -1,10 +1,14 @@ -"""jc - JSON CLI output utility who Parser +"""jc - JSON CLI output utility `who` command output parser + +Accepts any of the following who options (or no options): `-aTH` Usage (cli): - specify --who as the first argument if the piped input is coming from who + $ who | jc --who - accepts any of the following who options (or no options): -aTH + or + + $ jc who Usage (module): diff --git a/jc/parsers/xml.py b/jc/parsers/xml.py index 532fcb46..d747edb6 100644 --- a/jc/parsers/xml.py +++ b/jc/parsers/xml.py @@ -1,8 +1,8 @@ -"""jc - JSON CLI output utility XML Parser +"""jc - JSON CLI output utility `XML` file parser Usage (cli): - specify --xml as the first argument if the piped input is coming from an XML file + $ cat foo.xml| jc --xml Usage (module): diff --git a/jc/parsers/yaml.py b/jc/parsers/yaml.py index e3271985..7d1df3ce 100644 --- a/jc/parsers/yaml.py +++ b/jc/parsers/yaml.py @@ -1,8 +1,8 @@ -"""jc - JSON CLI output utility YAML Parser +"""jc - JSON CLI output utility `YAML` file parser Usage (cli): - specify --yaml as the first argument if the piped input is coming from a YAML file + $ cat foo.yaml| jc --yaml Usage (module):