mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-13 01:20:24 +02:00
add line buffer output option
This commit is contained in:
@ -4,7 +4,9 @@ jc changelog
|
|||||||
- Note to Package Maintainers: please see note at 20210720 v1.16.0
|
- Note to Package Maintainers: please see note at 20210720 v1.16.0
|
||||||
- Add generic ASCII tables parser
|
- Add generic ASCII tables parser
|
||||||
- Add support for streaming parsers
|
- Add support for streaming parsers
|
||||||
|
- Add -l option to allow line buffered output
|
||||||
- Add ls command streaming parser tested on linux, macOS, and freeBSD
|
- Add ls command streaming parser tested on linux, macOS, and freeBSD
|
||||||
|
- Add ping command streaming parser tested on linux, macOS, and freeBSD
|
||||||
|
|
||||||
20210830 v1.16.2
|
20210830 v1.16.2
|
||||||
- Note to Package Maintainers: please see note at 20210720 v1.16.0
|
- Note to Package Maintainers: please see note at 20210720 v1.16.0
|
||||||
|
@ -150,6 +150,7 @@ The JSON output can be compact (default) or pretty formatted with the `-p` optio
|
|||||||
- `--ntpq` enables the `ntpq -p` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/ntpq))
|
- `--ntpq` enables the `ntpq -p` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/ntpq))
|
||||||
- `--passwd` enables the `/etc/passwd` file parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/passwd))
|
- `--passwd` enables the `/etc/passwd` file parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/passwd))
|
||||||
- `--ping` enables the `ping` and `ping6` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/ping))
|
- `--ping` enables the `ping` and `ping6` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/ping))
|
||||||
|
- `--ping-s` enables the `ping` and `ping6` command streaming parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/ping_s))
|
||||||
- `--pip-list` enables the `pip list` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/pip_list))
|
- `--pip-list` enables the `pip list` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/pip_list))
|
||||||
- `--pip-show` enables the `pip show` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/pip_show))
|
- `--pip-show` enables the `pip show` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/pip_show))
|
||||||
- `--ps` enables the `ps` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/ps))
|
- `--ps` enables the `ps` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/ps))
|
||||||
@ -183,7 +184,8 @@ The JSON output can be compact (default) or pretty formatted with the `-p` optio
|
|||||||
### Options
|
### Options
|
||||||
- `-a` about `jc`. Prints information about `jc` and the parsers (in JSON, of course!)
|
- `-a` about `jc`. Prints information about `jc` and the parsers (in JSON, of course!)
|
||||||
- `-d` debug mode. Prints trace messages if parsing issues are encountered (use `-dd` for verbose debugging)
|
- `-d` debug mode. Prints trace messages if parsing issues are encountered (use `-dd` for verbose debugging)
|
||||||
- `-h` `jc` help. Use `jc -h --parser_name` for parser documentation
|
- `-h` help. Use `jc -h --parser_name` for parser documentation
|
||||||
|
- `-l` line buffer output
|
||||||
- `-m` monochrome JSON output
|
- `-m` monochrome JSON output
|
||||||
- `-p` pretty format the JSON output
|
- `-p` pretty format the JSON output
|
||||||
- `-q` quiet mode. Suppresses parser warning messages
|
- `-q` quiet mode. Suppresses parser warning messages
|
||||||
|
@ -331,6 +331,7 @@ def helptext():
|
|||||||
-a about jc
|
-a about jc
|
||||||
-d debug (-dd for verbose debug)
|
-d debug (-dd for verbose debug)
|
||||||
-h help (-h --parser_name for parser documentation)
|
-h help (-h --parser_name for parser documentation)
|
||||||
|
-l line buffer output
|
||||||
-m monochrome output
|
-m monochrome output
|
||||||
-p pretty print output
|
-p pretty print output
|
||||||
-q quiet - suppress parser warnings
|
-q quiet - suppress parser warnings
|
||||||
@ -521,6 +522,7 @@ def main():
|
|||||||
about = 'a' in options
|
about = 'a' in options
|
||||||
debug = 'd' in options
|
debug = 'd' in options
|
||||||
verbose_debug = True if options.count('d') > 1 else False
|
verbose_debug = True if options.count('d') > 1 else False
|
||||||
|
linebuf = 'l' in options
|
||||||
mono = 'm' in options
|
mono = 'm' in options
|
||||||
help_me = 'h' in options
|
help_me = 'h' in options
|
||||||
pretty = 'p' in options
|
pretty = 'p' in options
|
||||||
@ -626,7 +628,7 @@ def main():
|
|||||||
env_colors=jc_colors,
|
env_colors=jc_colors,
|
||||||
mono=mono,
|
mono=mono,
|
||||||
piped_out=piped_output()),
|
piped_out=piped_output()),
|
||||||
flush=True) # unbuffers between piped commands
|
flush=linebuf)
|
||||||
|
|
||||||
sys.exit(combined_exit_code(magic_exit_code, 0))
|
sys.exit(combined_exit_code(magic_exit_code, 0))
|
||||||
|
|
||||||
@ -638,7 +640,8 @@ def main():
|
|||||||
pretty=pretty,
|
pretty=pretty,
|
||||||
env_colors=jc_colors,
|
env_colors=jc_colors,
|
||||||
mono=mono,
|
mono=mono,
|
||||||
piped_out=piped_output()))
|
piped_out=piped_output()),
|
||||||
|
flush=linebuf)
|
||||||
|
|
||||||
sys.exit(combined_exit_code(magic_exit_code, 0))
|
sys.exit(combined_exit_code(magic_exit_code, 0))
|
||||||
|
|
||||||
|
11
man/jc.1
11
man/jc.1
@ -1,4 +1,4 @@
|
|||||||
.TH jc 1 2021-09-10 1.17.0 "JSON CLI output utility"
|
.TH jc 1 2021-09-13 1.17.0 "JSON CLI output utility"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
jc \- JSONifies the output of many CLI tools and file-types
|
jc \- JSONifies the output of many CLI tools and file-types
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@ -247,6 +247,11 @@ Key/Value file parser
|
|||||||
\fB--ping\fP
|
\fB--ping\fP
|
||||||
`ping` and `ping6` command parser
|
`ping` and `ping6` command parser
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B
|
||||||
|
\fB--ping-s\fP
|
||||||
|
`ping` and `ping6` command streaming parser
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB--pip-list\fP
|
\fB--pip-list\fP
|
||||||
@ -413,6 +418,10 @@ debug - show traceback (\fB-dd\fP for verbose traceback)
|
|||||||
help (\fB-h --parser_name\fP for parser documentation)
|
help (\fB-h --parser_name\fP for parser documentation)
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
|
\fB-l\fP
|
||||||
|
line buffer output
|
||||||
|
.TP
|
||||||
|
.B
|
||||||
\fB-m\fP
|
\fB-m\fP
|
||||||
monochrome output
|
monochrome output
|
||||||
.TP
|
.TP
|
||||||
|
@ -43,6 +43,10 @@ debug - show traceback (\fB-dd\fP for verbose traceback)
|
|||||||
help (\fB-h --parser_name\fP for parser documentation)
|
help (\fB-h --parser_name\fP for parser documentation)
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
|
\fB-l\fP
|
||||||
|
line buffer output
|
||||||
|
.TP
|
||||||
|
.B
|
||||||
\fB-m\fP
|
\fB-m\fP
|
||||||
monochrome output
|
monochrome output
|
||||||
.TP
|
.TP
|
||||||
|
@ -109,7 +109,8 @@ The JSON output can be compact (default) or pretty formatted with the `-p` optio
|
|||||||
### Options
|
### Options
|
||||||
- `-a` about `jc`. Prints information about `jc` and the parsers (in JSON, of course!)
|
- `-a` about `jc`. Prints information about `jc` and the parsers (in JSON, of course!)
|
||||||
- `-d` debug mode. Prints trace messages if parsing issues are encountered (use `-dd` for verbose debugging)
|
- `-d` debug mode. Prints trace messages if parsing issues are encountered (use `-dd` for verbose debugging)
|
||||||
- `-h` `jc` help. Use `jc -h --parser_name` for parser documentation
|
- `-h` help. Use `jc -h --parser_name` for parser documentation
|
||||||
|
- `-l` line buffer output
|
||||||
- `-m` monochrome JSON output
|
- `-m` monochrome JSON output
|
||||||
- `-p` pretty format the JSON output
|
- `-p` pretty format the JSON output
|
||||||
- `-q` quiet mode. Suppresses parser warning messages
|
- `-q` quiet mode. Suppresses parser warning messages
|
||||||
|
Reference in New Issue
Block a user