From b784db404d0569a4c630eb124b37b0b1d0846453 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Thu, 10 Mar 2022 13:32:26 -0800 Subject: [PATCH] streaming doc formatting update --- docs/parsers/csv_s.md | 13 +++---------- docs/parsers/iostat_s.md | 20 ++++++++++---------- docs/parsers/ls_s.md | 16 ++++------------ docs/parsers/pidstat_s.md | 9 ++++++++- docs/parsers/ping_s.md | 13 +++---------- docs/parsers/rsync_s.md | 13 +++---------- docs/parsers/stat_s.md | 13 +++---------- docs/parsers/vmstat_s.md | 23 ++++++++--------------- jc/parsers/csv_s.py | 13 +++---------- jc/parsers/foo_s.py | 13 +++---------- jc/parsers/iostat_s.py | 20 ++++++++++---------- jc/parsers/ls_s.py | 16 ++++------------ jc/parsers/pidstat_s.py | 9 ++++++++- jc/parsers/ping_s.py | 13 +++---------- jc/parsers/rsync_s.py | 13 +++---------- jc/parsers/stat_s.py | 13 +++---------- jc/parsers/vmstat_s.py | 23 ++++++++--------------- 17 files changed, 87 insertions(+), 166 deletions(-) diff --git a/docs/parsers/csv_s.md b/docs/parsers/csv_s.md index bcbbaab2..6b096ee2 100644 --- a/docs/parsers/csv_s.md +++ b/docs/parsers/csv_s.md @@ -5,7 +5,8 @@ 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 delimiter character. If the delimiter cannot be detected it will default @@ -21,19 +22,11 @@ Usage (cli): Usage (module): import jc - # result is an iterable object (generator) + result = jc.parse('csv_s', csv_output.splitlines()) for item in result: # 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: csv file converted to a Dictionary: diff --git a/docs/parsers/iostat_s.md b/docs/parsers/iostat_s.md index 6bdafbf0..698d15d8 100644 --- a/docs/parsers/iostat_s.md +++ b/docs/parsers/iostat_s.md @@ -5,7 +5,8 @@ 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 @@ -13,22 +14,21 @@ Usage (cli): $ 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): import jc - # result is an iterable object (generator) + result = jc.parse('iostat_s', iostat_command_output.splitlines()) for item in result: # 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: { diff --git a/docs/parsers/ls_s.md b/docs/parsers/ls_s.md index fe378ba3..02097f98 100644 --- a/docs/parsers/ls_s.md +++ b/docs/parsers/ls_s.md @@ -3,10 +3,10 @@ # jc.parsers.ls\_s -jc - JSON Convert `ls` and `vdir` command output streaming -parser +jc - JSON Convert `ls` and `vdir` 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) 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`. @@ -27,19 +27,11 @@ Usage (cli): Usage (module): import jc - # result is an iterable object (generator) + result = jc.parse('ls_s', ls_command_output.splitlines()) for item in result: # 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: { diff --git a/docs/parsers/pidstat_s.md b/docs/parsers/pidstat_s.md index 5d185262..d94feebb 100644 --- a/docs/parsers/pidstat_s.md +++ b/docs/parsers/pidstat_s.md @@ -6,7 +6,7 @@ jc - JSON Convert `pidstat` command output streaming parser > 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 supported in combination with `-h`. @@ -15,6 +15,13 @@ Usage (cli): $ 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): import jc diff --git a/docs/parsers/ping_s.md b/docs/parsers/ping_s.md index a9ed227d..86f22ba4 100644 --- a/docs/parsers/ping_s.md +++ b/docs/parsers/ping_s.md @@ -5,7 +5,8 @@ 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. @@ -23,19 +24,11 @@ Usage (cli): Usage (module): import jc - # result is an iterable object (generator) + result = jc.parse('ping_s', ping_command_output.splitlines()) for item in result: # 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: { diff --git a/docs/parsers/rsync_s.md b/docs/parsers/rsync_s.md index 7c8252e7..a77a2a2e 100644 --- a/docs/parsers/rsync_s.md +++ b/docs/parsers/rsync_s.md @@ -5,7 +5,8 @@ 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 verbosity. This parser will process the STDOUT output or a log file @@ -22,19 +23,11 @@ Usage (cli): Usage (module): import jc - # result is an iterable object (generator) + result = jc.parse('rsync_s', rsync_command_output.splitlines()) for item in result: # 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: { diff --git a/docs/parsers/stat_s.md b/docs/parsers/stat_s.md index 0cb079b8..2ea8e03f 100644 --- a/docs/parsers/stat_s.md +++ b/docs/parsers/stat_s.md @@ -5,7 +5,8 @@ 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 local time of the system the parser is run on). @@ -20,19 +21,11 @@ Usage (cli): Usage (module): import jc - # result is an iterable object (generator) + result = jc.parse('stat_s', stat_command_output.splitlines()) for item in result: # 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: { diff --git a/docs/parsers/vmstat_s.md b/docs/parsers/vmstat_s.md index 2a148ce0..b92bd283 100644 --- a/docs/parsers/vmstat_s.md +++ b/docs/parsers/vmstat_s.md @@ -5,7 +5,8 @@ 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` @@ -20,28 +21,20 @@ Usage (cli): $ vmstat | jc --vmstat-s > 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 -`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 -the [readme](https://github.com/kellyjonbrazil/jc/tree/master#unbuffering-output) -for more information. + 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` + 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): import jc - # result is an iterable object (generator) + result = jc.parse('vmstat_s', vmstat_command_output.splitlines()) for item in result: # 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: { diff --git a/jc/parsers/csv_s.py b/jc/parsers/csv_s.py index 16d0cf66..8434389d 100644 --- a/jc/parsers/csv_s.py +++ b/jc/parsers/csv_s.py @@ -1,6 +1,7 @@ """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 delimiter character. If the delimiter cannot be detected it will default @@ -16,19 +17,11 @@ Usage (cli): Usage (module): import jc - # result is an iterable object (generator) + result = jc.parse('csv_s', csv_output.splitlines()) for item in result: # 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: csv file converted to a Dictionary: diff --git a/jc/parsers/foo_s.py b/jc/parsers/foo_s.py index 0215e1f2..229ac345 100644 --- a/jc/parsers/foo_s.py +++ b/jc/parsers/foo_s.py @@ -1,6 +1,7 @@ """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) <> @@ -11,19 +12,11 @@ Usage (cli): Usage (module): import jc - # result is an iterable object (generator) + result = jc.parse('foo_s', foo_command_output.splitlines()) for item in result: # 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: { diff --git a/jc/parsers/iostat_s.py b/jc/parsers/iostat_s.py index 6c52ea08..9df7e14c 100644 --- a/jc/parsers/iostat_s.py +++ b/jc/parsers/iostat_s.py @@ -1,6 +1,7 @@ """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 @@ -8,22 +9,21 @@ Usage (cli): $ 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): import jc - # result is an iterable object (generator) + result = jc.parse('iostat_s', iostat_command_output.splitlines()) for item in result: # 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: { diff --git a/jc/parsers/ls_s.py b/jc/parsers/ls_s.py index 149ad683..003383b0 100644 --- a/jc/parsers/ls_s.py +++ b/jc/parsers/ls_s.py @@ -1,7 +1,7 @@ -"""jc - JSON Convert `ls` and `vdir` command output streaming -parser +"""jc - JSON Convert `ls` and `vdir` 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) 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`. @@ -22,19 +22,11 @@ Usage (cli): Usage (module): import jc - # result is an iterable object (generator) + result = jc.parse('ls_s', ls_command_output.splitlines()) for item in result: # 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: { diff --git a/jc/parsers/pidstat_s.py b/jc/parsers/pidstat_s.py index 19977598..3a7b7b62 100644 --- a/jc/parsers/pidstat_s.py +++ b/jc/parsers/pidstat_s.py @@ -1,7 +1,7 @@ """jc - JSON Convert `pidstat` command output streaming parser > 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 supported in combination with `-h`. @@ -10,6 +10,13 @@ Usage (cli): $ 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): import jc diff --git a/jc/parsers/ping_s.py b/jc/parsers/ping_s.py index 1c74cea2..2acea940 100644 --- a/jc/parsers/ping_s.py +++ b/jc/parsers/ping_s.py @@ -1,6 +1,7 @@ """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. @@ -18,19 +19,11 @@ Usage (cli): Usage (module): import jc - # result is an iterable object (generator) + result = jc.parse('ping_s', ping_command_output.splitlines()) for item in result: # 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: { diff --git a/jc/parsers/rsync_s.py b/jc/parsers/rsync_s.py index c55cab4a..4ecfe9d2 100644 --- a/jc/parsers/rsync_s.py +++ b/jc/parsers/rsync_s.py @@ -1,6 +1,7 @@ """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 verbosity. This parser will process the STDOUT output or a log file @@ -17,19 +18,11 @@ Usage (cli): Usage (module): import jc - # result is an iterable object (generator) + result = jc.parse('rsync_s', rsync_command_output.splitlines()) for item in result: # 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: { diff --git a/jc/parsers/stat_s.py b/jc/parsers/stat_s.py index aa790ef2..3c3f9271 100644 --- a/jc/parsers/stat_s.py +++ b/jc/parsers/stat_s.py @@ -1,6 +1,7 @@ """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 local time of the system the parser is run on). @@ -15,19 +16,11 @@ Usage (cli): Usage (module): import jc - # result is an iterable object (generator) + result = jc.parse('stat_s', stat_command_output.splitlines()) for item in result: # 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: { diff --git a/jc/parsers/vmstat_s.py b/jc/parsers/vmstat_s.py index 75e480d8..cdb53c4a 100644 --- a/jc/parsers/vmstat_s.py +++ b/jc/parsers/vmstat_s.py @@ -1,6 +1,7 @@ """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` @@ -15,28 +16,20 @@ Usage (cli): $ vmstat | jc --vmstat-s > 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 -`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 -the [readme](https://github.com/kellyjonbrazil/jc/tree/master#unbuffering-output) -for more information. + 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` + 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): import jc - # result is an iterable object (generator) + result = jc.parse('vmstat_s', vmstat_command_output.splitlines()) for item in result: # 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: {