1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2026-04-03 17:44:07 +02:00

Compare commits

...

116 Commits

Author SHA1 Message Date
Kelly Brazil
70cb4453be Merge pull request #195 from kellyjonbrazil/dev
Dev v1.17.7
2022-01-14 11:54:29 -08:00
Kelly Brazil
830674cc6f version bump 2022-01-14 11:47:25 -08:00
Kelly Brazil
fb406b58a1 formatting 2022-01-08 20:22:53 -08:00
Kelly Brazil
55b272e412 tighten stat data detection 2022-01-06 11:13:14 -08:00
Kelly Brazil
94f62a9bf3 formatting 2022-01-06 11:03:49 -08:00
Kelly Brazil
8d19e4cb7b doc update 2022-01-06 11:00:53 -08:00
Kelly Brazil
7e510d48e0 simplify non-stat parse error logic 2022-01-06 10:36:33 -08:00
Kelly Brazil
7b20cffb14 simplify last item logic 2022-01-05 11:44:00 -08:00
Kelly Brazil
5c934c43c1 add continue to simplify logic 2022-01-05 11:39:00 -08:00
Kelly Brazil
8609298449 update docstring 2022-01-05 11:25:58 -08:00
Kelly Brazil
72cb0dc10b fixup for first and last items 2022-01-05 11:22:01 -08:00
Kelly Brazil
7b22fa81de raise for non-stat data 2022-01-05 07:46:58 -08:00
Kelly Brazil
0b6a130779 ignore blank lines 2022-01-04 16:43:38 -08:00
Kelly Brazil
fdcf4338e0 add examples to docstring 2022-01-04 15:31:00 -08:00
Kelly Brazil
ee43037f48 remove unused continue lines 2022-01-04 15:13:42 -08:00
Kelly Brazil
26e365563c add schema and _process logic 2022-01-04 15:07:45 -08:00
Kelly Brazil
1b39586bb1 add stat streaming parser 2022-01-04 15:01:42 -08:00
Kelly Brazil
8bb3a6bea3 Merge pull request #194 from kellyjonbrazil/master
sync to dev
2022-01-04 13:33:35 -08:00
Kelly Brazil
e6900e2000 add jar-manifest 2022-01-03 09:41:16 -08:00
Kelly Brazil
0ee244756b spelling 2022-01-03 09:22:35 -08:00
Kelly Brazil
6d5ac9abe6 update docs 2022-01-03 09:19:40 -08:00
Kelly Brazil
44f6d9e132 changelog update 2022-01-03 09:18:43 -08:00
Kelly Brazil
360154559c Merge pull request #193 from kellyjonbrazil/dev
Dev add csv doublequote fix
2022-01-03 09:12:50 -08:00
Kelly Brazil
78672bd7ad Merge pull request #190 from shaikustin/csv-doubleqouted
fix doubleqoute in csv
2022-01-03 09:08:57 -08:00
Kelly Brazil
65d96e26b5 add streaming tests 2022-01-03 09:06:00 -08:00
Kelly Brazil
241d53af9a Merge pull request #192 from kellyjonbrazil/dev
Dev v1.17.6
2022-01-03 08:49:15 -08:00
Kelly Brazil
5563829df2 make dialect sniff behavior match non-streaming parser 2022-01-03 08:48:23 -08:00
Kelly Brazil
3a4a27e1f9 version bump 2022-01-02 11:44:25 -08:00
Kelly Brazil
9c887a36a8 update csv_s parser with csv changes 2022-01-02 11:44:18 -08:00
Kelly Brazil
bc7973af36 update copyright 2022-01-02 11:07:15 -08:00
Kelly Brazil
32972d8fdb doc update 2022-01-02 11:00:52 -08:00
Kelly Brazil
b128d9109c add MANIFEST.MF tests 2022-01-02 10:51:02 -08:00
Kelly Brazil
929d7273a4 doc updates 2022-01-02 10:29:56 -08:00
shaik
2a40f84274 fix doubleqoute in csv 2022-01-02 17:30:25 +02:00
Kelly Brazil
9ff6fa818f add jar-manifest 2022-01-01 10:08:40 -08:00
Kelly Brazil
dac73a4bfe Merge pull request #189 from kellyjonbrazil/master
use github releases instead of packaging site
2022-01-01 10:06:46 -08:00
Kelly Brazil
d7895547f7 Merge pull request #188 from listuser/new_branch
Create key value pairs from a MANIFEST.MF file, to include key multiline value pairs.
2022-01-01 10:04:47 -08:00
listuser
b7d439cb87 Renamed jar-manifest.py to jar_manifest.py, added multi manifest outputs to tests... 2021-12-31 12:15:50 -08:00
listuser
7cc903a5f5 Removed inflating from examples in jar-manifest.py 2021-12-30 15:10:53 -08:00
listuser
c495a8291b Updated test output in MANIFEST.MF.json 2021-12-30 15:06:06 -08:00
listuser
5e1d7d777c Renamed metamf.py to jar-manifest.py, plus other changes 2021-12-30 15:02:48 -08:00
listuser
7edad3f676 Create key value pairs from a MANIFEST.MF file, to include key multiline value pairs. 2021-12-29 12:15:15 -08:00
Kelly Brazil
f7331001d4 use github releases instead of packaging site 2021-12-23 11:35:39 -08:00
Kelly Brazil
f8e09ae2ff Merge pull request #187 from kellyjonbrazil/master
sync to dev
2021-12-21 15:46:39 -06:00
Kelly Brazil
433c7cc0f0 formatting 2021-12-21 13:42:24 -08:00
Kelly Brazil
d753e71a74 Merge pull request #186 from kellyjonbrazil/dev
Dev v1.17.5
2021-12-21 15:21:18 -06:00
Kelly Brazil
2e4f5a508b version bump 2021-12-21 12:19:17 -08:00
Kelly Brazil
88b960eff6 doc update 2021-12-21 12:14:20 -08:00
Kelly Brazil
88c77bd89e add zipinfo tests 2021-12-21 12:08:16 -08:00
Kelly Brazil
51a7a4251f add multi-archive test output 2021-12-21 11:11:56 -08:00
Kelly Brazil
51d2f316f3 add multi-archive support 2021-12-21 11:11:44 -08:00
Kelly Brazil
ff78a46c48 add zipinfo parser 2021-12-21 08:13:17 -08:00
Kelly Brazil
ed4a9dc1d4 formatting 2021-12-21 08:13:00 -08:00
Kelly Brazil
63182dba26 Merge pull request #185 from listuser/new_branch
contributed zipinfo parser
2021-12-21 10:08:46 -06:00
Matt J
9c1eaa9389 revised zipinfo.py nested version 2021-12-20 21:53:34 -08:00
Matt J
bc520fcbcd added zipinfo.py nested version 2021-12-20 14:29:50 -08:00
Matt J
46faac1a12 add test data zipinfo.json and zipinfo.out 2021-12-19 18:08:11 -08:00
Matt J
3c424c0cb3 initial commit zipinfo.py to new_branch 2021-12-19 14:05:48 -08:00
Kelly Brazil
3ac8d0362b use quotes around python versions 2021-12-16 07:04:35 -08:00
Kelly Brazil
d88b998e6c formatting 2021-12-09 10:58:06 -08:00
Kelly Brazil
a9ed55c006 fix spelling 2021-12-09 10:54:04 -08:00
Kelly Brazil
ea61434123 fix schema docs 2021-12-09 10:21:37 -08:00
Kelly Brazil
a73d0d26cb Merge pull request #184 from kellyjonbrazil/dev
Dev 1.17.4
2021-12-08 20:49:01 -08:00
Kelly Brazil
b4506976e3 formatting 2021-12-08 11:21:12 -08:00
Kelly Brazil
34cb75a096 version bump 2021-12-08 08:46:00 -08:00
Kelly Brazil
34df643f60 add disable colors section 2021-12-08 08:35:09 -08:00
Kelly Brazil
ac7c13fcc0 add -C option to docs 2021-12-08 08:22:28 -08:00
Kelly Brazil
4fdb34c7d5 add no-color.org 2021-12-08 08:19:43 -08:00
Kelly Brazil
7ac468e35a changelog update 2021-12-08 08:14:36 -08:00
Kelly Brazil
df190aa299 add -C option to force color even with pipes 2021-12-08 08:14:28 -08:00
Kelly Brazil
9621475e86 changelog update 2021-12-07 15:46:02 -08:00
Kelly Brazil
82e0160de8 refactor NO_COLOR test 2021-12-07 15:45:11 -08:00
Kelly Brazil
d03fb8b626 Merge branch 'dev' of https://github.com/kellyjonbrazil/jc into dev 2021-12-07 15:34:23 -08:00
Kelly Brazil
b300dfb3d7 Add support for NO_COLOR env variable 2021-12-07 15:34:20 -08:00
Kelly Brazil
a7de9111d9 Merge pull request #183 from kellyjonbrazil/dev
Dev v1.17.3
2021-12-02 16:37:46 -08:00
Kelly Brazil
7933dfdbe7 Merge branch 'master' into dev 2021-12-02 16:34:06 -08:00
Kelly Brazil
f7cb5f7d01 update date 2021-12-02 16:30:47 -08:00
Kelly Brazil
a26a298f1a doc update 2021-12-02 11:42:56 -08:00
Kelly Brazil
dbd134d0da add examples to docs 2021-12-02 11:40:47 -08:00
Kelly Brazil
11aa01b0d9 iostat-s tests 2021-12-02 11:38:00 -08:00
Kelly Brazil
6f18e53443 fix for null lines 2021-12-02 11:37:52 -08:00
Kelly Brazil
7b467c4665 add ubuntu 20.10 tests 2021-12-02 09:30:16 -08:00
Kelly Brazil
537b8f2630 add more int conversions 2021-12-02 09:14:43 -08:00
Kelly Brazil
4d823575e7 add more float fields 2021-12-02 08:47:25 -08:00
Kelly Brazil
541aa1d09f Add new field float conversions for iostat v11 2021-12-02 08:41:36 -08:00
Kelly Brazil
8f02021014 formatting 2021-12-02 05:54:38 -08:00
Kelly Brazil
158a15157c changelog update 2021-12-01 16:47:17 -08:00
Kelly Brazil
2752e0d66a add iostat streaming parser 2021-12-01 16:47:09 -08:00
Kelly Brazil
6c11e912af update changelog 2021-12-01 16:14:22 -08:00
Kelly Brazil
43d34461e2 update docs 2021-12-01 16:12:51 -08:00
Kelly Brazil
4dfdc9b0f6 Merge branch 'dev' of https://github.com/kellyjonbrazil/jc into dev 2021-12-01 16:02:10 -08:00
Kelly Brazil
e2311cbb03 add iostat tests 2021-12-01 16:02:06 -08:00
Kelly Brazil
bf15575e90 fixes for ubunut 2021-12-01 16:01:52 -08:00
Kelly Brazil
406336c718 add iostat example 2021-12-01 13:53:31 -08:00
Kelly Brazil
6665ffaeb8 remove python 3.6 from tests 2021-12-01 10:59:07 -08:00
Kelly Brazil
dcf552ca0c add _process and cleanup 2021-12-01 10:34:55 -08:00
Kelly Brazil
7a6ebf3c95 add iostat parser 2021-11-30 16:54:32 -08:00
Kelly Brazil
d2dc4a983c changelog update 2021-11-30 11:59:26 -08:00
Kelly Brazil
1168259bc2 add doc strings 2021-11-30 11:57:04 -08:00
Kelly Brazil
e8e4b46021 use jc.utils type checks 2021-11-30 11:49:40 -08:00
Kelly Brazil
12d2de2282 use jc.utils.input_type_check() and simplify compatibility check 2021-11-30 11:43:06 -08:00
Kelly Brazil
0e2fe401e1 version bump 2021-11-30 10:08:27 -08:00
Kelly Brazil
14247adb0a add input type checks 2021-11-30 10:03:59 -08:00
Kelly Brazil
3a9f0934c4 add input type checks 2021-11-30 09:56:33 -08:00
Kelly Brazil
caf0a5c871 add input type checking 2021-11-30 09:51:27 -08:00
Kelly Brazil
cfb58b1cf3 add input type checks 2021-11-30 09:41:16 -08:00
Kelly Brazil
975cf195cc formatting 2021-11-30 09:40:49 -08:00
Kelly Brazil
8a46a259a3 add input type checks 2021-11-30 09:19:51 -08:00
Kelly Brazil
e395142e59 version bump 2021-11-29 16:45:22 -08:00
Kelly Brazil
caaeaf0d67 add 'str' type check on input 2021-11-29 16:29:23 -08:00
Kelly Brazil
21e69a7cbf ignore _config.yml 2021-11-24 19:33:07 -08:00
Kelly Brazil
603964935b remove trailing whitespace 2021-11-24 19:30:10 -08:00
Kelly Brazil
47eb83ae55 add .vscode 2021-11-24 13:32:51 -08:00
Kelly Brazil
fc0ce6c959 add streaming parser to custom parsers info 2021-11-22 09:45:14 -08:00
Kelly Brazil
077a29fb4e add _jc_meta field info 2021-11-22 09:36:58 -08:00
Kelly Brazil
8568d0d328 fix csv_s documentation 2021-11-22 09:10:11 -08:00
251 changed files with 7221 additions and 388 deletions

