1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00

fix stdin stder quoting

This commit is contained in:
Kelly Brazil
2022-05-26 16:03:30 -07:00
parent 28ebb4e8dd
commit 08fbde0e8f
13 changed files with 27 additions and 23 deletions

View File

@ -311,11 +311,11 @@ color output will override both the `NO_COLOR` environment variable and the `-m`
option.
### Streaming Parsers
Most parsers load all of the data from STDIN, parse it, then output the entire
Most parsers load all of the data from `STDIN`, parse it, then output the entire
JSON document serially. There are some streaming parsers (e.g. `ls-s` and
`ping-s`) that immediately start processing and outputing the data line-by-line
as [JSON Lines](https://jsonlines.org/) (aka [NDJSON](http://ndjson.org/)) while
it is being received from STDIN. This can significantly reduce the amount of
it is being received from `STDIN`. This can significantly reduce the amount of
memory required to parse large amounts of command output (e.g. `ls -lR /`) and
can sometimes process the data more quickly. Streaming parsers have slightly
different behavior than standard parsers as outlined below.

View File

@ -31,8 +31,9 @@ except empty strings, which are converted to None/null.
> Note: table column separator characters (e.g. `|`) cannot be present
> inside the cell data. If detected, a warning message will be printed to
> STDERR and the line will be skipped. The warning message can be suppressed
> by using the `-q` command option or by setting `quiet=True` in `parse()`.
> `STDERR` and the line will be skipped. The warning message can be
> suppressed by using the `-q` command option or by setting `quiet=True` in
> `parse()`.
Usage (cli):

View File

@ -6,7 +6,7 @@
jc - JSON Convert `rsync` command output parser
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
generated with the `--log-file` option.
Usage (cli):

View File

@ -9,7 +9,7 @@ jc - JSON Convert `rsync` command output streaming parser
> 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
verbosity. This parser will process the `STDOUT` output or a log file
generated with the `--log-file` option.
Usage (cli):

View File

@ -8,8 +8,9 @@ jc - JSON Convert `top -b` command output parser
Requires batch mode (`-b`). The `-n` option must also be used to limit
the number of times `top` is run.
Warning messages will be printed to STDERR if truncated fields are detected.
These warnings can be suppressed with the `-q` or `quiet=True` option.
Warning messages will be printed to `STDERR` if truncated fields are
detected. These warnings can be suppressed with the `-q` or `quiet=True`
option.
Usage (cli):

View File

@ -27,7 +27,7 @@ jc - JSON Convert utils
def warning_message(message_lines: List[str]) -> None
```
Prints warning message to STDERR for non-fatal issues. The first line
Prints warning message to `STDERR` for non-fatal issues. The first line
is prepended with 'jc: Warning - ' and subsequent lines are indented.
Wraps text as needed based on the terminal width.
@ -47,7 +47,7 @@ Returns:
def error_message(message_lines: List[str]) -> None
```
Prints an error message to STDERR for fatal issues. The first line is
Prints an error message to `STDERR` for fatal issues. The first line is
prepended with 'jc: Error - ' and subsequent lines are indented.
Wraps text as needed based on the terminal width.
@ -80,7 +80,7 @@ def compatibility(mod_name: str,
```
Checks for the parser's compatibility with the running OS platform and
prints a warning message to STDERR if not compatible and quiet=False.
prints a warning message to `STDERR` if not compatible and quiet=False.
Parameters:

View File

@ -134,7 +134,7 @@ def set_env_colors(env_colors=None):
def piped_output(force_color):
"""
Return False if stdout is a TTY. True if output is being piped to
Return False if `STDOUT` is a TTY. True if output is being piped to
another program and foce_color is True. This allows forcing of ANSI
color codes even when using pipes.
"""

View File

@ -26,8 +26,9 @@ except empty strings, which are converted to None/null.
> Note: table column separator characters (e.g. `|`) cannot be present
> inside the cell data. If detected, a warning message will be printed to
> STDERR and the line will be skipped. The warning message can be suppressed
> by using the `-q` command option or by setting `quiet=True` in `parse()`.
> `STDERR` and the line will be skipped. The warning message can be
> suppressed by using the `-q` command option or by setting `quiet=True` in
> `parse()`.
Usage (cli):

View File

@ -1,7 +1,7 @@
"""jc - JSON Convert `rsync` command output parser
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
generated with the `--log-file` option.
Usage (cli):

View File

@ -4,7 +4,7 @@
> 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
verbosity. This parser will process the `STDOUT` output or a log file
generated with the `--log-file` option.
Usage (cli):

View File

@ -3,8 +3,9 @@
Requires batch mode (`-b`). The `-n` option must also be used to limit
the number of times `top` is run.
Warning messages will be printed to STDERR if truncated fields are detected.
These warnings can be suppressed with the `-q` or `quiet=True` option.
Warning messages will be printed to `STDERR` if truncated fields are
detected. These warnings can be suppressed with the `-q` or `quiet=True`
option.
Usage (cli):

View File

@ -31,7 +31,7 @@ def _safe_print(string: str, sep=' ', end='\n', file=sys.stdout, flush=False) ->
def warning_message(message_lines: List[str]) -> None:
"""
Prints warning message to STDERR for non-fatal issues. The first line
Prints warning message to `STDERR` for non-fatal issues. The first line
is prepended with 'jc: Warning - ' and subsequent lines are indented.
Wraps text as needed based on the terminal width.
@ -67,7 +67,7 @@ def warning_message(message_lines: List[str]) -> None:
def error_message(message_lines: List[str]) -> None:
"""
Prints an error message to STDERR for fatal issues. The first line is
Prints an error message to `STDERR` for fatal issues. The first line is
prepended with 'jc: Error - ' and subsequent lines are indented.
Wraps text as needed based on the terminal width.
@ -114,7 +114,7 @@ def is_compatible(compatible: List) -> bool:
def compatibility(mod_name: str, compatible: List, quiet: bool = False) -> None:
"""
Checks for the parser's compatibility with the running OS platform and
prints a warning message to STDERR if not compatible and quiet=False.
prints a warning message to `STDERR` if not compatible and quiet=False.
Parameters:

View File

@ -211,11 +211,11 @@ color output will override both the `NO_COLOR` environment variable and the `-m`
option.
### Streaming Parsers
Most parsers load all of the data from STDIN, parse it, then output the entire
Most parsers load all of the data from `STDIN`, parse it, then output the entire
JSON document serially. There are some streaming parsers (e.g. `ls-s` and
`ping-s`) that immediately start processing and outputing the data line-by-line
as [JSON Lines](https://jsonlines.org/) (aka [NDJSON](http://ndjson.org/)) while
it is being received from STDIN. This can significantly reduce the amount of
it is being received from `STDIN`. This can significantly reduce the amount of
memory required to parse large amounts of command output (e.g. `ls -lR /`) and
can sometimes process the data more quickly. Streaming parsers have slightly
different behavior than standard parsers as outlined below.