mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-17 00:07:37 +02:00
add manpage generator
This commit is contained in:
122
man/jc.1
122
man/jc.1
@ -1,4 +1,4 @@
|
|||||||
.TH jc 1 2021-01-05 1.14.3 "JSON CLI output utility"
|
.TH jc 1 2021-04-02 1.15.0 "JSON CLI output utility"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
jc \- JSONifies the output of many CLI tools and file-types
|
jc \- JSONifies the output of many CLI tools and file-types
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@ -14,262 +14,355 @@ jc JSONifies the output of many CLI tools and file-types for easier parsing in s
|
|||||||
.B
|
.B
|
||||||
Parsers:
|
Parsers:
|
||||||
.RS
|
.RS
|
||||||
|
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B
|
||||||
|
\fB--acpi\fP
|
||||||
|
acpi command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--airport\fP
|
\fB--airport\fP
|
||||||
airport \fB-I\fP command parser
|
airport -I command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--airport-s\fP
|
\fB--airport-s\fP
|
||||||
airport \fB-s\fP command parser
|
airport -s command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--arp\fP
|
\fB--arp\fP
|
||||||
arp command parser
|
arp command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--blkid\fP
|
\fB--blkid\fP
|
||||||
blkid command parser
|
blkid command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--cksum\fP
|
\fB--cksum\fP
|
||||||
cksum and sum command parser
|
cksum command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--crontab\fP
|
\fB--crontab\fP
|
||||||
crontab command and file parser
|
crontab command and file parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--crontab-u\fP
|
\fB--crontab-u\fP
|
||||||
crontab file parser with user support
|
crontab file parser with user support
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--csv\fP
|
\fB--csv\fP
|
||||||
CSV file parser
|
CSV file parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--date\fP
|
\fB--date\fP
|
||||||
date command parser
|
date command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--df\fP
|
\fB--df\fP
|
||||||
df command parser
|
df command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--dig\fP
|
\fB--dig\fP
|
||||||
dig command parser
|
dig command parser
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B
|
||||||
|
\fB--dir\fP
|
||||||
|
dir command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--dmidecode\fP
|
\fB--dmidecode\fP
|
||||||
dmidecode command parser
|
dmidecode command parser
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B
|
||||||
|
\fB--dpkg-l\fP
|
||||||
|
dpkg -l command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--du\fP
|
\fB--du\fP
|
||||||
du command parser
|
du command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--env\fP
|
\fB--env\fP
|
||||||
env and printenv command parser
|
env command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--file\fP
|
\fB--file\fP
|
||||||
file command parser
|
file command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--free\fP
|
\fB--free\fP
|
||||||
free command parser
|
free command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--fstab\fP
|
\fB--fstab\fP
|
||||||
fstab file parser
|
fstab file parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--group\fP
|
\fB--group\fP
|
||||||
/etc/group file parser
|
/etc/group file parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--gshadow\fP
|
\fB--gshadow\fP
|
||||||
/etc/gshadow file parser
|
/etc/gshadow file parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--hash\fP
|
\fB--hash\fP
|
||||||
hash BASH builtin command parser
|
hash command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--hashsum\fP
|
\fB--hashsum\fP
|
||||||
md5, md5sum, shasum, sha1sum, sha224sum, sha256sum, sha384sum, and sha512sum command parser
|
hashsum command parser (md5sum, shasum, etc.)
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--hciconfig\fP
|
\fB--hciconfig\fP
|
||||||
hciconfig command parser
|
hciconfig command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--history\fP
|
\fB--history\fP
|
||||||
history command parser
|
history command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--hosts\fP
|
\fB--hosts\fP
|
||||||
/etc/hosts file parser
|
/etc/hosts file parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--id\fP
|
\fB--id\fP
|
||||||
id command parser
|
id command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--ifconfig\fP
|
\fB--ifconfig\fP
|
||||||
ifconfig command parser
|
ifconfig command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--ini\fP
|
\fB--ini\fP
|
||||||
INI file parser
|
INI file parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--iptables\fP
|
\fB--iptables\fP
|
||||||
iptables command parser
|
iptables command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--iw-scan\fP
|
\fB--iw-scan\fP
|
||||||
iw dev <device> scan command parser
|
iw dev <device> scan command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--jobs\fP
|
\fB--jobs\fP
|
||||||
jobs command parser
|
jobs command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--kv\fP
|
\fB--kv\fP
|
||||||
Key/Value file parser
|
Key/Value file parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--last\fP
|
\fB--last\fP
|
||||||
last and lastb command parser
|
last and lastb command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--ls\fP
|
\fB--ls\fP
|
||||||
ls and vdir command parser
|
ls command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--lsblk\fP
|
\fB--lsblk\fP
|
||||||
lsblk command parser
|
lsblk command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--lsmod\fP
|
\fB--lsmod\fP
|
||||||
lsmod command parser
|
lsmod command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--lsof\fP
|
\fB--lsof\fP
|
||||||
lsof command parser
|
lsof command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--mount\fP
|
\fB--mount\fP
|
||||||
mount command parser
|
mount command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--netstat\fP
|
\fB--netstat\fP
|
||||||
netstat command parser
|
netstat command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--ntpq\fP
|
\fB--ntpq\fP
|
||||||
ntpq \fB-p\fP command parser
|
ntpq -p command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--passwd\fP
|
\fB--passwd\fP
|
||||||
/etc/passwd file parser
|
/etc/passwd file parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--ping\fP
|
\fB--ping\fP
|
||||||
ping command parser
|
ping command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--pip-list\fP
|
\fB--pip-list\fP
|
||||||
pip list command parser
|
pip list command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--pip-show\fP
|
\fB--pip-show\fP
|
||||||
pip show command parser
|
pip show command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--ps\fP
|
\fB--ps\fP
|
||||||
ps command parser
|
ps command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--route\fP
|
\fB--route\fP
|
||||||
route command parser
|
route command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--shadow\fP
|
\fB--shadow\fP
|
||||||
/etc/shadow file parser
|
/etc/shadow file parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--ss\fP
|
\fB--ss\fP
|
||||||
ss command parser
|
ss command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--stat\fP
|
\fB--stat\fP
|
||||||
stat command parser
|
stat command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--sysctl\fP
|
\fB--sysctl\fP
|
||||||
sysctl command parser
|
sysctl command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--systemctl\fP
|
\fB--systemctl\fP
|
||||||
systemctl command parser
|
systemctl command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--systemctl-lj\fP
|
\fB--systemctl-lj\fP
|
||||||
systemctl list-jobs command parser
|
systemctl list-jobs command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--systemctl-ls\fP
|
\fB--systemctl-ls\fP
|
||||||
systemctl list-sockets command parser
|
systemctl list-sockets command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--systemctl-luf\fP
|
\fB--systemctl-luf\fP
|
||||||
systemctl list-unit-files command parser
|
systemctl list-unit-files command parser
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B
|
||||||
|
\fB--time\fP
|
||||||
|
/usr/bin/time command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--timedatectl\fP
|
\fB--timedatectl\fP
|
||||||
timedatectl status command parser
|
timedatectl status command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--tracepath\fP
|
\fB--tracepath\fP
|
||||||
tracepath command parser
|
tracepath command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--traceroute\fP
|
\fB--traceroute\fP
|
||||||
traceroute command parser
|
traceroute command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--uname\fP
|
\fB--uname\fP
|
||||||
uname \fB-a\fP command parser
|
uname -a command parser
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B
|
||||||
|
\fB--upower\fP
|
||||||
|
upower command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--uptime\fP
|
\fB--uptime\fP
|
||||||
uptime command parser
|
uptime command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--w\fP
|
\fB--w\fP
|
||||||
w command parser
|
w command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--wc\fP
|
\fB--wc\fP
|
||||||
wc command parser
|
wc command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--who\fP
|
\fB--who\fP
|
||||||
who command parser
|
who command parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--xml\fP
|
\fB--xml\fP
|
||||||
XML file parser
|
XML file parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--yaml\fP
|
\fB--yaml\fP
|
||||||
YAML file parser
|
YAML file parser
|
||||||
|
|
||||||
|
|
||||||
.RE
|
.RE
|
||||||
.PP
|
.PP
|
||||||
|
.B
|
||||||
Options:
|
Options:
|
||||||
.RS
|
.RS
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB-a\fP
|
\fB-a\fP
|
||||||
@ -296,10 +389,11 @@ quiet - suppress warnings
|
|||||||
raw JSON output
|
raw JSON output
|
||||||
.RE
|
.RE
|
||||||
.PP
|
.PP
|
||||||
Example:
|
.SH Example:
|
||||||
ls \fB-al\fP | jc \fB--ls\fP \fB-p\fP
|
ls \fB-al\fP | jc \fB--ls\fP \fB-p\fP
|
||||||
.RS
|
|
||||||
.PP
|
|
||||||
or using the magic syntax:
|
or using the magic syntax:
|
||||||
.PP
|
|
||||||
|
|
||||||
jc \fB-p\fP ls \fB-al\fP
|
jc \fB-p\fP ls \fB-al\fP
|
64
man/template/manpage_template
Normal file
64
man/template/manpage_template
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
.TH jc 1 {{ today }} {{ jc.version}} "JSON CLI output utility"
|
||||||
|
.SH NAME
|
||||||
|
jc \- JSONifies the output of many CLI tools and file-types
|
||||||
|
.SH SYNOPSIS
|
||||||
|
COMMAND | jc PARSER [OPTIONS]
|
||||||
|
|
||||||
|
or magic syntax:
|
||||||
|
|
||||||
|
jc [OPTIONS] COMMAND
|
||||||
|
.SH DESCRIPTION
|
||||||
|
jc JSONifies the output of many CLI tools and file-types for easier parsing in scripts. jc accepts piped input from STDIN and outputs a JSON representation of the previous command's output to STDOUT. Alternatively, the "magic" syntax can be used by prepending jc to the command to be converted. Options can be passed to jc immediately before the command is given. (Note: command aliases are not supported).
|
||||||
|
|
||||||
|
.SH OPTIONS
|
||||||
|
.B
|
||||||
|
Parsers:
|
||||||
|
.RS
|
||||||
|
|
||||||
|
{% for parser in jc.parsers %}
|
||||||
|
.TP
|
||||||
|
.B
|
||||||
|
\fB{{ parser.argument }}\fP
|
||||||
|
{{ parser.description }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
.B
|
||||||
|
Options:
|
||||||
|
.RS
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B
|
||||||
|
\fB-a\fP
|
||||||
|
about jc
|
||||||
|
.TP
|
||||||
|
.B
|
||||||
|
\fB-d\fP
|
||||||
|
debug - show traceback (\fB-dd\fP for verbose traceback)
|
||||||
|
.TP
|
||||||
|
.B
|
||||||
|
\fB-m\fP
|
||||||
|
monochrome output
|
||||||
|
.TP
|
||||||
|
.B
|
||||||
|
\fB-p\fP
|
||||||
|
pretty print output
|
||||||
|
.TP
|
||||||
|
.B
|
||||||
|
\fB-q\fP
|
||||||
|
quiet - suppress warnings
|
||||||
|
.TP
|
||||||
|
.B
|
||||||
|
\fB-r\fP
|
||||||
|
raw JSON output
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
.SH Example:
|
||||||
|
ls \fB-al\fP | jc \fB--ls\fP \fB-p\fP
|
||||||
|
|
||||||
|
|
||||||
|
or using the magic syntax:
|
||||||
|
|
||||||
|
|
||||||
|
jc \fB-p\fP ls \fB-al\fP
|
20
mangen.py
Executable file
20
mangen.py
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# Genereate man page from jc metadata using jinja2 templates
|
||||||
|
from datetime import date
|
||||||
|
import jc
|
||||||
|
import jc.cli
|
||||||
|
from jinja2 import Environment, FileSystemLoader
|
||||||
|
|
||||||
|
file_loader = FileSystemLoader('man/template')
|
||||||
|
env = Environment(loader=file_loader)
|
||||||
|
template = env.get_template('manpage_template')
|
||||||
|
|
||||||
|
# get parser info from jc.cli.about_jc()
|
||||||
|
# plug it into the man page jinja2 template
|
||||||
|
jcinfo = jc.cli.about_jc()
|
||||||
|
today = date.today()
|
||||||
|
output = template.render(today=today, jc=jcinfo)
|
||||||
|
|
||||||
|
# save to man/jc.1
|
||||||
|
with open('man/jc.1', 'w') as f:
|
||||||
|
f.write(output)
|
Reference in New Issue
Block a user