1
0
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:
Kelly Brazil
2022-09-07 13:56:16 -07:00
parent 4d761d7e8a
commit c4c159f056
5 changed files with 86 additions and 47 deletions

View File

@ -133,7 +133,9 @@ on Github.
`jc` accepts piped input from `STDIN` and outputs a JSON representation of the `jc` accepts piped input from `STDIN` and outputs a JSON representation of the
previous command's output to `STDOUT`. previous command's output to `STDOUT`.
```bash ```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 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) given. (Note: command aliases and shell builtins are not supported)
```bash ```bash
jc [OPTIONS] COMMAND jc [OPTIONS] COMMAND
jc [OPTIONS] /proc/<path-to-file>
``` ```
The JSON output can be compact (default) or pretty formatted with the `-p` 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: macOS:
```bash ```bash
cat lsof.out | jc --lsof -q cat lsof.out | jc -q --lsof
``` ```
or Windows: or Windows:
```bash ```bash
type lsof.out | jc --lsof -q type lsof.out | jc -q --lsof
``` ```
Tested on: Tested on:
@ -587,7 +590,7 @@ documentation.
### arp ### arp
```bash ```bash
arp | jc --arp -p # or: jc -p arp arp | jc -p --arp # or: jc -p arp
``` ```
```json ```json
[ [
@ -626,7 +629,7 @@ cat homes.csv
... ...
``` ```
```bash ```bash
cat homes.csv | jc --csv -p cat homes.csv | jc -p --csv
``` ```
```json ```json
[ [
@ -667,7 +670,7 @@ cat homes.csv | jc --csv -p
``` ```
### /etc/hosts file ### /etc/hosts file
```bash ```bash
cat /etc/hosts | jc --hosts -p cat /etc/hosts | jc -p --hosts
``` ```
```json ```json
[ [
@ -694,7 +697,7 @@ cat /etc/hosts | jc --hosts -p
``` ```
### ifconfig ### ifconfig
```bash ```bash
ifconfig | jc --ifconfig -p # or: jc -p ifconfig ifconfig | jc -p --ifconfig # or: jc -p ifconfig
``` ```
```json ```json
[ [
@ -752,7 +755,7 @@ Port = 50022
ForwardX11 = no ForwardX11 = no
``` ```
```bash ```bash
cat example.ini | jc --ini -p cat example.ini | jc -p --ini
``` ```
```json ```json
{ {
@ -774,7 +777,7 @@ cat example.ini | jc --ini -p
``` ```
### ls ### ls
```bash ```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 ```json
[ [
@ -810,7 +813,7 @@ $ ls -l /usr/bin | jc --ls -p # or: jc -p ls -l /usr/bin
``` ```
### netstat ### netstat
```bash ```bash
netstat -apee | jc --netstat -p # or: jc -p netstat -apee netstat -apee | jc -p --netstat # or: jc -p netstat -apee
``` ```
```json ```json
[ [
@ -898,7 +901,7 @@ netstat -apee | jc --netstat -p # or: jc -p netstat -apee
``` ```
### /etc/passwd file ### /etc/passwd file
```bash ```bash
cat /etc/passwd | jc --passwd -p cat /etc/passwd | jc -p --passwd
``` ```
```json ```json
[ [
@ -924,7 +927,7 @@ cat /etc/passwd | jc --passwd -p
``` ```
### ping ### ping
```bash ```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 ```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 ### ps
```bash ```bash
ps axu | jc --ps -p # or: jc -p ps axu ps axu | jc -p --ps # or: jc -p ps axu
``` ```
```json ```json
[ [
@ -1024,7 +1027,7 @@ ps axu | jc --ps -p # or: jc -p ps axu
``` ```
### traceroute ### traceroute
```bash ```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 # or: jc -p traceroute -m 2 8.8.8.8
``` ```
```json ```json
@ -1089,7 +1092,7 @@ traceroute -m 2 8.8.8.8 | jc --traceroute -p
``` ```
### uptime ### uptime
```bash ```bash
uptime | jc --uptime -p # or: jc -p uptime uptime | jc -p --uptime # or: jc -p uptime
``` ```
```json ```json
{ {
@ -1134,7 +1137,7 @@ cat cd_catalog.xml
... ...
``` ```
```bash ```bash
cat cd_catalog.xml | jc --xml -p cat cd_catalog.xml | jc -p --xml
``` ```
```json ```json
{ {
@ -1186,7 +1189,7 @@ spec:
mode: ISTIO_MUTUAL mode: ISTIO_MUTUAL
``` ```
```bash ```bash
cat istio.yaml | jc --yaml -p cat istio.yaml | jc -p --yaml
``` ```
```json ```json
[ [

View File

@ -215,7 +215,6 @@ Examples:
Show Hidden Parsers: Show Hidden Parsers:
$ jc -hh $ jc -hh
$ jc --about --pretty
''' '''
return helptext_string return helptext_string

View File

@ -1,13 +1,26 @@
.TH jc 1 2022-09-07 1.21.2 "JSON Convert" .TH jc 1 2022-09-07 1.21.2 "JSON Convert"
.SH NAME .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 .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] COMMAND
\fBjc\fP [OPTIONS] /proc/<path-to-file>
.RE
.SH DESCRIPTION .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) \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 .SH EXAMPLES
Standard Syntax: Standard Syntax:
.RS .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 .RE
Magic Syntax: Magic Syntax:
.RS .RS
$ jc \fB-p\fP dig www.google.com $ jc \fB--pretty\fP dig www.google.com
$ jc \fB--pretty\fP /proc/meminfo
.RE .RE
For parser documentation: For parser documentation:
.RS .RS
$ jc \fB-h\fP \fB--dig\fP $ jc \fB--help\fP \fB--dig\fP
.RE .RE
.SH AUTHOR .SH AUTHOR
Kelly Brazil (kellyjonbrazil@gmail.com) Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -1,13 +1,26 @@
.TH jc 1 {{ today }} {{ jc.version}} "JSON Convert" .TH jc 1 {{ today }} {{ jc.version}} "JSON Convert"
.SH NAME .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 .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] COMMAND
\fBjc\fP [OPTIONS] /proc/<path-to-file>
.RE
.SH DESCRIPTION .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) \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 .SH EXAMPLES
Standard Syntax: Standard Syntax:
.RS .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 .RE
Magic Syntax: Magic Syntax:
.RS .RS
$ jc \fB-p\fP dig www.google.com $ jc \fB--pretty\fP dig www.google.com
$ jc \fB--pretty\fP /proc/meminfo
.RE .RE
For parser documentation: For parser documentation:
.RS .RS
$ jc \fB-h\fP \fB--dig\fP $ jc \fB--help\fP \fB--dig\fP
.RE .RE
.SH AUTHOR .SH AUTHOR
{{ jc.author }} ({{ jc.author_email }}) {{ jc.author }} ({{ jc.author_email }})

View File

@ -133,7 +133,9 @@ on Github.
`jc` accepts piped input from `STDIN` and outputs a JSON representation of the `jc` accepts piped input from `STDIN` and outputs a JSON representation of the
previous command's output to `STDOUT`. previous command's output to `STDOUT`.
```bash ```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 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) given. (Note: command aliases and shell builtins are not supported)
```bash ```bash
jc [OPTIONS] COMMAND jc [OPTIONS] COMMAND
jc [OPTIONS] /proc/<path-to-file>
``` ```
The JSON output can be compact (default) or pretty formatted with the `-p` 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: macOS:
```bash ```bash
cat lsof.out | jc --lsof -q cat lsof.out | jc -q --lsof
``` ```
or Windows: or Windows:
```bash ```bash
type lsof.out | jc --lsof -q type lsof.out | jc -q --lsof
``` ```
Tested on: Tested on:
@ -467,7 +470,7 @@ documentation.
### arp ### arp
```bash ```bash
arp | jc --arp -p # or: jc -p arp arp | jc -p --arp # or: jc -p arp
``` ```
```json ```json
[ [
@ -506,7 +509,7 @@ cat homes.csv
... ...
``` ```
```bash ```bash
cat homes.csv | jc --csv -p cat homes.csv | jc -p --csv
``` ```
```json ```json
[ [
@ -547,7 +550,7 @@ cat homes.csv | jc --csv -p
``` ```
### /etc/hosts file ### /etc/hosts file
```bash ```bash
cat /etc/hosts | jc --hosts -p cat /etc/hosts | jc -p --hosts
``` ```
```json ```json
[ [
@ -574,7 +577,7 @@ cat /etc/hosts | jc --hosts -p
``` ```
### ifconfig ### ifconfig
```bash ```bash
ifconfig | jc --ifconfig -p # or: jc -p ifconfig ifconfig | jc -p --ifconfig # or: jc -p ifconfig
``` ```
```json ```json
[ [
@ -632,7 +635,7 @@ Port = 50022
ForwardX11 = no ForwardX11 = no
``` ```
```bash ```bash
cat example.ini | jc --ini -p cat example.ini | jc -p --ini
``` ```
```json ```json
{ {
@ -654,7 +657,7 @@ cat example.ini | jc --ini -p
``` ```
### ls ### ls
```bash ```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 ```json
[ [
@ -690,7 +693,7 @@ $ ls -l /usr/bin | jc --ls -p # or: jc -p ls -l /usr/bin
``` ```
### netstat ### netstat
```bash ```bash
netstat -apee | jc --netstat -p # or: jc -p netstat -apee netstat -apee | jc -p --netstat # or: jc -p netstat -apee
``` ```
```json ```json
[ [
@ -778,7 +781,7 @@ netstat -apee | jc --netstat -p # or: jc -p netstat -apee
``` ```
### /etc/passwd file ### /etc/passwd file
```bash ```bash
cat /etc/passwd | jc --passwd -p cat /etc/passwd | jc -p --passwd
``` ```
```json ```json
[ [
@ -804,7 +807,7 @@ cat /etc/passwd | jc --passwd -p
``` ```
### ping ### ping
```bash ```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 ```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 ### ps
```bash ```bash
ps axu | jc --ps -p # or: jc -p ps axu ps axu | jc -p --ps # or: jc -p ps axu
``` ```
```json ```json
[ [
@ -904,7 +907,7 @@ ps axu | jc --ps -p # or: jc -p ps axu
``` ```
### traceroute ### traceroute
```bash ```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 # or: jc -p traceroute -m 2 8.8.8.8
``` ```
```json ```json
@ -969,7 +972,7 @@ traceroute -m 2 8.8.8.8 | jc --traceroute -p
``` ```
### uptime ### uptime
```bash ```bash
uptime | jc --uptime -p # or: jc -p uptime uptime | jc -p --uptime # or: jc -p uptime
``` ```
```json ```json
{ {
@ -1014,7 +1017,7 @@ cat cd_catalog.xml
... ...
``` ```
```bash ```bash
cat cd_catalog.xml | jc --xml -p cat cd_catalog.xml | jc -p --xml
``` ```
```json ```json
{ {
@ -1066,7 +1069,7 @@ spec:
mode: ISTIO_MUTUAL mode: ISTIO_MUTUAL
``` ```
```bash ```bash
cat istio.yaml | jc --yaml -p cat istio.yaml | jc -p --yaml
``` ```
```json ```json
[ [