From 8568d0d328706a7a5b1476452e078d8cbe7b7391 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Mon, 22 Nov 2021 09:10:11 -0800 Subject: [PATCH 1/6] fix csv_s documentation --- docs/parsers/csv_s.md | 4 +++- jc/parsers/csv_s.py | 4 +++- man/jc.1 | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/parsers/csv_s.md b/docs/parsers/csv_s.md index 983563b5..46147796 100644 --- a/docs/parsers/csv_s.md +++ b/docs/parsers/csv_s.md @@ -16,7 +16,9 @@ Usage (cli): Usage (module): import jc.parsers.csv_s - result = jc.parsers.csv_s.parse(csv_output) + result = jc.parsers.csv_s.parse(csv_output.splitlines()) # result is an iterable object + for item in result: + # do something Schema: diff --git a/jc/parsers/csv_s.py b/jc/parsers/csv_s.py index acde6825..1ea5b6e4 100644 --- a/jc/parsers/csv_s.py +++ b/jc/parsers/csv_s.py @@ -13,7 +13,9 @@ Usage (cli): Usage (module): import jc.parsers.csv_s - result = jc.parsers.csv_s.parse(csv_output) + result = jc.parsers.csv_s.parse(csv_output.splitlines()) # result is an iterable object + for item in result: + # do something Schema: diff --git a/man/jc.1 b/man/jc.1 index 15b35aa7..c79b11c0 100644 --- a/man/jc.1 +++ b/man/jc.1 @@ -1,4 +1,4 @@ -.TH jc 1 2021-11-18 1.17.2 "JSON CLI output utility" +.TH jc 1 2021-11-22 1.17.2 "JSON CLI output utility" .SH NAME jc \- JSONifies the output of many CLI tools and file-types .SH SYNOPSIS From 077a29fb4eedcfccb026498c5c3a64b7b7601363 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Mon, 22 Nov 2021 09:36:58 -0800 Subject: [PATCH 2/6] add _jc_meta field info --- docs/parsers/csv_s.md | 8 +++++++- jc/parsers/csv_s.py | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/parsers/csv_s.md b/docs/parsers/csv_s.md index 46147796..8cb2c33c 100644 --- a/docs/parsers/csv_s.md +++ b/docs/parsers/csv_s.md @@ -26,7 +26,13 @@ Schema: { "column_name1": string, - "column_name2": string + "column_name2": string, + "_jc_meta": # This object only exists if using -qq or ignore_exceptions=True + { + "success": booean, # true if successfully parsed, false if error + "error": string, # exists if "success" is false + "line": string # exists if "success" is false + } } Examples: diff --git a/jc/parsers/csv_s.py b/jc/parsers/csv_s.py index 1ea5b6e4..7bd97b47 100644 --- a/jc/parsers/csv_s.py +++ b/jc/parsers/csv_s.py @@ -23,7 +23,13 @@ Schema: { "column_name1": string, - "column_name2": string + "column_name2": string, + "_jc_meta": # This object only exists if using -qq or ignore_exceptions=True + { + "success": booean, # true if successfully parsed, false if error + "error": string, # exists if "success" is false + "line": string # exists if "success" is false + } } Examples: From fc0ce6c95923ab124961e695a26c0b68dd0f359f Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Mon, 22 Nov 2021 09:45:14 -0800 Subject: [PATCH 3/6] add streaming parser to custom parsers info --- README.md | 2 +- templates/readme_template | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2547657a..501ccab9 100644 --- a/README.md +++ b/README.md @@ -292,7 +292,7 @@ Custom local parser plugins may be placed in a `jc/jcparsers` folder in your loc - macOS: `$HOME/Library/Application Support/jc/jcparsers` - Windows: `$LOCALAPPDATA\jc\jc\jcparsers` -Local parser plugins are standard python module files. Use the [`jc/parsers/foo.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/foo.py) parser as a template and simply place a `.py` file in the `jcparsers` subfolder. +Local parser plugins are standard python module files. Use the [`jc/parsers/foo.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/foo.py) or [`jc/parsers/foo_s.py (streaming)`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/foo_s.py) parser as a template and simply place a `.py` file in the `jcparsers` subfolder. Local plugin filenames must be valid python module names, therefore must consist entirely of alphanumerics and start with a letter. Local plugins may override default parsers. diff --git a/templates/readme_template b/templates/readme_template index 608b83b0..ea81e823 100644 --- a/templates/readme_template +++ b/templates/readme_template @@ -213,7 +213,7 @@ Custom local parser plugins may be placed in a `jc/jcparsers` folder in your loc - macOS: `$HOME/Library/Application Support/jc/jcparsers` - Windows: `$LOCALAPPDATA\jc\jc\jcparsers` -Local parser plugins are standard python module files. Use the [`jc/parsers/foo.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/foo.py) parser as a template and simply place a `.py` file in the `jcparsers` subfolder. +Local parser plugins are standard python module files. Use the [`jc/parsers/foo.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/foo.py) or [`jc/parsers/foo_s.py (streaming)`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/foo_s.py) parser as a template and simply place a `.py` file in the `jcparsers` subfolder. Local plugin filenames must be valid python module names, therefore must consist entirely of alphanumerics and start with a letter. Local plugins may override default parsers. From 47eb83ae55b9892716fff712bd2be21b6191b552 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Wed, 24 Nov 2021 13:32:51 -0800 Subject: [PATCH 4/6] add .vscode --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 1ae9b0e0..3aeb53dd 100755 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ dist/ build/ *.egg-info/ .github/ +.vscode/ From 603964935b58e02cf0614cf67ffacc6d94755e05 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Wed, 24 Nov 2021 19:30:10 -0800 Subject: [PATCH 5/6] remove trailing whitespace --- CHANGELOG | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 4ec0e106..95a77c3d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -36,7 +36,7 @@ jc changelog 20210720 v1.16.0 - Note to Package Maintainers: TL;DR: `/man/jc.1.gz` and `/jc/man/jc.1.gz` are deprecated and only `/man/jc.1` should be used. - + The Man page in the PyPi source packages will be moving from `/jc/man/jc.1.gz` to `/man/jc.1` in version 1.17.0. For now the Man pages will be available in both locations, but be aware that the Man page at `/jc/man/jc.1.gz` is now considered deprecated. @@ -51,7 +51,7 @@ jc changelog - Binaries and DEB/RPM/MSI packages now include Python 3.9.5 interpreter 20210628 v1.15.6 -- Fix issue to only load local plugin parsers that have filenames that end in .py +- Fix issue to only load local plugin parsers that have filenames that end in .py 20210520 v1.15.5 - Fix issue where help and about information would not display if a 3rd party parser library was missing. (e.g. xmltodict) From 21e69a7cbf62240238f6fb78e874dda6ce2e922a Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Wed, 24 Nov 2021 19:33:07 -0800 Subject: [PATCH 6/6] ignore _config.yml --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 3aeb53dd..3732a1e5 100755 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ build/ *.egg-info/ .github/ .vscode/ +_config.yml