mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-08-06 22:32:54 +02:00
clean up examples
This commit is contained in:
37
README.md
37
README.md
@ -133,7 +133,9 @@ on Github.
|
||||
`jc` accepts piped input from `STDIN` and outputs a JSON representation of the
|
||||
previous command's output to `STDOUT`.
|
||||
```bash
|
||||
COMMAND | jc PARSER [OPTIONS]
|
||||
COMMAND | jc [OPTIONS] PARSER
|
||||
cat FILE | jc [OPTIONS] PARSER
|
||||
echo STRING | jc [OPTIONS] PARSER
|
||||
```
|
||||
|
||||
Alternatively, the "magic" syntax can be used by prepending `jc` to the command
|
||||
@ -141,6 +143,7 @@ to be converted. Options can be passed to `jc` immediately before the command is
|
||||
given. (Note: command aliases and shell builtins are not supported)
|
||||
```bash
|
||||
jc [OPTIONS] COMMAND
|
||||
jc [OPTIONS] /proc/<path-to-file>
|
||||
```
|
||||
|
||||
The JSON output can be compact (default) or pretty formatted with the `-p`
|
||||
@ -538,12 +541,12 @@ that case you can suppress the warning message with the `-q` cli option or the
|
||||
|
||||
macOS:
|
||||
```bash
|
||||
cat lsof.out | jc --lsof -q
|
||||
cat lsof.out | jc -q --lsof
|
||||
```
|
||||
|
||||
or Windows:
|
||||
```bash
|
||||
type lsof.out | jc --lsof -q
|
||||
type lsof.out | jc -q --lsof
|
||||
```
|
||||
|
||||
Tested on:
|
||||
@ -587,7 +590,7 @@ documentation.
|
||||
|
||||
### arp
|
||||
```bash
|
||||
arp | jc --arp -p # or: jc -p arp
|
||||
arp | jc -p --arp # or: jc -p arp
|
||||
```
|
||||
```json
|
||||
[
|
||||
@ -626,7 +629,7 @@ cat homes.csv
|
||||
...
|
||||
```
|
||||
```bash
|
||||
cat homes.csv | jc --csv -p
|
||||
cat homes.csv | jc -p --csv
|
||||
```
|
||||
```json
|
||||
[
|
||||
@ -667,7 +670,7 @@ cat homes.csv | jc --csv -p
|
||||
```
|
||||
### /etc/hosts file
|
||||
```bash
|
||||
cat /etc/hosts | jc --hosts -p
|
||||
cat /etc/hosts | jc -p --hosts
|
||||
```
|
||||
```json
|
||||
[
|
||||
@ -694,7 +697,7 @@ cat /etc/hosts | jc --hosts -p
|
||||
```
|
||||
### ifconfig
|
||||
```bash
|
||||
ifconfig | jc --ifconfig -p # or: jc -p ifconfig
|
||||
ifconfig | jc -p --ifconfig # or: jc -p ifconfig
|
||||
```
|
||||
```json
|
||||
[
|
||||
@ -752,7 +755,7 @@ Port = 50022
|
||||
ForwardX11 = no
|
||||
```
|
||||
```bash
|
||||
cat example.ini | jc --ini -p
|
||||
cat example.ini | jc -p --ini
|
||||
```
|
||||
```json
|
||||
{
|
||||
@ -774,7 +777,7 @@ cat example.ini | jc --ini -p
|
||||
```
|
||||
### ls
|
||||
```bash
|
||||
$ ls -l /usr/bin | jc --ls -p # or: jc -p ls -l /usr/bin
|
||||
$ ls -l /usr/bin | jc -p --ls # or: jc -p ls -l /usr/bin
|
||||
```
|
||||
```json
|
||||
[
|
||||
@ -810,7 +813,7 @@ $ ls -l /usr/bin | jc --ls -p # or: jc -p ls -l /usr/bin
|
||||
```
|
||||
### netstat
|
||||
```bash
|
||||
netstat -apee | jc --netstat -p # or: jc -p netstat -apee
|
||||
netstat -apee | jc -p --netstat # or: jc -p netstat -apee
|
||||
```
|
||||
```json
|
||||
[
|
||||
@ -898,7 +901,7 @@ netstat -apee | jc --netstat -p # or: jc -p netstat -apee
|
||||
```
|
||||
### /etc/passwd file
|
||||
```bash
|
||||
cat /etc/passwd | jc --passwd -p
|
||||
cat /etc/passwd | jc -p --passwd
|
||||
```
|
||||
```json
|
||||
[
|
||||
@ -924,7 +927,7 @@ cat /etc/passwd | jc --passwd -p
|
||||
```
|
||||
### ping
|
||||
```bash
|
||||
ping 8.8.8.8 -c 3 | jc --ping -p # or: jc -p ping 8.8.8.8 -c 3
|
||||
ping 8.8.8.8 -c 3 | jc -p --ping # or: jc -p ping 8.8.8.8 -c 3
|
||||
```
|
||||
```json
|
||||
{
|
||||
@ -977,7 +980,7 @@ ping 8.8.8.8 -c 3 | jc --ping -p # or: jc -p ping 8.8.8.8 -c 3
|
||||
```
|
||||
### ps
|
||||
```bash
|
||||
ps axu | jc --ps -p # or: jc -p ps axu
|
||||
ps axu | jc -p --ps # or: jc -p ps axu
|
||||
```
|
||||
```json
|
||||
[
|
||||
@ -1024,7 +1027,7 @@ ps axu | jc --ps -p # or: jc -p ps axu
|
||||
```
|
||||
### traceroute
|
||||
```bash
|
||||
traceroute -m 2 8.8.8.8 | jc --traceroute -p
|
||||
traceroute -m 2 8.8.8.8 | jc -p --traceroute
|
||||
# or: jc -p traceroute -m 2 8.8.8.8
|
||||
```
|
||||
```json
|
||||
@ -1089,7 +1092,7 @@ traceroute -m 2 8.8.8.8 | jc --traceroute -p
|
||||
```
|
||||
### uptime
|
||||
```bash
|
||||
uptime | jc --uptime -p # or: jc -p uptime
|
||||
uptime | jc -p --uptime # or: jc -p uptime
|
||||
```
|
||||
```json
|
||||
{
|
||||
@ -1134,7 +1137,7 @@ cat cd_catalog.xml
|
||||
...
|
||||
```
|
||||
```bash
|
||||
cat cd_catalog.xml | jc --xml -p
|
||||
cat cd_catalog.xml | jc -p --xml
|
||||
```
|
||||
```json
|
||||
{
|
||||
@ -1186,7 +1189,7 @@ spec:
|
||||
mode: ISTIO_MUTUAL
|
||||
```
|
||||
```bash
|
||||
cat istio.yaml | jc --yaml -p
|
||||
cat istio.yaml | jc -p --yaml
|
||||
```
|
||||
```json
|
||||
[
|
||||
|
@ -215,7 +215,6 @@ Examples:
|
||||
|
||||
Show Hidden Parsers:
|
||||
$ jc -hh
|
||||
$ jc --about --pretty
|
||||
'''
|
||||
|
||||
return helptext_string
|
||||
|
29
man/jc.1
29
man/jc.1
@ -1,13 +1,26 @@
|
||||
.TH jc 1 2022-09-07 1.21.2 "JSON Convert"
|
||||
.SH NAME
|
||||
\fBjc\fP \- JSON Convert JSONifies the output of many CLI tools and file-types
|
||||
\fBjc\fP \- JSON Convert JSONifies the output of many CLI tools, file-types, and strings
|
||||
.SH SYNOPSIS
|
||||
COMMAND | jc PARSER [OPTIONS]
|
||||
|
||||
or "Magic" syntax:
|
||||
Standard syntax:
|
||||
|
||||
.RS
|
||||
COMMAND | \fBjc\fP [OPTIONS] PARSER
|
||||
|
||||
cat FILE | \fBjc\fP [OPTIONS] PARSER
|
||||
|
||||
echo STRING | \fBjc\fP [OPTIONS] PARSER
|
||||
.RE
|
||||
|
||||
Magic syntax:
|
||||
|
||||
.RS
|
||||
\fBjc\fP [OPTIONS] COMMAND
|
||||
|
||||
\fBjc\fP [OPTIONS] /proc/<path-to-file>
|
||||
.RE
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBjc\fP JSONifies the output of many CLI tools, file-types, and common strings for easier parsing in scripts. \fBjc\fP accepts piped input from \fBSTDIN\fP and outputs a JSON representation of the previous command's output to \fBSTDOUT\fP. Alternatively, the "Magic" syntax can be used by prepending \fBjc\fP to the command to be converted. Options can be passed to \fBjc\fP immediately before the command is given. (Note: "Magic" syntax does not support shell builtins or command aliases)
|
||||
|
||||
@ -912,17 +925,21 @@ If a UTC timezone can be detected in the text of the command output, the timesta
|
||||
.SH EXAMPLES
|
||||
Standard Syntax:
|
||||
.RS
|
||||
$ dig www.google.com | jc \fB--dig\fP \fB-p\fP
|
||||
$ dig www.google.com | jc \fB-p\fP \fB--dig\fP
|
||||
|
||||
$ cat /proc/meminfo | jc \fB--pretty\fP \fB--proc\fP
|
||||
.RE
|
||||
|
||||
Magic Syntax:
|
||||
.RS
|
||||
$ jc \fB-p\fP dig www.google.com
|
||||
$ jc \fB--pretty\fP dig www.google.com
|
||||
|
||||
$ jc \fB--pretty\fP /proc/meminfo
|
||||
.RE
|
||||
|
||||
For parser documentation:
|
||||
.RS
|
||||
$ jc \fB-h\fP \fB--dig\fP
|
||||
$ jc \fB--help\fP \fB--dig\fP
|
||||
.RE
|
||||
.SH AUTHOR
|
||||
Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,13 +1,26 @@
|
||||
.TH jc 1 {{ today }} {{ jc.version}} "JSON Convert"
|
||||
.SH NAME
|
||||
\fBjc\fP \- JSON Convert JSONifies the output of many CLI tools and file-types
|
||||
\fBjc\fP \- JSON Convert JSONifies the output of many CLI tools, file-types, and strings
|
||||
.SH SYNOPSIS
|
||||
COMMAND | jc PARSER [OPTIONS]
|
||||
|
||||
or "Magic" syntax:
|
||||
Standard syntax:
|
||||
|
||||
.RS
|
||||
COMMAND | \fBjc\fP [OPTIONS] PARSER
|
||||
|
||||
cat FILE | \fBjc\fP [OPTIONS] PARSER
|
||||
|
||||
echo STRING | \fBjc\fP [OPTIONS] PARSER
|
||||
.RE
|
||||
|
||||
Magic syntax:
|
||||
|
||||
.RS
|
||||
\fBjc\fP [OPTIONS] COMMAND
|
||||
|
||||
\fBjc\fP [OPTIONS] /proc/<path-to-file>
|
||||
.RE
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBjc\fP JSONifies the output of many CLI tools, file-types, and common strings for easier parsing in scripts. \fBjc\fP accepts piped input from \fBSTDIN\fP and outputs a JSON representation of the previous command's output to \fBSTDOUT\fP. Alternatively, the "Magic" syntax can be used by prepending \fBjc\fP to the command to be converted. Options can be passed to \fBjc\fP immediately before the command is given. (Note: "Magic" syntax does not support shell builtins or command aliases)
|
||||
|
||||
@ -277,17 +290,21 @@ If a UTC timezone can be detected in the text of the command output, the timesta
|
||||
.SH EXAMPLES
|
||||
Standard Syntax:
|
||||
.RS
|
||||
$ dig www.google.com | jc \fB--dig\fP \fB-p\fP
|
||||
$ dig www.google.com | jc \fB-p\fP \fB--dig\fP
|
||||
|
||||
$ cat /proc/meminfo | jc \fB--pretty\fP \fB--proc\fP
|
||||
.RE
|
||||
|
||||
Magic Syntax:
|
||||
.RS
|
||||
$ jc \fB-p\fP dig www.google.com
|
||||
$ jc \fB--pretty\fP dig www.google.com
|
||||
|
||||
$ jc \fB--pretty\fP /proc/meminfo
|
||||
.RE
|
||||
|
||||
For parser documentation:
|
||||
.RS
|
||||
$ jc \fB-h\fP \fB--dig\fP
|
||||
$ jc \fB--help\fP \fB--dig\fP
|
||||
.RE
|
||||
.SH AUTHOR
|
||||
{{ jc.author }} ({{ jc.author_email }})
|
||||
|
@ -133,7 +133,9 @@ on Github.
|
||||
`jc` accepts piped input from `STDIN` and outputs a JSON representation of the
|
||||
previous command's output to `STDOUT`.
|
||||
```bash
|
||||
COMMAND | jc PARSER [OPTIONS]
|
||||
COMMAND | jc [OPTIONS] PARSER
|
||||
cat FILE | jc [OPTIONS] PARSER
|
||||
echo STRING | jc [OPTIONS] PARSER
|
||||
```
|
||||
|
||||
Alternatively, the "magic" syntax can be used by prepending `jc` to the command
|
||||
@ -141,6 +143,7 @@ to be converted. Options can be passed to `jc` immediately before the command is
|
||||
given. (Note: command aliases and shell builtins are not supported)
|
||||
```bash
|
||||
jc [OPTIONS] COMMAND
|
||||
jc [OPTIONS] /proc/<path-to-file>
|
||||
```
|
||||
|
||||
The JSON output can be compact (default) or pretty formatted with the `-p`
|
||||
@ -418,12 +421,12 @@ that case you can suppress the warning message with the `-q` cli option or the
|
||||
|
||||
macOS:
|
||||
```bash
|
||||
cat lsof.out | jc --lsof -q
|
||||
cat lsof.out | jc -q --lsof
|
||||
```
|
||||
|
||||
or Windows:
|
||||
```bash
|
||||
type lsof.out | jc --lsof -q
|
||||
type lsof.out | jc -q --lsof
|
||||
```
|
||||
|
||||
Tested on:
|
||||
@ -467,7 +470,7 @@ documentation.
|
||||
|
||||
### arp
|
||||
```bash
|
||||
arp | jc --arp -p # or: jc -p arp
|
||||
arp | jc -p --arp # or: jc -p arp
|
||||
```
|
||||
```json
|
||||
[
|
||||
@ -506,7 +509,7 @@ cat homes.csv
|
||||
...
|
||||
```
|
||||
```bash
|
||||
cat homes.csv | jc --csv -p
|
||||
cat homes.csv | jc -p --csv
|
||||
```
|
||||
```json
|
||||
[
|
||||
@ -547,7 +550,7 @@ cat homes.csv | jc --csv -p
|
||||
```
|
||||
### /etc/hosts file
|
||||
```bash
|
||||
cat /etc/hosts | jc --hosts -p
|
||||
cat /etc/hosts | jc -p --hosts
|
||||
```
|
||||
```json
|
||||
[
|
||||
@ -574,7 +577,7 @@ cat /etc/hosts | jc --hosts -p
|
||||
```
|
||||
### ifconfig
|
||||
```bash
|
||||
ifconfig | jc --ifconfig -p # or: jc -p ifconfig
|
||||
ifconfig | jc -p --ifconfig # or: jc -p ifconfig
|
||||
```
|
||||
```json
|
||||
[
|
||||
@ -632,7 +635,7 @@ Port = 50022
|
||||
ForwardX11 = no
|
||||
```
|
||||
```bash
|
||||
cat example.ini | jc --ini -p
|
||||
cat example.ini | jc -p --ini
|
||||
```
|
||||
```json
|
||||
{
|
||||
@ -654,7 +657,7 @@ cat example.ini | jc --ini -p
|
||||
```
|
||||
### ls
|
||||
```bash
|
||||
$ ls -l /usr/bin | jc --ls -p # or: jc -p ls -l /usr/bin
|
||||
$ ls -l /usr/bin | jc -p --ls # or: jc -p ls -l /usr/bin
|
||||
```
|
||||
```json
|
||||
[
|
||||
@ -690,7 +693,7 @@ $ ls -l /usr/bin | jc --ls -p # or: jc -p ls -l /usr/bin
|
||||
```
|
||||
### netstat
|
||||
```bash
|
||||
netstat -apee | jc --netstat -p # or: jc -p netstat -apee
|
||||
netstat -apee | jc -p --netstat # or: jc -p netstat -apee
|
||||
```
|
||||
```json
|
||||
[
|
||||
@ -778,7 +781,7 @@ netstat -apee | jc --netstat -p # or: jc -p netstat -apee
|
||||
```
|
||||
### /etc/passwd file
|
||||
```bash
|
||||
cat /etc/passwd | jc --passwd -p
|
||||
cat /etc/passwd | jc -p --passwd
|
||||
```
|
||||
```json
|
||||
[
|
||||
@ -804,7 +807,7 @@ cat /etc/passwd | jc --passwd -p
|
||||
```
|
||||
### ping
|
||||
```bash
|
||||
ping 8.8.8.8 -c 3 | jc --ping -p # or: jc -p ping 8.8.8.8 -c 3
|
||||
ping 8.8.8.8 -c 3 | jc -p --ping # or: jc -p ping 8.8.8.8 -c 3
|
||||
```
|
||||
```json
|
||||
{
|
||||
@ -857,7 +860,7 @@ ping 8.8.8.8 -c 3 | jc --ping -p # or: jc -p ping 8.8.8.8 -c 3
|
||||
```
|
||||
### ps
|
||||
```bash
|
||||
ps axu | jc --ps -p # or: jc -p ps axu
|
||||
ps axu | jc -p --ps # or: jc -p ps axu
|
||||
```
|
||||
```json
|
||||
[
|
||||
@ -904,7 +907,7 @@ ps axu | jc --ps -p # or: jc -p ps axu
|
||||
```
|
||||
### traceroute
|
||||
```bash
|
||||
traceroute -m 2 8.8.8.8 | jc --traceroute -p
|
||||
traceroute -m 2 8.8.8.8 | jc -p --traceroute
|
||||
# or: jc -p traceroute -m 2 8.8.8.8
|
||||
```
|
||||
```json
|
||||
@ -969,7 +972,7 @@ traceroute -m 2 8.8.8.8 | jc --traceroute -p
|
||||
```
|
||||
### uptime
|
||||
```bash
|
||||
uptime | jc --uptime -p # or: jc -p uptime
|
||||
uptime | jc -p --uptime # or: jc -p uptime
|
||||
```
|
||||
```json
|
||||
{
|
||||
@ -1014,7 +1017,7 @@ cat cd_catalog.xml
|
||||
...
|
||||
```
|
||||
```bash
|
||||
cat cd_catalog.xml | jc --xml -p
|
||||
cat cd_catalog.xml | jc -p --xml
|
||||
```
|
||||
```json
|
||||
{
|
||||
@ -1066,7 +1069,7 @@ spec:
|
||||
mode: ISTIO_MUTUAL
|
||||
```
|
||||
```bash
|
||||
cat istio.yaml | jc --yaml -p
|
||||
cat istio.yaml | jc -p --yaml
|
||||
```
|
||||
```json
|
||||
[
|
||||
|
Reference in New Issue
Block a user