1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-15 01:24:29 +02:00

streaming doc formatting update

This commit is contained in:
Kelly Brazil
2022-03-10 13:32:26 -08:00
parent 8aee4517bb
commit b784db404d
17 changed files with 87 additions and 166 deletions

View File

@ -5,7 +5,8 @@
jc - JSON Convert `csv` file streaming parser jc - JSON Convert `csv` file streaming parser
> This streaming parser outputs JSON Lines > This streaming parser outputs JSON Lines (cli) or returns a Generator
iterator of Dictionaries (module)
The `csv` streaming parser will attempt to automatically detect the The `csv` streaming parser will attempt to automatically detect the
delimiter character. If the delimiter cannot be detected it will default delimiter character. If the delimiter cannot be detected it will default
@ -21,19 +22,11 @@ Usage (cli):
Usage (module): Usage (module):
import jc import jc
# result is an iterable object (generator)
result = jc.parse('csv_s', csv_output.splitlines()) result = jc.parse('csv_s', csv_output.splitlines())
for item in result: for item in result:
# do something # do something
or
import jc.parsers.csv_s
# result is an iterable object (generator)
result = jc.parsers.csv_s.parse(csv_output.splitlines())
for item in result:
# do something
Schema: Schema:
csv file converted to a Dictionary: csv file converted to a Dictionary:

View File