View File

@@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: [3.6, 3.7, 3.8, 3.9, 3.10.0]
python-version: ["3.7", "3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v2

2
.gitignore vendored
View File

@@ -4,3 +4,5 @@ dist/
build/
*.egg-info/
.github/
.vscode/
_config.yml

View File

@@ -1,5 +1,26 @@
jc changelog
20220106 v1.17.7
- Add stat command streaming parser tested on linux and macOS
20220103 v1.17.6
- Add jar-manifest file parser (for MANIFEST.MF files)
- Fix CSV parsers for some files that include doublequotes
20211221 v1.17.5
- Add zipinfo parser tested on linux and macOS
20211207 v1.17.4
- Add support for the NO_COLOR environment variable to set mono (http://no-color.org/)
- Add -C option to force color output even when using pipes (overrides -m and NO_COLOR)
20211202 v1.17.3
- Update parsers to exit with error if non-string input is detected (raise TypeError)
- Update streaming parsers to exit with error if non-iterable input is detected (raise TypeError)
- Simplify quiet-checking in parsers
- Add iostat parser tested on linux
- Add iostat streaming parser tested on linux
20211117 v1.17.2
- Fix ping parser to add Alpine linux support
- Fix netstat parser for older versions of netstat on linux
@@ -36,7 +57,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 +72,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)

View File

@@ -1516,6 +1516,50 @@ cat example.ini | jc --ini -p
}
}
```
### iostat
```bash
$ iostat | jc --iostat -p # or: jc -p iostat
```
```json
[
{
"percent_user": 0.15,
"percent_nice": 0.0,
"percent_system": 0.18,
"percent_iowait": 0.0,
"percent_steal": 0.0,
"percent_idle": 99.67,
"type": "cpu"
},
{
"device": "sda",
"tps": 0.29,
"kb_read_s": 7.22,
"kb_wrtn_s": 1.25,
"kb_read": 194341,
"kb_wrtn": 33590,
"type": "device"
},
{
"device": "dm-0",
"tps": 0.29,
"kb_read_s": 5.99,
"kb_wrtn_s": 1.17,
"kb_read": 161361,
"kb_wrtn": 31522,
"type": "device"
},
{
"device": "dm-1",
"tps": 0.0,
"kb_read_s": 0.08,
"kb_wrtn_s": 0.0,
"kb_read": 2204,
"kb_wrtn": 0,
"type": "device"
}
]
```
### iptables
```bash
iptables --line-numbers -v -L -t nat | jc --iptables -p # or: jc -p iptables --line-numbers -v -L -t nat
@@ -1669,6 +1713,27 @@ iw dev wlan0 scan | jc --iw-scan -p # or: jc -p iw dev wlan0 scan
}
]
```
### jar-manifest
```bash
cat MANIFEST.MF | jc --jar-manifest -p
```
```json
[
{
"Import_Package": "com.conversantmedia.util.concurrent;resolution:=optional,com.fasterxml.jackson.annotation;version=\"[2.12,3)\";resolution:=optional,com.fasterxml.jackson.core;version=\"[2.12,3)\";resolution:=optional,com.fasterxml.jackson.core.type;version=\"[2.12,3)\";resolution:=optional,com.fasterxml.jackson.cor...",
"Export_Package": "org.apache.logging.log4j.core;uses:=\"org.apache.logging.log4j,org.apache.logging.log4j.core.config,org.apache.logging.log4j.core.impl,org.apache.logging.log4j.core.layout,org.apache.logging.log4j.core.time,org.apache.logging.log4j.message,org.apache.logging.log4j.spi,org.apache.logging.log4j.status...",
"Manifest_Version": "1.0",
"Bundle_License": "https://www.apache.org/licenses/LICENSE-2.0.txt",
"Bundle_SymbolicName": "org.apache.logging.log4j.core",
"Built_By": "matt",
"Bnd_LastModified": "1639373735804",
"Implementation_Vendor_Id": "org.apache.logging.log4j",
"Specification_Title": "Apache Log4j Core",
"Log4jReleaseManager": "Matt Sicker",
...
}
]
```
### jobs
```bash
jobs -l | jc --jobs -p
@@ -3749,5 +3814,36 @@ cat istio.yaml | jc --yaml -p
}
]
```
### zipinfo
```bash
zipinfo file.zip | jc --zipinfo -p # or: jc -p zipinfo file.zip
```
```json
[
{
"archive": "file.zip",
"size": 4116,
"size_unit": "bytes",
"number_entries": 1,
"number_files": 1,
"bytes_uncompressed": 11837,
"bytes_compressed": 3966,
"percent_compressed": 66.5,
"files": [
{
"flags": "-rw-r--r--",
"zipversion": "2.1",
"zipunder": "unx",
"filesize": 11837,
"type": "bX",
"method": "defN",
"date": "21-Dec-08",
"time": "20:50",
"filename": "compressed_file"
}
]
}
]
```
© 2019-2021 Kelly Brazil

View File

@@ -91,7 +91,10 @@ pip3 install jc
| FreeBSD | `portsnap fetch update && cd /usr/ports/textproc/py-jc && make install clean` |
| Ansible filter plugin | `ansible-galaxy collection install community.general` |
> For more packages and binaries, see the [jc packaging](https://kellyjonbrazil.github.io/jc-packaging/) site.
> For more OS Packages, see https://repology.org/project/jc/versions.
### Binaries and Packages
For precompiled binaries and packages, see [Releases](https://github.com/kellyjonbrazil/jc/releases) on Github.
## Usage
`jc` accepts piped input from `STDIN` and outputs a JSON representation of the previous command's output to `STDOUT`.
@@ -138,8 +141,11 @@ The JSON output can be compact (default) or pretty formatted with the `-p` optio
- `--id` enables the `id` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/id))
- `--ifconfig` enables the `ifconfig` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/ifconfig))
- `--ini` enables the INI file parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/ini))
- `--iostat` enables the `iostat` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/iostat))
- `--iostat-s` enables the `iostat` command streaming parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/iostat_s))
- `--iptables` enables the `iptables` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/iptables))
- `--iw-scan` enables the `iw dev [device] scan` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/iw_scan))
- `--jar-manifest` enables the MANIFEST.MF file parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/jar_manifest))
- `--jobs` enables the `jobs` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/jobs))
- `--kv` enables the Key/Value file parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/kv))
- `--last` enables the `last` and `lastb` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/last))
@@ -164,6 +170,7 @@ The JSON output can be compact (default) or pretty formatted with the `-p` optio
- `--shadow` enables the `/etc/shadow` file parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/shadow))
- `--ss` enables the `ss` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/ss))
- `--stat` enables the `stat` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/stat))
- `--stat-s` enables the `stat` command streaming parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/stat_s))
- `--sysctl` enables the `sysctl` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/sysctl))
- `--systemctl` enables the `systemctl` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/systemctl))
- `--systemctl-lj` enables the `systemctl list-jobs` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/systemctl_lj))
@@ -186,9 +193,11 @@ The JSON output can be compact (default) or pretty formatted with the `-p` optio
- `--who` enables the `who` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/who))
- `--xml` enables the XML file parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/xml))
- `--yaml` enables the YAML file parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/yaml))
- `--zipinfo` enables the `zipinfo` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/zipinfo))
### Options
- `-a` about `jc`. Prints information about `jc` and the parsers (in JSON, of course!)
- `-C` force color output even when using pipes (overrides `-m` and the `NO_COLOR` env variable)
- `-d` debug mode. Prints trace messages if parsing issues are encountered (use `-dd` for verbose debugging)
- `-h` help. Use `jc -h --parser_name` for parser documentation
- `-m` monochrome JSON output
@@ -227,6 +236,9 @@ or
JC_COLORS=default,default,default,default
```
### Disable Colors via Environment Variable
You can set the [`NO_COLOR`](http://no-color.org/) environment variable to any value to disable color output in `jc`. Note that using the `-C` option to force 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 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 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.
@@ -292,7 +304,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.
@@ -999,4 +1011,4 @@ cat istio.yaml | jc --yaml -p
]
```
© 2019-2021 Kelly Brazil
© 2019-2022 Kelly Brazil

View File

@@ -252,4 +252,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -105,4 +105,4 @@ Returns:
## Parser Information
Compatibility: darwin
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -133,4 +133,4 @@ Returns:
## Parser Information
Compatibility: darwin
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -142,4 +142,4 @@ Returns:
## Parser Information
Compatibility: linux, aix, freebsd, darwin
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -145,4 +145,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -79,4 +79,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -22,8 +22,10 @@ Schema:
{
"variables": [
"name": string,
"value": string
{
"name": string,
"value": string
}
],
"schedule": [
{
@@ -195,4 +197,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, aix, freebsd
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -18,8 +18,10 @@ Schema:
{
"variables": [
"name": string,
"value": string
{
"name": string,
"value": string
}
],
"schedule": [
{
@@ -191,4 +193,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, aix, freebsd
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -99,4 +99,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -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:
@@ -24,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": boolean, # true if successfully parsed, false if error
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
}
Examples:
@@ -74,4 +82,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -96,4 +96,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, freebsd
Version 2.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 2.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -122,4 +122,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, freebsd
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -341,4 +341,4 @@ Returns:
## Parser Information
Compatibility: linux, aix, freebsd, darwin, win32, cygwin
Version 2.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 2.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -143,4 +143,4 @@ Returns:
## Parser Information
Compatibility: win32
Version 1.3 by Rasheed Elsaleh (rasheed@rebelliondefense.com)
Version 1.4 by Rasheed Elsaleh (rasheed@rebelliondefense.com)

View File

@@ -150,4 +150,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -155,4 +155,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -112,4 +112,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, aix, freebsd
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -95,4 +95,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -87,4 +87,4 @@ Returns:
## Parser Information
Compatibility: linux, aix, freebsd, darwin
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -115,4 +115,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, cygwin, freebsd
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -97,4 +97,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -110,4 +110,4 @@ Returns:
## Parser Information
Compatibility: linux, freebsd
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -134,4 +134,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, aix, freebsd
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -102,4 +102,4 @@ Returns:
## Parser Information
Compatibility: linux, aix, freebsd
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -62,4 +62,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -93,4 +93,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -342,4 +342,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -85,4 +85,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -99,4 +99,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -130,4 +130,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, aix, freebsd
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -211,4 +211,4 @@ Returns:
## Parser Information
Compatibility: linux, aix, freebsd, darwin
Version 1.10 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.11 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -90,4 +90,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

187
docs/parsers/iostat.md Normal file
View File

@@ -0,0 +1,187 @@
[Home](https://kellyjonbrazil.github.io/jc/)
# jc.parsers.iostat
jc - JSON CLI output utility `iostat` command output parser
Note: `iostat` version 11 and higher include a JSON output option
Usage (cli):
$ iostat | jc --iostat
or
$ jc iostat
Usage (module):
import jc.parsers.iostat
result = jc.parsers.iostat.parse(iostat_command_output)
Schema:
[
{
"type": string,
"percent_user": float,
"percent_nice": float,
"percent_system": float,
"percent_iowait": float,
"percent_steal": float,
"percent_idle": float,
"device": string,
"tps": float,
"kb_read_s": float,
"mb_read_s": float,
"kb_wrtn_s": float,
"mb_wrtn_s": float,
"kb_read": integer,
"mb_read": integer,
"kb_wrtn": integer,
"mb_wrtn": integer,
'kb_dscd': integer,
'mb_dscd': integer,
"rrqm_s": float,
"wrqm_s": float,
"r_s": float,
"w_s": float,
"rmb_s": float,
"rkb_s": float,
"wmb_s": float,
"wkb_s": float,
"avgrq_sz": float,
"avgqu_sz": float,
"await": float,
"r_await": float,
"w_await": float,
"svctm": float,
"aqu_sz": float,
"rareq_sz": float,
"wareq_sz": float,
"d_s": float,
"dkb_s": float,
"dmb_s": float,
"drqm_s": float,
"percent_drqm": float,
"d_await": float,
"dareq_sz": float,
"f_s": float,
"f_await": float,
"kb_dscd_s": float,
"mb_dscd_s": float,
"percent_util": float,
"percent_rrqm": float,
"percent_wrqm": float
}
]
Examples:
$ iostat | jc --iostat -p
[
{
"percent_user": 0.15,
"percent_nice": 0.0,
"percent_system": 0.18,
"percent_iowait": 0.0,
"percent_steal": 0.0,
"percent_idle": 99.67,
"type": "cpu"
},
{
"device": "sda",
"tps": 0.29,
"kb_read_s": 7.22,
"kb_wrtn_s": 1.25,
"kb_read": 194341,
"kb_wrtn": 33590,
"type": "device"
},
{
"device": "dm-0",
"tps": 0.29,
"kb_read_s": 5.99,
"kb_wrtn_s": 1.17,
"kb_read": 161361,
"kb_wrtn": 31522,
"type": "device"
},
{
"device": "dm-1",
"tps": 0.0,
"kb_read_s": 0.08,
"kb_wrtn_s": 0.0,
"kb_read": 2204,
"kb_wrtn": 0,
"type": "device"
}
]
$ iostat | jc --iostat -p -r
[
{
"percent_user": "0.15",
"percent_nice": "0.00",
"percent_system": "0.18",
"percent_iowait": "0.00",
"percent_steal": "0.00",
"percent_idle": "99.67",
"type": "cpu"
},
{
"device": "sda",
"tps": "0.29",
"kb_read_s": "7.22",
"kb_wrtn_s": "1.25",
"kb_read": "194341",
"kb_wrtn": "33590",
"type": "device"
},
{
"device": "dm-0",
"tps": "0.29",
"kb_read_s": "5.99",
"kb_wrtn_s": "1.17",
"kb_read": "161361",
"kb_wrtn": "31522",
"type": "device"
},
{
"device": "dm-1",
"tps": "0.00",
"kb_read_s": "0.08",
"kb_wrtn_s": "0.00",
"kb_read": "2204",
"kb_wrtn": "0",
"type": "device"
}
]
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
## parse
```python
parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
Compatibility: linux
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

