mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-13 01:20:24 +02:00
Merge branch 'dev' of https://github.com/kellyjonbrazil/jc into dev
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,3 +4,5 @@ dist/
|
|||||||
build/
|
build/
|
||||||
*.egg-info/
|
*.egg-info/
|
||||||
.github/
|
.github/
|
||||||
|
.vscode/
|
||||||
|
_config.yml
|
||||||
|
@ -294,7 +294,7 @@ Custom local parser plugins may be placed in a `jc/jcparsers` folder in your loc
|
|||||||
- macOS: `$HOME/Library/Application Support/jc/jcparsers`
|
- macOS: `$HOME/Library/Application Support/jc/jcparsers`
|
||||||
- Windows: `$LOCALAPPDATA\jc\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.
|
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.
|
||||||
|
|
||||||
|
@ -16,7 +16,9 @@ Usage (cli):
|
|||||||
Usage (module):
|
Usage (module):
|
||||||
|
|
||||||
import jc.parsers.csv_s
|
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:
|
Schema:
|
||||||
|
|
||||||
@ -24,7 +26,13 @@ Schema:
|
|||||||
|
|
||||||
{
|
{
|
||||||
"column_name1": string,
|
"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:
|
Examples:
|
||||||
|
@ -13,7 +13,9 @@ Usage (cli):
|
|||||||
Usage (module):
|
Usage (module):
|
||||||
|
|
||||||
import jc.parsers.csv_s
|
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:
|
Schema:
|
||||||
|
|
||||||
@ -21,7 +23,13 @@ Schema:
|
|||||||
|
|
||||||
{
|
{
|
||||||
"column_name1": string,
|
"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:
|
Examples:
|
||||||
|
@ -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`
|
- macOS: `$HOME/Library/Application Support/jc/jcparsers`
|
||||||
- Windows: `$LOCALAPPDATA\jc\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.
|
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.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user