@ -5,7 +5,8 @@
jc - JSON Convert `iostat` command output streaming parser jc - JSON Convert `iostat` command output streaming parser
> This streaming parser outputs JSON Lines > This streaming parser outputs JSON Lines (cli) or returns a Generator
iterator of Dictionaries (module)
Note: `iostat` version 11 and higher include a JSON output option Note: `iostat` version 11 and higher include a JSON output option
@ -13,22 +14,21 @@ Usage (cli):
$ iostat | jc --iostat-s $ iostat | jc --iostat-s
> Note: When piping `jc` converted `iostat` output to other processes it may
appear the output is hanging due to the OS pipe buffers. This is because
`iostat` output is too small to quickly fill up the buffer. Use the `-u`
option to unbuffer the `jc` output if you would like immediate output. See
the [readme](https://github.com/kellyjonbrazil/jc/tree/master#unbuffering-output)
for more information.
Usage (module): Usage (module):
import jc import jc
# result is an iterable object (generator)
result = jc.parse('iostat_s', iostat_command_output.splitlines()) result = jc.parse('iostat_s', iostat_command_output.splitlines())
for item in result: for item in result:
# do something # do something
or
import jc.parsers.iostat_s
# result is an iterable object (generator)
result = jc.parsers.iostat_s.parse(iostat_command_output.splitlines())
for item in result:
# do something
Schema: Schema:
{ {

View File

@ -3,10 +3,10 @@
# jc.parsers.ls\_s # jc.parsers.ls\_s
jc - JSON Convert `ls` and `vdir` command output streaming jc - JSON Convert `ls` and `vdir` command output streaming parser
parser
> This streaming parser outputs JSON Lines > This streaming parser outputs JSON Lines (cli) or returns a Generator
iterator of Dictionaries (module)
Requires the `-l` option to be used on `ls`. If there are newline characters Requires the `-l` option to be used on `ls`. If there are newline characters
in the filename, then make sure to use the `-b` option on `ls`. in the filename, then make sure to use the `-b` option on `ls`.
@ -27,19 +27,11 @@ Usage (cli):
Usage (module): Usage (module):
import jc import jc
# result is an iterable object (generator)
result = jc.parse('ls_s', ls_command_output.splitlines()) result = jc.parse('ls_s', ls_command_output.splitlines())
for item in result: for item in result:
# do something # do something
or
import jc.parsers.ls_s
# result is an iterable object (generator)
result = jc.parsers.ls_s.parse(ls_command_output.splitlines())
for item in result:
# do something
Schema: Schema:
{ {

View File

@ -6,7 +6,7 @@
jc - JSON Convert `pidstat` command output streaming parser jc - JSON Convert `pidstat` command output streaming parser
> This streaming parser outputs JSON Lines (cli) or returns a Generator > This streaming parser outputs JSON Lines (cli) or returns a Generator
iterator of Dictionaries (module) iterator of Dictionaries (module)
Must use the `-h` option in `pidstat`. All other `pidstat` options are Must use the `-h` option in `pidstat`. All other `pidstat` options are
supported in combination with `-h`. supported in combination with `-h`.
@ -15,6 +15,13 @@ Usage (cli):
$ pidstat | jc --pidstat-s $ pidstat | jc --pidstat-s
> Note: When piping `jc` converted `pidstat` output to other processes it
may appear the output is hanging due to the OS pipe buffers. This is
because `pidstat` output is too small to quickly fill up the buffer. Use
the `-u` option to unbuffer the `jc` output if you would like immediate
output. See the [readme](https://github.com/kellyjonbrazil/jc/tree/master#unbuffering-output)
for more information.
Usage (module): Usage (module):
import jc import jc

View File

@ -5,7 +5,8 @@
jc - JSON Convert `ping` command output streaming parser jc - JSON Convert `ping` command output streaming parser
> This streaming parser outputs JSON Lines > This streaming parser outputs JSON Lines (cli) or returns a Generator
iterator of Dictionaries (module)
Supports `ping` and `ping6` output. Supports `ping` and `ping6` output.
@ -23,19 +24,11 @@ Usage (cli):
Usage (module): Usage (module):
import jc import jc
# result is an iterable object (generator)
result = jc.parse('ping_s', ping_command_output.splitlines()) result = jc.parse('ping_s', ping_command_output.splitlines())
for item in result: for item in result:
# do something # do something
or
import jc.parsers.ping_s
# result is an iterable object (generator)
result = jc.parsers.ping_s.parse(ping_command_output.splitlines())
for item in result:
# do something
Schema: Schema:
{ {

View File

@ -5,7 +5,8 @@
jc - JSON Convert `rsync` command output streaming parser jc - JSON Convert `rsync` command output streaming parser
> This streaming parser outputs JSON Lines > This streaming parser outputs JSON Lines (cli) or returns a Generator
iterator of Dictionaries (module)
Supports the `-i` or `--itemize-changes` options with all levels of Supports the `-i` or `--itemize-changes` options with all levels of
verbosity. This parser will process the STDOUT output or a log file verbosity. This parser will process the STDOUT output or a log file
@ -22,19 +23,11 @@ Usage (cli):
Usage (module): Usage (module):
import jc import jc
# result is an iterable object (generator)
result = jc.parse('rsync_s', rsync_command_output.splitlines()) result = jc.parse('rsync_s', rsync_command_output.splitlines())
for item in result: for item in result:
# do something # do something
or
import jc.parsers.rsync_s
# result is an iterable object (generator)
result = jc.parsers.rsync_s.parse(rsync_command_output.splitlines())
for item in result:
# do something
Schema: Schema:
{ {

View File

@ -5,7 +5,8 @@
jc - JSON Convert `stat` command output streaming parser jc - JSON Convert `stat` command output streaming parser
> This streaming parser outputs JSON Lines > This streaming parser outputs JSON Lines (cli) or returns a Generator
iterator of Dictionaries (module)
The `xxx_epoch` calculated timestamp fields are naive. (i.e. based on the The `xxx_epoch` calculated timestamp fields are naive. (i.e. based on the
local time of the system the parser is run on). local time of the system the parser is run on).
@ -20,19 +21,11 @@ Usage (cli):
Usage (module): Usage (module):
import jc import jc
# result is an iterable object (generator)
result = jc.parse('stat_s', stat_command_output.splitlines()) result = jc.parse('stat_s', stat_command_output.splitlines())
for item in result: for item in result:
# do something # do something
or
import jc.parsers.stat_s
# result is an iterable object (generator)
result = jc.parsers.stat_s.parse(stat_command_output.splitlines())
for item in result:
# do something
Schema: Schema:
{ {

View File

@ -5,7 +5,8 @@
jc - JSON Convert `vmstat` command output streaming parser jc - JSON Convert `vmstat` command output streaming parser
> This streaming parser outputs JSON Lines > This streaming parser outputs JSON Lines (cli) or returns a Generator
iterator of Dictionaries (module)
Options supported: `-a`, `-w`, `-d`, `-t` Options supported: `-a`, `-w`, `-d`, `-t`
@ -20,28 +21,20 @@ Usage (cli):
$ vmstat | jc --vmstat-s $ vmstat | jc --vmstat-s
> Note: When piping `jc` converted `vmstat` output to other processes it may > Note: When piping `jc` converted `vmstat` output to other processes it may
appear the output is hanging due to the OS pipe buffers. This is because appear the output is hanging due to the OS pipe buffers. This is because
`vmstat` output is too small to quickly fill up the buffer. Use the `-u` `vmstat` output is too small to quickly fill up the buffer. Use the `-u`
option to unbuffer the `jc` output if you would like immediate output. See option to unbuffer the `jc` output if you would like immediate output. See
the [readme](https://github.com/kellyjonbrazil/jc/tree/master#unbuffering-output) the [readme](https://github.com/kellyjonbrazil/jc/tree/master#unbuffering-output)
for more information. for more information.
Usage (module): Usage (module):
import jc import jc
# result is an iterable object (generator)
result = jc.parse('vmstat_s', vmstat_command_output.splitlines()) result = jc.parse('vmstat_s', vmstat_command_output.splitlines())
for item in result: for item in result:
# do something # do something
or
import jc.parsers.vmstat_s
# result is an iterable object (generator)
result = jc.parsers.vmstat_s.parse(vmstat_command_output.splitlines())
for item in result:
# do something
Schema: Schema:
{ {

View File

@ -1,6 +1,7 @@
"""jc - JSON Convert `csv` file streaming parser """jc - JSON Convert `csv` file streaming parser
> This streaming parser outputs JSON Lines > This streaming parser outputs JSON Lines (cli) or returns a Generator
iterator of Dictionaries (module)
The `csv` streaming parser will attempt to automatically detect the The `csv` streaming parser will attempt to automatically detect the
delimiter character. If the delimiter cannot be detected it will default delimiter character. If the delimiter cannot be detected it will default
@ -16,19 +17,11 @@ Usage (cli):
Usage (module): Usage (module):
import jc import jc
# result is an iterable object (generator)
result = jc.parse('csv_s', csv_output.splitlines()) result = jc.parse('csv_s', csv_output.splitlines())
for item in result: for item in result:
# do something # do something
or
import jc.parsers.csv_s
# result is an iterable object (generator)
result = jc.parsers.csv_s.parse(csv_output.splitlines())
for item in result:
# do something
Schema: Schema:
csv file converted to a Dictionary: csv file converted to a Dictionary:

View File

@ -1,6 +1,7 @@
"""jc - JSON Convert `foo` command output streaming parser """jc - JSON Convert `foo` command output streaming parser
> This streaming parser outputs JSON Lines > This streaming parser outputs JSON Lines (cli) or returns a Generator
iterator of Dictionaries (module)
<<Short foo description and caveats>> <<Short foo description and caveats>>
@ -11,19 +12,11 @@ Usage (cli):
Usage (module): Usage (module):
import jc import jc
# result is an iterable object (generator)
result = jc.parse('foo_s', foo_command_output.splitlines()) result = jc.parse('foo_s', foo_command_output.splitlines())
for item in result: for item in result:
# do something # do something
or
import jc.parsers.foo_s
# result is an iterable object (generator)
result = jc.parsers.foo_s.parse(foo_command_output.splitlines())
for item in result:
# do something
Schema: Schema:
{ {

View File

@ -1,6 +1,7 @@
"""jc - JSON Convert `iostat` command output streaming parser """jc - JSON Convert `iostat` command output streaming parser
> This streaming parser outputs JSON Lines > This streaming parser outputs JSON Lines (cli) or returns a Generator
iterator of Dictionaries (module)
Note: `iostat` version 11 and higher include a JSON output option Note: `iostat` version 11 and higher include a JSON output option
@ -8,22 +9,21 @@ Usage (cli):
$ iostat | jc --iostat-s $ iostat | jc --iostat-s
> Note: When piping `jc` converted `iostat` output to other processes it may
appear the output is hanging due to the OS pipe buffers. This is because
`iostat` output is too small to quickly fill up the buffer. Use the `-u`
option to unbuffer the `jc` output if you would like immediate output. See
the [readme](https://github.com/kellyjonbrazil/jc/tree/master#unbuffering-output)
for more information.
Usage (module): Usage (module):
import jc import jc
# result is an iterable object (generator)
result = jc.parse('iostat_s', iostat_command_output.splitlines()) result = jc.parse('iostat_s', iostat_command_output.splitlines())
for item in result: for item in result:
# do something # do something
or
import jc.parsers.iostat_s
# result is an iterable object (generator)
result = jc.parsers.iostat_s.parse(iostat_command_output.splitlines())
for item in result:
# do something
Schema: Schema:
{ {

View File

@ -1,7 +1,7 @@
"""jc - JSON Convert `ls` and `vdir` command output streaming """jc - JSON Convert `ls` and `vdir` command output streaming parser
parser
> This streaming parser outputs JSON Lines > This streaming parser outputs JSON Lines (cli) or returns a Generator
iterator of Dictionaries (module)
Requires the `-l` option to be used on `ls`. If there are newline characters Requires the `-l` option to be used on `ls`. If there are newline characters
in the filename, then make sure to use the `-b` option on `ls`. in the filename, then make sure to use the `-b` option on `ls`.
@ -22,19 +22,11 @@ Usage (cli):
Usage (module): Usage (module):
import jc import jc
# result is an iterable object (generator)
result = jc.parse('ls_s', ls_command_output.splitlines()) result = jc.parse('ls_s', ls_command_output.splitlines())
for item in result: for item in result:
# do something # do something
or
import jc.parsers.ls_s
# result is an iterable object (generator)
result = jc.parsers.ls_s.parse(ls_command_output.splitlines())
for item in result:
# do something
Schema: Schema:
{ {

View File

@ -1,7 +1,7 @@
"""jc - JSON Convert `pidstat` command output streaming parser """jc - JSON Convert `pidstat` command output streaming parser
> This streaming parser outputs JSON Lines (cli) or returns a Generator > This streaming parser outputs JSON Lines (cli) or returns a Generator
iterator of Dictionaries (module) iterator of Dictionaries (module)
Must use the `-h` option in `pidstat`. All other `pidstat` options are Must use the `-h` option in `pidstat`. All other `pidstat` options are
supported in combination with `-h`. supported in combination with `-h`.
@ -10,6 +10,13 @@ Usage (cli):
$ pidstat | jc --pidstat-s $ pidstat | jc --pidstat-s
> Note: When piping `jc` converted `pidstat` output to other processes it
may appear the output is hanging due to the OS pipe buffers. This is
because `pidstat` output is too small to quickly fill up the buffer. Use
the `-u` option to unbuffer the `jc` output if you would like immediate
output. See the [readme](https://github.com/kellyjonbrazil/jc/tree/master#unbuffering-output)
for more information.
Usage (module): Usage (module):
import jc import jc

View File

@ -1,6 +1,7 @@
"""jc - JSON Convert `ping` command output streaming parser """jc - JSON Convert `ping` command output streaming parser
> This streaming parser outputs JSON Lines > This streaming parser outputs JSON Lines (cli) or returns a Generator
iterator of Dictionaries (module)
Supports `ping` and `ping6` output. Supports `ping` and `ping6` output.
@ -18,19 +19,11 @@ Usage (cli):
Usage (module): Usage (module):
import jc import jc
# result is an iterable object (generator)
result = jc.parse('ping_s', ping_command_output.splitlines()) result = jc.parse('ping_s', ping_command_output.splitlines())
for item in result: for item in result:
# do something # do something
or
import jc.parsers.ping_s
# result is an iterable object (generator)
result = jc.parsers.ping_s.parse(ping_command_output.splitlines())
for item in result:
# do something
Schema: Schema:
{ {

View File

@ -1,6 +1,7 @@
"""jc - JSON Convert `rsync` command output streaming parser """jc - JSON Convert `rsync` command output streaming parser
> This streaming parser outputs JSON Lines > This streaming parser outputs JSON Lines (cli) or returns a Generator
iterator of Dictionaries (module)
Supports the `-i` or `--itemize-changes` options with all levels of Supports the `-i` or `--itemize-changes` options with all levels of
verbosity. This parser will process the STDOUT output or a log file verbosity. This parser will process the STDOUT output or a log file
@ -17,19 +18,11 @@ Usage (cli):
Usage (module): Usage (module):
import jc import jc
# result is an iterable object (generator)
result = jc.parse('rsync_s', rsync_command_output.splitlines()) result = jc.parse('rsync_s', rsync_command_output.splitlines())
for item in result: for item in result:
# do something # do something
or
import jc.parsers.rsync_s
# result is an iterable object (generator)
result = jc.parsers.rsync_s.parse(rsync_command_output.splitlines())
for item in result:
# do something
Schema: Schema:
{ {

View File

@ -1,6 +1,7 @@
"""jc - JSON Convert `stat` command output streaming parser """jc - JSON Convert `stat` command output streaming parser
> This streaming parser outputs JSON Lines > This streaming parser outputs JSON Lines (cli) or returns a Generator
iterator of Dictionaries (module)
The `xxx_epoch` calculated timestamp fields are naive. (i.e. based on the The `xxx_epoch` calculated timestamp fields are naive. (i.e. based on the
local time of the system the parser is run on). local time of the system the parser is run on).
@ -15,19 +16,11 @@ Usage (cli):
Usage (module): Usage (module):
import jc import jc
# result is an iterable object (generator)
result = jc.parse('stat_s', stat_command_output.splitlines()) result = jc.parse('stat_s', stat_command_output.splitlines())
for item in result: for item in result:
# do something # do something
or
import jc.parsers.stat_s
# result is an iterable object (generator)
result = jc.parsers.stat_s.parse(stat_command_output.splitlines())
for item in result:
# do something
Schema: Schema:
{ {

View File

@ -1,6 +1,7 @@
"""jc - JSON Convert `vmstat` command output streaming parser """jc - JSON Convert `vmstat` command output streaming parser
> This streaming parser outputs JSON Lines > This streaming parser outputs JSON Lines (cli) or returns a Generator
iterator of Dictionaries (module)
Options supported: `-a`, `-w`, `-d`, `-t` Options supported: `-a`, `-w`, `-d`, `-t`
@ -15,28 +16,20 @@ Usage (cli):
$ vmstat | jc --vmstat-s $ vmstat | jc --vmstat-s
> Note: When piping `jc` converted `vmstat` output to other processes it may > Note: When piping `jc` converted `vmstat` output to other processes it may
appear the output is hanging due to the OS pipe buffers. This is because appear the output is hanging due to the OS pipe buffers. This is because
`vmstat` output is too small to quickly fill up the buffer. Use the `-u` `vmstat` output is too small to quickly fill up the buffer. Use the `-u`
option to unbuffer the `jc` output if you would like immediate output. See option to unbuffer the `jc` output if you would like immediate output. See
the [readme](https://github.com/kellyjonbrazil/jc/tree/master#unbuffering-output) the [readme](https://github.com/kellyjonbrazil/jc/tree/master#unbuffering-output)
for more information. for more information.
Usage (module): Usage (module):
import jc import jc
# result is an iterable object (generator)
result = jc.parse('vmstat_s', vmstat_command_output.splitlines()) result = jc.parse('vmstat_s', vmstat_command_output.splitlines())
for item in result: for item in result:
# do something # do something
or
import jc.parsers.vmstat_s
# result is an iterable object (generator)
result = jc.parsers.vmstat_s.parse(vmstat_command_output.splitlines())
for item in result:
# do something
Schema: Schema:
{ {