126
docs/parsers/iostat_s.md Normal file
View File

@@ -0,0 +1,126 @@
[Home](https://kellyjonbrazil.github.io/jc/)
# jc.parsers.iostat_s
jc - JSON CLI output utility `iostat` command output streaming parser
> This streaming parser outputs JSON Lines
Note: `iostat` version 11 and higher include a JSON output option
Usage (cli):
$ iostat | jc --iostat-s
Usage (module):
import jc.parsers.iostat_s
result = jc.parsers.iostat_s.parse(iostat_command_output.splitlines()) # result is an iterable object
for item in result:
# do something
Schema:
{
"type": string,
"percent_user": float,
"percent_nice": float,
"percent_system": float,
"percent_iowait": float,
"percent_steal": float,
"percent_idle": float,
"device": string,
"tps": float,
"kb_read_s": float,
"mb_read_s": float,
"kb_wrtn_s": float,
"mb_wrtn_s": float,
"kb_read": integer,
"mb_read": integer,
"kb_wrtn": integer,
"mb_wrtn": integer,
'kb_dscd': integer,
'mb_dscd': integer,
"rrqm_s": float,
"wrqm_s": float,
"r_s": float,
"w_s": float,
"rmb_s": float,
"rkb_s": float,
"wmb_s": float,
"wkb_s": float,
"avgrq_sz": float,
"avgqu_sz": float,
"await": float,
"r_await": float,
"w_await": float,
"svctm": float,
"aqu_sz": float,
"rareq_sz": float,
"wareq_sz": float,
"d_s": float,
"dkb_s": float,
"dmb_s": float,
"drqm_s": float,
"percent_drqm": float,
"d_await": float,
"dareq_sz": float,
"f_s": float,
"f_await": float,
"kb_dscd_s": float,
"mb_dscd_s": float,
"percent_util": float,
"percent_rrqm": float,
"percent_wrqm": float,
"_jc_meta": # This object only exists if using -qq or ignore_exceptions=True
{
"success": boolean, # true if successfully parsed, false if error
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
}
Examples:
$ iostat | jc --iostat-s
{"percent_user":0.14,"percent_nice":0.0,"percent_system":0.16,"percent_iowait":0.0,"percent_steal":0.0,"percent_idle":99.7,"type":"cpu"}
{"device":"sda","tps":0.24,"kb_read_s":5.28,"kb_wrtn_s":1.1,"kb_read":203305,"kb_wrtn":42368,"type":"device"}
...
$ iostat | jc --iostat-s -r
{"percent_user":"0.14","percent_nice":"0.00","percent_system":"0.16","percent_iowait":"0.00","percent_steal":"0.00","percent_idle":"99.70","type":"cpu"}
{"device":"sda","tps":"0.24","kb_read_s":"5.28","kb_wrtn_s":"1.10","kb_read":"203305","kb_wrtn":"42368","type":"device"}
...
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
## parse
```python
parse(data, raw=False, quiet=False, ignore_exceptions=False)
```
Main text parsing generator function. Returns an iterator object.
Parameters:
data: (iterable) line-based text data to parse (e.g. sys.stdin or str.splitlines())
raw: (boolean) output preprocessed JSON if True
quiet: (boolean) suppress warning messages if True
ignore_exceptions: (boolean) ignore parsing exceptions if True
Yields:
Dictionary. Raw or processed structured data.
Returns:
Iterator object
## Parser Information
Compatibility: linux
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -188,4 +188,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -145,4 +145,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 0.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 0.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -0,0 +1,104 @@
[Home](https://kellyjonbrazil.github.io/jc/)
# jc.parsers.jar_manifest
jc - JSON CLI output utility `MANIFEST.MF` file parser
Usage (cli):
$ cat MANIFEST.MF | jc --jar-manifest
Usage (module):
import jc.parsers.jar_manifest
result = jc.parsers.jar_manifest.parse(jar_manifest_file_output)
Schema:
[
{
"key1": string,
"key2": string
}
]
Examples:
$ cat MANIFEST.MF | jc --jar-manifest -p
$ unzip -c apache-log4j-2.16.0-bin/log4j-core-2.16.0.jar META-INF/MANIFEST.MF | jc --jar-manifest -p
$ unzip -c 'apache-log4j-2.16.0-bin/*.jar' META-INF/MANIFEST.MF | jc --jar-manifest -p
$ cat MANIFEST.MF | jc --jar-manifest -p
[
{
"Import_Package": "com.conversantmedia.util.concurrent;resolution:=optional,com.fasterxml.jackson.annotation;version="[2.12,3)";resolution:=optional,com.fasterxml.jackson.core;version="[2.12,3)";resolution:=optional,com.fasterxml.jackson.core.type;version="[2.12,3)";resolution:=optional,com.fasterxml.jackson.cor...",
"Export_Package": "org.apache.logging.log4j.core;uses:="org.apache.logging.log4j,org.apache.logging.log4j.core.config,org.apache.logging.log4j.core.impl,org.apache.logging.log4j.core.layout,org.apache.logging.log4j.core.time,org.apache.logging.log4j.message,org.apache.logging.log4j.spi,org.apache.logging.log4j.status...",
"Manifest_Version": "1.0",
"Bundle_License": "https://www.apache.org/licenses/LICENSE-2.0.txt",
"Bundle_SymbolicName": "org.apache.logging.log4j.core",
"Built_By": "matt",
"Bnd_LastModified": "1639373735804",
"Implementation_Vendor_Id": "org.apache.logging.log4j",
"Specification_Title": "Apache Log4j Core",
"Log4jReleaseManager": "Matt Sicker",
...
}
]
$ unzip -c 'apache-log4j-2.16.0-bin/*.jar' META-INF/MANIFEST.MF | jc --jar-manifest -p
[
...
{
"Archive": "apache-log4j-2.16.0-bin/log4j-spring-boot-2.16.0-sources.jar",
"Manifest_Version": "1.0",
"Built_By": "matt",
"Created_By": "Apache Maven 3.8.4",
"Build_Jdk": "1.8.0_312"
},
{
"Archive": "apache-log4j-2.16.0-bin/log4j-spring-boot-2.16.0-javadoc.jar",
"Manifest_Version": "1.0",
"Built_By": "matt",
"Created_By": "Apache Maven 3.8.4",
"Build_Jdk": "1.8.0_312"
},
{
"Bundle_SymbolicName": "org.apache.logging.log4j.spring-cloud-config-client.logging.log4j.core.util;version="[2.16,3)",org.springframework.boot.autoconfigure.condition,org.springframework.cloud.context.environment,org.springframework.context,org.springframework.stereotype",
"Export_Package": "org.apache.logging.log4j.spring.cloud.config.controller;version="2.16.0"ient",
"Archive": "apache-log4j-2.16.0-bin/log4j-spring-cloud-config-client-2.16.0.jar",
"Manifest_Version": "1.0",
"Bundle_License": "https://www.apache.org/licenses/LICENSE-2.0.txt",
...
}
...
]
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
## parse
```python
parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 0.01 by Matt J (https://github.com/listuser)

View File

@@ -117,4 +117,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -128,4 +128,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, aix, freebsd
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -131,4 +131,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.10 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -39,7 +39,7 @@ Schema:
"epoch_utc": integer, # timezone aware timestamp if date field is in UTC and can be converted
"_jc_meta": # This object only exists if using -qq or ignore_exceptions=True
{
"success": booean, # true if successfully parsed, false if error
"success": boolean, # true if successfully parsed, false if error
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
@@ -91,4 +91,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 0.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 0.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -293,4 +293,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -150,4 +150,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -144,4 +144,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -285,4 +285,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -100,4 +100,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, freebsd
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -379,4 +379,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, freebsd
Version 1.11 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.12 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -231,4 +231,4 @@ Returns:
## Parser Information
Compatibility: linux, freebsd
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -119,4 +119,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, aix, freebsd
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -181,4 +181,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, freebsd
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -46,7 +46,7 @@ Schema:
"round_trip_ms_stddev": float,
"_jc_meta": # This object only exists if using -qq or ignore_exceptions=True
{
"success": booean, # true if successfully parsed, false if error
"success": boolean, # true if successfully parsed, false if error
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
@@ -98,4 +98,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, freebsd
Version 0.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 0.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -72,4 +72,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -90,4 +90,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -231,4 +231,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -133,4 +133,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -181,4 +181,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -225,4 +225,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -126,4 +126,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, aix, freebsd
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -303,4 +303,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -193,4 +193,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, freebsd
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.10 by Kelly Brazil (kellyjonbrazil@gmail.com)

105
docs/parsers/stat_s.md Normal file
View File

@@ -0,0 +1,105 @@
[Home](https://kellyjonbrazil.github.io/jc/)
# jc.parsers.stat_s
jc - JSON CLI output utility `stat` command output streaming parser
> This streaming parser outputs JSON Lines
The `xxx_epoch` calculated timestamp fields are naive (i.e. based on the local time of the system the parser is run on).
The `xxx_epoch_utc` calculated timestamp fields are timezone-aware and are only available if the timezone field is UTC.
Usage (cli):
$ stat * | jc --stat-s
Usage (module):
import jc.parsers.stat_s
result = jc.parsers.stat_s.parse(stat_command_output.splitlines()) # result is an iterable object
for item in result:
# do something
Schema:
{
"file": string,
"link_to" string,
"size": integer,
"blocks": integer,
"io_blocks": integer,
"type": string,
"device": string,
"inode": integer,
"links": integer,
"access": string,
"flags": string,
"uid": integer,
"user": string,
"gid": integer,
"group": string,
"access_time": string, # - = null
"access_time_epoch": integer, # naive timestamp
"access_time_epoch_utc": integer, # timezone-aware timestamp
"modify_time": string, # - = null
"modify_time_epoch": integer, # naive timestamp
"modify_time_epoch_utc": integer, # timezone-aware timestamp
"change_time": string, # - = null
"change_time_epoch": integer, # naive timestamp
"change_time_epoch_utc": integer, # timezone-aware timestamp
"birth_time": string, # - = null
"birth_time_epoch": integer, # naive timestamp
"birth_time_epoch_utc": integer, # timezone-aware timestamp
"unix_device": integer,
"rdev": integer,
"block_size": integer,
"unix_flags": string,
"_jc_meta": # This object only exists if using -qq or ignore_exceptions=True
{
"success": boolean, # true if successfully parsed, false if error
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
}
Examples:
$ stat | jc --stat-s
{"file":"(stdin)","unix_device":1027739696,"inode":1155,"flags":"crw--w----","links":1,"user":"kbrazil","group":"tty","rdev":268435456,"size":0,"access_time":"Jan 4 15:27:44 2022","modify_time":"Jan 4 15:27:44 2022","change_time":"Jan 4 15:27:44 2022","birth_time":"Dec 31 16:00:00 1969","block_size":131072,"blocks":0,"unix_flags":"0","access_time_epoch":1641338864,"access_time_epoch_utc":null,"modify_time_epoch":1641338864,"modify_time_epoch_utc":null,"change_time_epoch":1641338864,"change_time_epoch_utc":null,"birth_time_epoch":null,"birth_time_epoch_utc":null}
$ stat | jc --stat-s -r
{"file":"(stdin)","unix_device":"1027739696","inode":"1155","flags":"crw--w----","links":"1","user":"kbrazil","group":"tty","rdev":"268435456","size":"0","access_time":"Jan 4 15:28:08 2022","modify_time":"Jan 4 15:28:08 2022","change_time":"Jan 4 15:28:08 2022","birth_time":"Dec 31 16:00:00 1969","block_size":"131072","blocks":"0","unix_flags":"0"}
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
## parse
```python
parse(data, raw=False, quiet=False, ignore_exceptions=False)
```
Main text parsing generator function. Returns an iterator object.
Parameters:
data: (iterable) line-based text data to parse (e.g. sys.stdin or str.splitlines())
raw: (boolean) output preprocessed JSON if True
quiet: (boolean) suppress warning messages if True
ignore_exceptions: (boolean) ignore parsing exceptions if True
Yields:
Dictionary. Raw or processed structured data.
Returns:
Iterator object
## Parser Information
Compatibility: linux, darwin, freebsd
Version 0.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -79,4 +79,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, freebsd
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -83,4 +83,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -100,4 +100,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -75,4 +75,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -71,4 +71,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -229,4 +229,4 @@ Returns:
## Parser Information
Compatibility: win32
Version 1.0 by Jon Smith (jon@rebelliondefense.com)
Version 1.1 by Jon Smith (jon@rebelliondefense.com)

View File

@@ -148,4 +148,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -88,4 +88,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -156,4 +156,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -142,4 +142,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, freebsd
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -222,4 +222,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -155,4 +155,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -72,4 +72,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, freebsd
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -219,4 +219,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -90,4 +90,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -146,4 +146,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -63,7 +63,7 @@ Schema:
"epoch_utc": integer # aware timestamp if -t flag is used and UTC TZ
"_jc_meta": # This object only exists if using -qq or ignore_exceptions=True
{
"success": booean, # true if successfully parsed, false if error
"success": boolean, # true if successfully parsed, false if error
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
@@ -111,4 +111,4 @@ Returns:
## Parser Information
Compatibility: linux
Version 0.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 0.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -128,4 +128,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -79,4 +79,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -157,4 +157,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -95,4 +95,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -109,4 +109,4 @@ Returns:
## Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

107
docs/parsers/zipinfo.md Normal file
View File

@@ -0,0 +1,107 @@
[Home](https://kellyjonbrazil.github.io/jc/)
# jc.parsers.zipinfo
jc - JSON CLI output utility `zipinfo` command output parser
Options supported:
- none
Note: The default listing format.
Usage (cli):
$ zipinfo <archive> | jc --zipinfo
or
$ jc zipinfo
Usage (module):
import jc.parsers.zipinfo
result = jc.parsers.zipinfo.parse(zipinfo_command_output)
Schema:
[
{
"archive": string,
"size": integer,
"size_unit": string,
"number_entries": integer,
"number_files": integer,
"bytes_uncompressed": integer,
"bytes_compressed": integer,
"percent_compressed": float,
"files": [
{
"flags": string,
"zipversion": string,
"zipunder": string
"filesize": integer,
"type": string,
"method": string,
"date": string,
"time": string,
"filename": string
}
]
}
]
Examples:
$ zipinfo log4j-core-2.16.0.jar | jc --zipinfo -p
[
{
"archive": "log4j-core-2.16.0.jar",
"size": 1789565,
"size_unit": "bytes",
"number_entries": 1218,
"number_files": 1218,
"bytes_uncompressed": 3974141,
"bytes_compressed": 1515455,
"percent_compressed": 61.9,
"files": [
{
"flags": "-rw-r--r--",
"zipversion": "2.0",
"zipunder": "unx",
"filesize": 19810,
"type": "bl",
"method": "defN",
"date": "21-Dec-12",
"time": "23:35",
"filename": "META-INF/MANIFEST.MF"
},
...
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
## parse
```python
parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
Compatibility: linux, darwin
Version 0.01 by Matt J (https://github.com/listuser)

View File

@@ -40,7 +40,7 @@ Returns:
## compatibility
```python
compatibility(mod_name, compatible)
compatibility(mod_name, compatible, quiet=False)
```
Checks for the parser's compatibility with the running OS platform.
@@ -52,6 +52,8 @@ Parameters:
compatible options:
linux, darwin, cygwin, win32, aix, freebsd
quiet: (bool) supress compatibility message if True
Returns:
None - just prints output to STDERR
@@ -135,6 +137,24 @@ Reraise the stream exception with annotation or print an error `_jc_meta`
field if `ignore_exceptions=True`
## input_type_check
```python
input_type_check(data)
```
Ensure input data is a string
## streaming_input_type_check
```python
streaming_input_type_check(data)
```
Ensure input data is an iterable, but not a string or bytes
## streaming_line_input_type_check
```python
streaming_line_input_type_check(line)
```
Ensure each line is a string
## timestamp
```python
timestamp(datetime_string)

View File

@@ -73,4 +73,4 @@ Module Example:
"""
name = 'jc'
__version__ = '1.17.2'
__version__ = '1.17.7'

View File

@@ -37,7 +37,7 @@ class info():
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
website = 'https://github.com/kellyjonbrazil/jc'
copyright = '© 2019-2021 Kelly Brazil'
copyright = '© 2019-2022 Kelly Brazil'
license = 'MIT License'
@@ -76,8 +76,11 @@ parsers = [
'id',
'ifconfig',
'ini',
'iostat',
'iostat-s',
'iptables',
'iw-scan',
'jar-manifest',
'jobs',
'kv',
'last',
@@ -102,6 +105,7 @@ parsers = [
'shadow',
'ss',
'stat',
'stat-s',
'sysctl',
'systemctl',
'systemctl-lj',
@@ -123,7 +127,8 @@ parsers = [
'wc',
'who',
'xml',
'yaml'
'yaml',
'zipinfo'
]
JC_ERROR_EXIT = 100
@@ -233,9 +238,11 @@ def set_env_colors(env_colors=None):
}
def piped_output():
"""Return False if stdout is a TTY. True if output is being piped to another program"""
return not sys.stdout.isatty()
def piped_output(force_color):
"""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.
"""
return not sys.stdout.isatty() and not force_color
def ctrlc(signum, frame):
@@ -333,6 +340,7 @@ def helptext():
{parsers_string}
Options:
-a about jc
-C force color output even when using pipes (overrides -m)
-d debug (-dd for verbose debug)
-h help (-h --parser_name for parser documentation)
-m monochrome output
@@ -524,7 +532,8 @@ def main():
about = 'a' in options
debug = 'd' in options
verbose_debug = options.count('d') > 1
mono = 'm' in options
force_color = 'C' in options
mono = ('m' in options or bool(os.getenv('NO_COLOR'))) and not force_color
help_me = 'h' in options
pretty = 'p' in options
quiet = 'q' in options
@@ -540,7 +549,11 @@ def main():
mono = True
if about:
print(json_out(about_jc(), pretty=pretty, env_colors=jc_colors, mono=mono, piped_out=piped_output()))
print(json_out(about_jc(),
pretty=pretty,
env_colors=jc_colors,
mono=mono,
piped_out=piped_output(force_color)))
sys.exit(0)
if help_me:
@@ -630,7 +643,7 @@ def main():
pretty=pretty,
env_colors=jc_colors,
mono=mono,
piped_out=piped_output()),
piped_out=piped_output(force_color)),
flush=unbuffer)
sys.exit(combined_exit_code(magic_exit_code, 0))
@@ -643,7 +656,7 @@ def main():
pretty=pretty,
env_colors=jc_colors,
mono=mono,
piped_out=piped_output()),
piped_out=piped_output(force_color)),
flush=unbuffer)
sys.exit(combined_exit_code(magic_exit_code, 0))

View File

@@ -227,7 +227,7 @@ import jc.utils
class info():
"""Provides parser metadata (version, author, etc.)"""
version = '1.2'
version = '1.3'
description = '`acpi` command parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
@@ -302,8 +302,8 @@ def parse(data, raw=False, quiet=False):
List of Dictionaries. Raw or processed structured data.
"""
if not quiet:
jc.utils.compatibility(__name__, info.compatible)
jc.utils.compatibility(__name__, info.compatible, quiet)
jc.utils.input_type_check(data)
raw_output = []
output_line = {}

View File

@@ -80,7 +80,7 @@ import jc.utils
class info():
"""Provides parser metadata (version, author, etc.)"""
version = '1.3'
version = '1.4'
description = '`airport -I` command parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
@@ -130,8 +130,8 @@ def parse(data, raw=False, quiet=False):
Dictionary. Raw or processed structured data.
"""
if not quiet:
jc.utils.compatibility(__name__, info.compatible)
jc.utils.compatibility(__name__, info.compatible, quiet)
jc.utils.input_type_check(data)
raw_output = {}

View File

@@ -109,7 +109,7 @@ import jc.parsers.universal
class info():
"""Provides parser metadata (version, author, etc.)"""
version = '1.4'
version = '1.5'
description = '`airport -s` command parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
@@ -166,8 +166,8 @@ def parse(data, raw=False, quiet=False):
List of Dictionaries. Raw or processed structured data.
"""
if not quiet:
jc.utils.compatibility(__name__, info.compatible)
jc.utils.compatibility(__name__, info.compatible, quiet)
jc.utils.input_type_check(data)
raw_output = []
cleandata = list(filter(None, data.splitlines()))

View File

@@ -118,7 +118,7 @@ import jc.parsers.universal
class info():
"""Provides parser metadata (version, author, etc.)"""
version = '1.7'
version = '1.8'
description = '`arp` command parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
@@ -171,8 +171,8 @@ def parse(data, raw=False, quiet=False):
List of Dictionaries. Raw or processed structured data.
"""
if not quiet:
jc.utils.compatibility(__name__, info.compatible)
jc.utils.compatibility(__name__, info.compatible, quiet)
jc.utils.input_type_check(data)
raw_output = []
cleandata = list(filter(None, data.splitlines()))

View File

@@ -121,7 +121,7 @@ import jc.utils
class info():
"""Provides parser metadata (version, author, etc.)"""
version = '1.4'
version = '1.5'
description = '`blkid` command parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
@@ -176,8 +176,8 @@ def parse(data, raw=False, quiet=False):
List of Dictionaries. Raw or processed structured data.
"""
if not quiet:
jc.utils.compatibility(__name__, info.compatible)
jc.utils.compatibility(__name__, info.compatible, quiet)
jc.utils.input_type_check(data)
raw_output = []

View File

@@ -54,7 +54,7 @@ import jc.utils
class info():
"""Provides parser metadata (version, author, etc.)"""
version = '1.2'
version = '1.3'
description = '`cksum` and `sum` command parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
@@ -103,8 +103,8 @@ def parse(data, raw=False, quiet=False):
List of Dictionaries. Raw or processed structured data.
"""
if not quiet:
jc.utils.compatibility(__name__, info.compatible)
jc.utils.compatibility(__name__, info.compatible, quiet)
jc.utils.input_type_check(data)
raw_output = []

View File

@@ -19,8 +19,10 @@ Schema:
{
"variables": [
"name": string,
"value": string
{
"name": string,
"value": string
}
],
"schedule": [
{
@@ -171,7 +173,7 @@ import jc.parsers.universal
class info():
"""Provides parser metadata (version, author, etc.)"""
version = '1.5'
version = '1.6'
description = '`crontab` command and file parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
@@ -225,8 +227,8 @@ def parse(data, raw=False, quiet=False):
Dictionary. Raw or processed structured data.
"""
if not quiet:
jc.utils.compatibility(__name__, info.compatible)
jc.utils.compatibility(__name__, info.compatible, quiet)
jc.utils.input_type_check(data)
raw_output = {}
cleandata = data.splitlines()

View File

@@ -15,8 +15,10 @@ Schema:
{
"variables": [
"name": string,
"value": string
{
"name": string,
"value": string
}
],
"schedule": [
{
@@ -167,7 +169,7 @@ import jc.parsers.universal
class info():
"""Provides parser metadata (version, author, etc.)"""
version = '1.6'
version = '1.7'
description = '`crontab` file parser with user support'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
@@ -220,8 +222,8 @@ def parse(data, raw=False, quiet=False):
Dictionary. Raw or processed structured data.
"""
if not quiet:
jc.utils.compatibility(__name__, info.compatible)
jc.utils.compatibility(__name__, info.compatible, quiet)
jc.utils.input_type_check(data)
raw_output = {}
cleandata = data.splitlines()

Some files were not shown because too many files have changed in this diff Show More