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

Compare commits

...

1139 Commits

Author SHA1 Message Date
Kelly Brazil
36ce3c791d Merge pull request #343 from kellyjonbrazil/dev
Dev v1.22.4
2022-12-30 13:29:57 -08:00
Kelly Brazil
5d639db5a8 Merge branch 'master' into dev 2022-12-30 13:24:24 -08:00
Kelly Brazil
63161ffdbb doc update 2022-12-30 13:11:54 -08:00
Kelly Brazil
cf11c71831 move import to except block 2022-12-30 11:53:09 -08:00
Kelly Brazil
048f8c1f4b formatting 2022-12-30 11:49:20 -08:00
Kelly Brazil
b6b42d9071 doc update 2022-12-30 11:46:40 -08:00
Kelly Brazil
d43863ee9f delete the tempfile after use 2022-12-30 11:32:14 -08:00
Kelly Brazil
177d10577f create NamedTemporaryFile with delete=False for Windows compatibilty 2022-12-30 11:17:52 -08:00
Kelly Brazil
47d8e163de patch for windows compatibility: can only open tempfile once 2022-12-30 11:06:45 -08:00
Kelly Brazil
e49c621e59 try writing to file as bytes for windows compatibility 2022-12-30 10:44:46 -08:00
Kelly Brazil
5e32a6d828 fix for python 3.10+ compatibility 2022-12-30 10:37:12 -08:00
Kelly Brazil
b1358a7eca add nextstep plist support. using the pbPlist library 2022-12-30 10:27:03 -08:00
Kelly Brazil
ba89092e12 formatting 2022-12-29 14:52:33 -08:00
Kelly Brazil
f855420a82 doc update 2022-12-29 09:25:31 -08:00
Kelly Brazil
1589a81945 fix issue with text serial numbers in certificates 2022-12-28 21:59:38 -08:00
Kelly Brazil
eec2583cb2 formatting 2022-12-27 15:59:43 -08:00
Kelly Brazil
481c6a8de2 doc update 2022-12-27 14:01:03 -08:00
Kelly Brazil
68717e8493 add parser metadata tags and category view to help 2022-12-27 13:59:10 -08:00
Kelly Brazil
c524d37136 use ubuntu-20.04 instead of latest for python 3.6 2022-12-23 10:25:12 -08:00
Kelly Brazil
6674f549f2 version bumps and doc update 2022-12-23 10:14:19 -08:00
Kelly Brazil
ba371ec730 fix proc signature for pid_stat so hack comm names with parenthesis are handled correctly. 2022-12-23 10:08:19 -08:00
Kelly Brazil
44d1d52426 fix test for python 3.6 2022-12-23 09:40:26 -08:00
Kelly Brazil
edcca4fb96 remove re type annotations for python 3.6 compatibility 2022-12-23 09:23:51 -08:00
Kelly Brazil
6fbf9458d1 Merge branch 'dev' of https://github.com/kellyjonbrazil/jc into dev 2022-12-23 09:21:29 -08:00
Kelly Brazil
a476e4639b force test 2022-12-23 09:21:27 -08:00
Kelly Brazil
5534a1c755 change to ubuntu-20.04 for python 3.6 tests 2022-12-23 09:20:32 -08:00
Kelly Brazil
c45518db70 Merge branch 'dev' of https://github.com/kellyjonbrazil/jc into dev 2022-12-23 09:17:44 -08:00
Kelly Brazil
55480c059a python 3.6 compatibility: remove re.Match type annotation 2022-12-23 09:17:42 -08:00
Kelly Brazil
04a2af8681 add python 3.6 to tests 2022-12-23 09:14:19 -08:00
Kelly Brazil
71f672a0e0 add python 3.6 to tests 2022-12-23 09:13:00 -08:00
Kelly Brazil
33c40874fa version bump and add iwconfig parser 2022-12-23 09:12:09 -08:00
Kelly Brazil
b3ced64672 Merge pull request #334 from vrince/iwconfig-parser
add new iwconfig parser
2022-12-23 09:00:22 -08:00
Thomas Vincent
a60bf00d54 iwconfig: add test with many interface 2022-12-21 17:25:57 -05:00
Thomas Vincent
8d9a2744af iwconfig: add example in the docstring 2022-12-21 17:15:25 -05:00
Thomas Vincent
bcd7bac950 iwconfig: add to parser list + move test fixture to generic folder 2022-12-21 17:12:20 -05:00
Thomas Vincent
e996b3a9f6 add iwconfig raw vs process + tests 2022-12-19 22:36:48 -05:00
Thomas Vincent
e207cccdc5 fix copy/paste mess in regex 2022-12-19 22:23:10 -05:00
Thomas Vincent
9776dd1082 add new iwconfig parser 2022-12-19 22:13:58 -05:00
Kelly Brazil
bcff00799f Merge pull request #328 from kellyjonbrazil/dev
Dev v1.22.3
2022-12-16 15:31:16 -06:00
Kelly Brazil
0dc76621bc doc update 2022-12-16 12:54:07 -08:00
Kelly Brazil
1040c5706f split prefix and ports. remove utc timestamps 2022-12-14 11:55:46 -08:00
Kelly Brazil
265d08e3bd doc update 2022-12-13 17:32:12 -08:00
Kelly Brazil
491fce7052 add openvpn-status.log file parser 2022-12-13 17:31:05 -08:00
Kelly Brazil
3404bc4840 add pgpass tests 2022-12-13 14:57:22 -08:00
Kelly Brazil
064e3f6ac0 try changing test dates for windows compatibility 2022-12-13 14:11:12 -08:00
Kelly Brazil
71f0c4f9da doc update 2022-12-13 13:46:33 -08:00
Kelly Brazil
18143608dc doc update 2022-12-13 13:30:50 -08:00
Kelly Brazil
83a6d92449 fix tests for additional timestamps 2022-12-13 13:30:31 -08:00
Kelly Brazil
ac1f690c54 add epoch timestamps 2022-12-13 13:29:54 -08:00
Kelly Brazil
b063f1bfb4 add google big table time format 2022-12-13 13:10:34 -08:00
Kelly Brazil
4c5caa7b86 add iso attribute to timestamp 2022-12-13 12:47:31 -08:00
Kelly Brazil
85edda6e5f Merge branch 'dev' of https://github.com/kellyjonbrazil/jc into dev 2022-12-13 12:15:28 -08:00
Kelly Brazil
6e1a4a103c formatting and typing fixes 2022-12-13 12:13:27 -08:00
Kelly Brazil
2879c084e5 doc update 2022-12-13 09:01:13 -08:00
Kelly Brazil
4ecc94e531 formatting and typing fixes 2022-12-13 09:01:04 -08:00
Kelly Brazil
b8ef583b93 Merge pull request #327 from graipher/master
Add parser for cbt
2022-12-13 10:40:46 -06:00
Andreas Weiden
fd61e19135 Add raw schema 2022-12-12 19:48:33 +01:00
Andreas Weiden
79011465af Fix docstring 2022-12-12 19:46:45 +01:00
Andreas Weiden
27acedf8b7 Add newlines at end of files 2022-12-12 15:43:27 +01:00
Andreas Weiden
532c37140c Move test stuff to fixtures 2022-12-12 15:33:40 +01:00
Andreas Weiden
7f4a951065 Add parser to table in readme 2022-12-12 15:18:39 +01:00
Andreas Weiden
b9fb7fad9c Add parser for cbt 2022-12-12 15:10:59 +01:00
Kelly Brazil
be85d78f55 doc update 2022-12-05 14:54:23 -08:00
Kelly Brazil
23e02090e0 add pgpass parser 2022-12-05 14:43:48 -08:00
Kelly Brazil
50f2a811ad doc update 2022-12-05 12:43:45 -08:00
Kelly Brazil
28ee448c44 remove unneeded type ignore comments 2022-12-05 12:42:55 -08:00
Kelly Brazil
688a2099b5 relax JSONDictType - unions and Dicts cause a lot of friction 2022-12-05 12:15:35 -08:00
Kelly Brazil
6f0a53ed02 fix doc title 2022-12-02 16:10:00 -08:00
Kelly Brazil
8a14de663e doc update 2022-12-02 15:16:46 -08:00
Kelly Brazil
09344e938a add lane info lines 2022-12-02 15:16:07 -08:00
Kelly Brazil
bf41140322 fix tests for missing ipv6 addresses 2022-12-02 11:16:13 -08:00
Kelly Brazil
689a85db9b fix for missing ipv6 addresses and scope_id 2022-12-02 11:09:17 -08:00
Kelly Brazil
5e0d206e7a minor cleanup 2022-11-22 13:18:08 -08:00
Kelly Brazil
61addd7950 doc update 2022-11-22 13:12:40 -08:00
Kelly Brazil
60bb9e2aa9 doc update 2022-11-22 13:11:41 -08:00
Kelly Brazil
842fbbab64 formatting 2022-11-22 13:11:10 -08:00
Kelly Brazil
bbd227caf4 tighten up blank line checking 2022-11-22 13:10:58 -08:00
Kelly Brazil
975b4f5e4f add clf-s parser tests 2022-11-22 13:10:15 -08:00
Kelly Brazil
06840931ba doc update 2022-11-21 16:54:42 -08:00
Kelly Brazil
9f4327f517 add clf-s streaming parser 2022-11-21 16:54:13 -08:00
Kelly Brazil
3f13c70dfa formatting 2022-11-21 12:12:16 -08:00
Kelly Brazil
26f8803b23 add support for unparsable lines 2022-11-21 12:09:19 -08:00
Kelly Brazil
60f1e79b2f fix clf request string parsing and add tests 2022-11-21 11:00:58 -08:00
Kelly Brazil
5ab2ebe45a add CLF timestamp support 2022-11-21 09:27:37 -08:00
Kelly Brazil
9c8fe80d6d add more processing and timestamp 2022-11-21 09:27:21 -08:00
Kelly Brazil
1e7e22330f doc update 2022-11-20 20:45:22 -08:00
Kelly Brazil
7244868fbd initial common log format parser 2022-11-20 20:43:49 -08:00
Kelly Brazil
86ed39ecdd tighten up efi split 2022-11-18 16:19:55 -08:00
Kelly Brazil
94d87b726f add efi partition split 2022-11-18 14:20:18 -08:00
Kelly Brazil
0984a1ec26 fix git-log tests and docs 2022-11-18 13:54:59 -08:00
Kelly Brazil
de5da060ce Merge pull request #322 from adamwolf/git-log-blank-author
Fix git log parsing with empty name or email
2022-11-18 13:18:06 -06:00
Kelly Brazil
592435572c Merge branch 'dev' of https://github.com/kellyjonbrazil/jc into dev
add in PR 323
2022-11-18 11:11:57 -08:00
Kelly Brazil
3172a18a46 Merge pull request #323 from kianmeng/fix-typos
Fix typos
2022-11-18 13:05:36 -06:00
Kelly Brazil
7f1c57b89c version bump 2022-11-17 13:39:59 -06:00
Kian-Meng Ang
39555a48b5 Fix typos
Found via `codespell -S ./tests/fixtures -L
chage,ro,ist,ans,unx,respons,technik`
2022-11-16 10:01:58 +08:00
Adam Wolf
e4cdfa13ca Fix git log parsing with empty name or email
Sometimes, folks leave their name or email blank in on their
git commits.  Previously, a blank name crashed the git log
parser.
2022-11-11 13:33:01 -06:00
Kelly Brazil
cb4011bc03 formatting 2022-11-08 14:23:32 -08:00
Kelly Brazil
299b0faf7c Merge pull request #319 from kellyjonbrazil/dev
Dev v1.22.2
2022-11-08 16:32:03 +00:00
Kelly Brazil
2ffd698c03 update du docs 2022-11-08 08:13:41 -08:00
Kelly Brazil
dde54690fc Merge pull request #318 from kellyjonbrazil/master
sync to dev
2022-11-08 16:07:56 +00:00
Kelly Brazil
8d03055b34 add tests 2022-11-07 16:41:13 -08:00
Kelly Brazil
8a850be857 doc update 2022-11-07 13:26:16 -08:00
Kelly Brazil
2a530712cf add os-prober parser 2022-11-07 13:23:55 -08:00
Kelly Brazil
fd22c7dc3a add git-ls-remote parser 2022-11-07 13:02:55 -08:00
Kelly Brazil
b884f6aacc doc update 2022-11-07 10:44:37 -08:00
Kelly Brazil
ce680d4082 add cidr-style freebsd ipv4 support and freebsd options 2022-11-07 10:40:07 -08:00
Kelly Brazil
644d3f350d add more bsd tests 2022-11-06 12:12:07 -08:00
Kelly Brazil
0144863d33 new ifconfig parser with additional fields. tests passing 2022-11-06 12:04:34 -08:00
Kelly Brazil
a6b56519a2 add more bsd fields to ifconfig 2022-11-05 18:47:44 -07:00
Kelly Brazil
0a71caf9cd formatting for regexes 2022-11-05 17:12:50 -07:00
Kelly Brazil
35e74328c4 tests passing for ifconfig 2022-11-05 16:36:31 -07:00
Kelly Brazil
e46ac0ff7e initial commit of new ifconfig parser 2022-11-05 12:13:01 -07:00
Kelly Brazil
17fe6c7691 semver tests and doc update 2022-11-04 16:03:39 -07:00
Kelly Brazil
01ca7a69c4 formatting 2022-11-04 15:24:34 -07:00
Kelly Brazil
6d04db6113 add semver parser 2022-11-04 15:17:47 -07:00
Kelly Brazil
7c899abb15 add support for multiple include paths 2022-11-04 14:42:04 -07:00
Kelly Brazil
89d4df2a05 document ifconfig limitations and recommend using ip 2022-11-04 09:25:17 -07:00
Kelly Brazil
71c8364f80 doc fix 2022-11-04 09:19:42 -07:00
Kelly Brazil
214cd6b9e0 Merge pull request #310 from villesinisalo/readme_arch
Readme: recommend plain Pacman on Arch
2022-11-03 15:34:19 +00:00
Ville Sinisalo
73c280de3a use plain Pacman on Arch 2022-11-03 11:29:06 +02:00
Kelly Brazil
23e1dd3e35 use dict constructor for xmltodict to suppress !!omap comments in YAML output 2022-11-02 12:00:45 -07:00
Kelly Brazil
2b060aae0d clean up raw/processed logic 2022-11-01 19:53:44 -07:00
Kelly Brazil
186ad73651 add raw option to xml parser for _ attribute prefix 2022-11-01 18:09:05 -07:00
Kelly Brazil
de7a010f62 update test templates 2022-11-01 17:01:21 -07:00
Kelly Brazil
ac1bcd2918 doc update 2022-11-01 15:28:50 -07:00
Kelly Brazil
a2e6243282 doc update and additional tests 2022-11-01 13:50:01 -07:00
Kelly Brazil
01f92ced81 add docs and tests for findmnt 2022-11-01 13:15:31 -07:00
Kelly Brazil
b493bcf4fa update type annotations 2022-10-31 17:37:01 -07:00
Kelly Brazil
f6ee30be20 formatting 2022-10-31 17:30:51 -07:00
Kelly Brazil
50da124ea7 initial findmnt parser 2022-10-31 17:22:56 -07:00
Kelly Brazil
5e22f9e2bd formatting 2022-10-31 10:29:43 -07:00
Kelly Brazil
a384eb4c15 add sshd_conf tests 2022-10-31 09:32:58 -07:00
Kelly Brazil
dc4620eeb2 doc update 2022-10-31 09:22:39 -07:00
Kelly Brazil
d7cfa38eee ignore Match blocks 2022-10-28 16:36:52 -07:00
Kelly Brazil
a27110ebe5 formatting 2022-10-28 15:25:55 -07:00
Kelly Brazil
f5988527fb add sshd_conf parser 2022-10-28 15:15:02 -07:00
Kelly Brazil
c405309742 allow debug of exceptions 2022-10-28 15:14:53 -07:00
Kelly Brazil
747d12224f allow parser_info and get_help to use module objects as input 2022-10-28 10:36:54 -07:00
Kelly Brazil
2b621ab68e use exceptions instead of signal handlers to catch piperror and sigint 2022-10-28 10:11:19 -07:00
Kelly Brazil
8689865d31 fix exit on interrupt exit code. also add message to stderr 2022-10-27 11:23:43 -07:00
Kelly Brazil
358324533d doc update 2022-10-26 15:39:32 -07:00
Kelly Brazil
bc5821e69f force ci tests 2022-10-26 15:36:22 -07:00
Kelly Brazil
d5b478c968 bump checkout and setup-python versions 2022-10-26 15:35:41 -07:00
Kelly Brazil
368eba1826 bump checkout and setup-python versions 2022-10-26 15:34:46 -07:00
Kelly Brazil
6cffb449f4 Merge branch 'dev' of https://github.com/kellyjonbrazil/jc into dev 2022-10-26 15:23:35 -07:00
Kelly Brazil
d79d9c7f13 simplify return 2022-10-26 15:21:37 -07:00
Kelly Brazil
179822b994 add python 3.11 2022-10-26 15:18:33 -07:00
Kelly Brazil
ba369a0b73 add python 3.11 2022-10-26 15:18:04 -07:00
Kelly Brazil
6a5251f0ef doc update 2022-10-25 15:50:45 -07:00
Kelly Brazil
004fd74748 add type annotations 2022-10-25 15:21:42 -07:00
Kelly Brazil
e8d6d4c080 relax input_type_check to allow object argument 2022-10-25 15:21:26 -07:00
Kelly Brazil
8644f70db4 fix typos 2022-10-25 13:46:22 -07:00
Kelly Brazil
72f233b186 version bump 2022-10-25 11:53:08 -07:00
Kelly Brazil
fc85950a73 doc update 2022-10-25 11:49:02 -07:00
Kelly Brazil
fd5cbbb4d5 add csv utf-8 bom tests 2022-10-25 11:46:31 -07:00
Kelly Brazil
888b6bd6d5 fix for UTF-8 csv files with leading BOM bytes 2022-10-25 11:18:22 -07:00
Kelly Brazil
81ea83064c Merge pull request #306 from kellyjonbrazil/dev
Dev v1.22.1
2022-10-24 16:30:36 +00:00
Kelly Brazil
45859b01e5 doc update 2022-10-24 09:17:09 -07:00
Kelly Brazil
5b8f166169 doc update 2022-10-24 09:15:58 -07:00
Kelly Brazil
7e045ba7b0 doc update 2022-10-24 09:14:01 -07:00
Kelly Brazil
6247975ee6 update jc-web link to render 2022-10-23 13:20:50 -07:00
Kelly Brazil
297451230c lspci docs and tests 2022-10-23 09:15:23 -07:00
Kelly Brazil
754d555768 doc update 2022-10-21 13:09:13 -07:00
Kelly Brazil
b61a91f82d add pci-ids and udevadm tests 2022-10-21 12:57:28 -07:00
Kelly Brazil
1ac7a724bd integer conversions 2022-10-21 12:45:19 -07:00
Kelly Brazil
2fcf46505c add schema, typing, and doc update 2022-10-21 12:44:57 -07:00
Kelly Brazil
fdec4f08c0 add schema docs for pci-ids 2022-10-21 11:50:06 -07:00
Kelly Brazil
076c197385 more explicit type annotations 2022-10-21 10:56:10 -07:00
Kelly Brazil
3432e830f2 doc update 2022-10-19 13:46:32 -07:00
Kelly Brazil
14a237749c type annotation cleanup 2022-10-19 13:32:16 -07:00
Kelly Brazil
1559c4751e type annotate decorator function 2022-10-19 12:02:12 -07:00
Kelly Brazil
af7c4ce8ec doc update 2022-10-19 08:33:09 -07:00
Kelly Brazil
5763ce6160 Don't get too fancy with dict type annotations 2022-10-19 08:30:09 -07:00
Kelly Brazil
d7ca6caae8 use jc_types 2022-10-18 15:46:29 -07:00
Kelly Brazil
2c4f232aaa use jc_types 2022-10-18 15:45:29 -07:00
Kelly Brazil
bddfa71fa6 use object for typing since these functions accept other types 2022-10-18 15:44:53 -07:00
Kelly Brazil
f537ab058b use Tuple for <3.9 compatibility 2022-10-18 11:27:12 -07:00
Kelly Brazil
1b44b5b05a use typing Tuple for <3.9 compatibility 2022-10-18 11:24:55 -07:00
Kelly Brazil
f6e971c652 fix metadata return type 2022-10-18 11:04:08 -07:00
Kelly Brazil
dfa7a71f53 move custom types to jc_types 2022-10-18 11:01:59 -07:00
Kelly Brazil
3639e02843 doc update 2022-10-18 09:37:10 -07:00
Kelly Brazil
27b6e79c8a ignore mocking typing errors 2022-10-18 09:36:17 -07:00
Kelly Brazil
f370151b54 make iso_datetime deprecated only. no need to make hidden. 2022-10-18 09:35:59 -07:00
Kelly Brazil
597a8f468e normalize show_hidden and show_deprecated to be False by default 2022-10-18 09:35:24 -07:00
Kelly Brazil
8bd7a00410 add py.typed to package 2022-10-18 09:14:43 -07:00
Kelly Brazil
4867052972 fix AboutJCType 2022-10-15 18:27:55 -07:00
Kelly Brazil
688c3a34f6 define CustomColorType 2022-10-15 18:21:53 -07:00
Kelly Brazil
e357b27433 more granular type annotations 2022-10-15 17:53:02 -07:00
Kelly Brazil
dd70bf92f3 doc update 2022-10-15 14:43:45 -07:00
Kelly Brazil
0a97523928 doc update 2022-10-15 14:36:35 -07:00
Kelly Brazil
f67bd02283 More granular type annotations 2022-10-15 14:34:09 -07:00
Kelly Brazil
ef1055a9b6 more granular type annotations 2022-10-15 14:06:38 -07:00
Kelly Brazil
cd970b5871 TypedDict fixup for older python versions 2022-10-15 13:53:56 -07:00
Kelly Brazil
11b0863a65 Use TypedDict for more granular typing 2022-10-15 13:44:44 -07:00
Kelly Brazil
5b8cb497de add more type annotations 2022-10-14 17:28:34 -07:00
Kelly Brazil
38e2addbb6 simplify type annotation for MetadataType 2022-10-14 17:23:38 -07:00
Kelly Brazil
58158ce8b1 add type annotations 2022-10-14 17:12:58 -07:00
Kelly Brazil
5ca281f02e add type annotations 2022-10-14 15:54:26 -07:00
Kelly Brazil
ac39ce6b98 formatting 2022-10-14 14:07:05 -07:00
Kelly Brazil
38fb0a6828 allow parser module as parse() argument 2022-10-14 14:05:16 -07:00
Kelly Brazil
38c41cfaf4 formatting 2022-10-14 13:49:10 -07:00
Kelly Brazil
95ba628ac3 add more type annotations 2022-10-14 13:38:05 -07:00
Kelly Brazil
a53f2ecbaf split slot info 2022-10-12 09:07:17 -07:00
Kelly Brazil
aa1ff55bbe lower-case key names 2022-10-12 08:48:42 -07:00
Kelly Brazil
097d013447 remove bail if a, h, or v in magic_options to keep from confusing behavior 2022-10-11 17:18:55 -07:00
Kelly Brazil
3916623c46 remove multiple ands in conditional 2022-10-11 16:22:10 -07:00
Kelly Brazil
42c50c5fa1 remove unneeded fields 2022-10-11 13:44:28 -07:00
Kelly Brazil
ea515bbecc add show_hidden and show_deprecated tests 2022-10-11 12:19:11 -07:00
Kelly Brazil
9f8006060b deprecated parser support in lib 2022-10-10 16:34:32 -07:00
Kelly Brazil
6cd51c4426 add ip_split field 2022-10-10 12:21:02 -07:00
Kelly Brazil
b1e96bb50c add ip_split field 2022-10-10 12:19:39 -07:00
Kelly Brazil
50d3bda3b7 prefix ids with underscores for easier querying with jq, etc. 2022-10-10 11:37:33 -07:00
Kelly Brazil
3dfa4a1bbc rename iso-datetime to datetime-iso 2022-10-09 11:05:32 -07:00
Kelly Brazil
d1922acfc8 add datetime_iso tests 2022-10-09 11:03:31 -07:00
Kelly Brazil
3947e424e7 rename iso-datetime parser to datetime-iso 2022-10-09 11:00:02 -07:00
Kelly Brazil
25e202a09e doc update 2022-10-08 09:04:21 -07:00
Kelly Brazil
8eab3c1590 fixes for cli refactor 2022-10-08 09:04:04 -07:00
Kelly Brazil
4f294aa0ef add pci_ids parser 2022-10-07 16:36:46 -07:00
Kelly Brazil
81aa09a2e2 initial lspci parser 2022-10-07 13:06:20 -07:00
Kelly Brazil
10fc8cb48d add udevadm parser 2022-10-07 11:28:56 -07:00
Kelly Brazil
186f0708cc doc update 2022-10-07 09:34:42 -07:00
Kelly Brazil
622b3ff9ed add __slots__ to timestamp class 2022-10-06 09:05:36 -07:00
Kelly Brazil
c06963c3d6 doc update 2022-10-04 15:16:35 -07:00
Kelly Brazil
9009313748 move error codes from attribute to global constant 2022-10-04 15:04:00 -07:00
Kelly Brazil
d55a8c3079 clean up exit methods 2022-10-04 14:52:51 -07:00
Kelly Brazil
fee6a61f19 Merge pull request #299 from kellyjonbrazil/cli-refactor
Cli refactor
2022-10-04 21:18:58 +00:00
Kelly Brazil
6f1ef09d2a formatting 2022-10-04 14:13:48 -07:00
Kelly Brazil
cf6c13e605 remove old cli module 2022-10-04 14:07:02 -07:00
Kelly Brazil
028f55910a fix for rare instances when the output is a list of lists (yaml | yaml -> json) 2022-10-04 12:14:32 -07:00
Kelly Brazil
d7684d39a8 set magic_run_command_str in magic_parser 2022-10-04 11:48:36 -07:00
Kelly Brazil
f652ccd4b1 fix tests for env_colors 2022-10-04 11:39:50 -07:00
Kelly Brazil
6be92498bc remove self.env_colors attribute 2022-10-04 11:32:18 -07:00
Kelly Brazil
677e04ab7d cleanup 2022-10-04 11:15:37 -07:00
Kelly Brazil
46fdc457fc fix exit codes 2022-10-04 10:10:59 -07:00
Kelly Brazil
0306b6b73b simplify file open method 2022-10-04 09:38:46 -07:00
Kelly Brazil
c881653d55 simplify the run() method 2022-10-04 09:26:40 -07:00
Kelly Brazil
7650d831e3 add slots 2022-10-03 18:03:06 -07:00
Kelly Brazil
e7a8cc3b8b fix unbuffer 2022-10-03 17:38:55 -07:00
Kelly Brazil
d173b2f237 fix magic parser for cases where standard parser is found 2022-10-03 15:04:18 -07:00
Kelly Brazil
49ba6ed0f2 formatting 2022-10-03 13:13:10 -07:00
Kelly Brazil
2792d05c7f fix magic parser and tests 2022-10-03 13:03:42 -07:00
Kelly Brazil
cacda0f3cc fix cli tests 2022-10-03 12:49:13 -07:00
Kelly Brazil
c420547ff8 simplify monochrome settings 2022-10-03 11:30:29 -07:00
Kelly Brazil
83d388613f cleanup 2022-10-03 08:58:09 -07:00
Kelly Brazil
094b059aea fix magic options 2022-10-02 19:30:50 -07:00
Kelly Brazil
e36a8c627b fix meta timestamp 2022-10-02 18:55:54 -07:00
Kelly Brazil
d341e91290 cleanup 2022-10-02 18:29:02 -07:00
Kelly Brazil
557afc95bd initial working 2022-10-02 18:20:14 -07:00
Kelly Brazil
cb9979ac94 refactor cli 2022-10-02 16:58:20 -07:00
Kelly Brazil
5486957141 version bump 2022-09-29 09:14:53 -07:00
Kelly Brazil
d49155df95 make regex patterns raw strings to reduce pytest warnings 2022-09-28 15:09:06 -07:00
Kelly Brazil
0dd4b5f620 parser version bump 2022-09-28 14:56:37 -07:00
Kelly Brazil
690603bfda fix proc-pid-stat parser for command names with spaces and newlines 2022-09-28 14:55:25 -07:00
Kelly Brazil
b877cc9509 Merge pull request #292 from kellyjonbrazil/dev
Dev v1.22.0
2022-09-27 19:40:54 +00:00
Kelly Brazil
32fddce8fb Add autocompletions 2022-09-27 11:49:41 -07:00
Kelly Brazil
03a2b35846 Add metadata object to empty results list 2022-09-27 11:11:16 -07:00
Kelly Brazil
086cdc559c version bump 2022-09-26 19:50:39 -07:00
Kelly Brazil
97eefe28f1 doc fixes 2022-09-26 19:41:35 -07:00
Kelly Brazil
32019c99f4 check git diff 5 commits back before generating parser doc 2022-09-26 19:21:25 -07:00
Kelly Brazil
f30e15159f finalize shell completions 2022-09-26 16:59:55 -07:00
Kelly Brazil
efd0bae0d6 add /proc shel completions 2022-09-26 15:46:59 -07:00
Kelly Brazil
253aa03e07 fix parser order 2022-09-26 13:32:33 -07:00
Kelly Brazil
32183118de update parser order 2022-09-26 13:30:52 -07:00
Kelly Brazil
6c8ad1139c add proc-net-unix parser and tests 2022-09-26 13:28:21 -07:00
Kelly Brazil
980c2907ad add proc-net-route parser and tests 2022-09-26 13:16:18 -07:00
Kelly Brazil
00129f4b40 doc update 2022-09-26 11:41:23 -07:00
Kelly Brazil
f178bea0d0 add signature detection tests for the proc parser 2022-09-26 11:33:48 -07:00
Kelly Brazil
c583598257 add proc-net-protocols parser and tests 2022-09-26 08:28:48 -07:00
Kelly Brazil
1e14425555 add proc-net-packet parser and tests 2022-09-25 20:14:53 -07:00
Kelly Brazil
4a103927cd add proc-net-netstat parser and tests 2022-09-25 20:00:44 -07:00
Kelly Brazil
ab3dc41358 add proc-net-netlink parser and tests 2022-09-25 19:36:12 -07:00
Kelly Brazil
c9fcd3d203 add proc-net-ipv6-route parser and tests 2022-09-25 18:28:23 -07:00
Kelly Brazil
5186347b48 add proc-net-igmp6 parser and tests 2022-09-25 18:16:54 -07:00
Kelly Brazil
e4a40704b5 add proc-net-igmp parser and tests 2022-09-25 15:19:43 -07:00
Kelly Brazil
fcfbbc6d84 add proc-net-if-inet6 parser and tests 2022-09-25 14:13:20 -07:00
Kelly Brazil
95a38c7712 add proc-net-dev-mcast parser docs and tests 2022-09-25 13:50:42 -07:00
Kelly Brazil
be0f4477bf add proc-net-dev_mcast parser 2022-09-25 13:44:29 -07:00
Kelly Brazil
3ebd897601 add ./docgen all functionality 2022-09-25 13:32:03 -07:00
Kelly Brazil
c60e1e8d7f doc update 2022-09-25 13:08:17 -07:00
Kelly Brazil
eb205562bf force docupdate 2022-09-25 13:07:31 -07:00
Kelly Brazil
83a50bb610 add proc-net-dev parser 2022-09-25 13:02:25 -07:00
Kelly Brazil
331171b826 optimize docgen 2022-09-25 12:38:17 -07:00
Kelly Brazil
1d9965dad6 force doc update 2022-09-25 12:35:23 -07:00
Kelly Brazil
647820c75e optimize docgen 2022-09-25 12:09:12 -07:00
Kelly Brazil
d9c7dde174 add proc_net_arp parser and tests 2022-09-25 12:09:01 -07:00
Kelly Brazil
ef8c688fa1 add proc_pid_status parser and tests 2022-09-25 09:57:48 -07:00
Kelly Brazil
b0f0d02e75 add proc-pid-statm parser and tests 2022-09-25 09:03:38 -07:00
Kelly Brazil
51bc2674bd add proc_pid_stat tests 2022-09-24 17:53:24 -07:00
Kelly Brazil
5fc2008517 add proc_pid_smaps and proc_pid_stat parsers 2022-09-24 17:49:43 -07:00
Kelly Brazil
611e5c7ea2 proc_pid tests 2022-09-24 15:48:22 -07:00
Kelly Brazil
74c8b0678a add proc tests 2022-09-23 17:46:52 -07:00
Kelly Brazil
00afd79858 add test fixtures and tests 2022-09-23 16:58:34 -07:00
Kelly Brazil
45fae976f0 test optimizations 2022-09-23 16:30:43 -07:00
Kelly Brazil
ae9c1746f1 proc-buddyinfo tests 2022-09-23 16:19:52 -07:00
Kelly Brazil
fa1699298b new test templates 2022-09-23 16:19:35 -07:00
Kelly Brazil
c8720b259c optimize tests 2022-09-23 14:02:27 -07:00
Kelly Brazil
113a90a5a0 optimize tests 2022-09-23 10:58:28 -07:00
Kelly Brazil
7c0e43b2e1 pidstat doc update 2022-09-22 14:41:40 -07:00
Kelly Brazil
d51df73f37 pid -H vs -h doc fix 2022-09-22 14:35:53 -07:00
Kelly Brazil
8da203648b update ini examples 2022-09-22 14:28:03 -07:00
Kelly Brazil
12cc670fa0 doc update 2022-09-22 08:50:06 -07:00
Kelly Brazil
88222edb7f ini and kv parser: don't convert keynames to lowercase 2022-09-22 08:39:01 -07:00
Kelly Brazil
7ca0a511d5 doc update 2022-09-22 08:15:55 -07:00
Kelly Brazil
02e08403e3 schema update 2022-09-22 08:15:51 -07:00
Kelly Brazil
e29262b95a version bump for free parser 2022-09-22 08:05:05 -07:00
Kelly Brazil
c449914936 Merge pull request #290 from papparapa/fix-free-w-parse
fix wrong test function name
2022-09-22 15:02:41 +00:00
papparapa
9c290b5e11 Merge branch 'dev' into fix-free-w-parse 2022-09-21 19:58:16 +09:00
papparapa
2d9dcde0e3 fix wrong test function name 2022-09-21 10:36:11 +00:00
Kelly Brazil
da681a463e Merge pull request #289 from papparapa/fix-free-w-parse
fix free -w parse
2022-09-21 00:59:16 +00:00
papparapa
aeb494703e Merge branch 'dev' into fix-free-w-parse 2022-09-21 07:43:07 +09:00
papparapa
da4e3670b1 fix free -w parse 2022-09-20 13:02:14 +00:00
Kelly Brazil
075e2301e4 doc update 2022-09-19 21:00:00 -07:00
Kelly Brazil
df3f94b017 doc update and unbindable fix 2022-09-19 20:54:46 -07:00
Kelly Brazil
3df006fb97 use stdlib int conversion 2022-09-19 20:35:18 -07:00
Kelly Brazil
52d98a1157 doc update and schema update 2022-09-19 20:32:26 -07:00
Kelly Brazil
7c772d3a5a split super_options 2022-09-19 19:58:40 -07:00
Kelly Brazil
a583ecba7b add proc-pid-mountinfo parser (initial) 2022-09-19 19:26:08 -07:00
Kelly Brazil
76e7347ecf add proc-pid-maps parser 2022-09-19 18:33:30 -07:00
Kelly Brazil
e49e6ad179 simplify parse code 2022-09-19 17:54:04 -07:00
Kelly Brazil
859bece921 add proc-pid-io parser 2022-09-19 17:49:18 -07:00
Kelly Brazil
8ffde41fa4 add proc-pid-fdinfo parser 2022-09-19 16:50:01 -07:00
Kelly Brazil
c88bf3e94b fix signature order 2022-09-17 17:50:43 -07:00
Kelly Brazil
e623ceacc8 remove unused _process code 2022-09-17 17:43:21 -07:00
Kelly Brazil
92a044ba9b add proc-zoneinfo parser 2022-09-17 17:39:16 -07:00
Kelly Brazil
906eeefa52 add proc-vmstat parser 2022-09-17 13:34:40 -07:00
Kelly Brazil
e5913cd10d add proc-vmstat parser 2022-09-17 13:33:31 -07:00
Kelly Brazil
52d252f199 formatting 2022-09-17 13:27:50 -07:00
Kelly Brazil
28425cc493 add proc-vmallocinfo parser 2022-09-17 13:26:10 -07:00
Kelly Brazil
a0ae19a8fd formatting 2022-09-17 12:36:22 -07:00
Kelly Brazil
0bebb312dd add proc-version parser 2022-09-17 12:32:15 -07:00
Kelly Brazil
0e35e85753 add proc-uptime parser 2022-09-16 16:14:28 -07:00
Kelly Brazil
bc816bb858 add proc-swaps parser 2022-09-16 16:04:25 -07:00
Kelly Brazil
e171861629 add proc-stat parser 2022-09-16 15:54:13 -07:00
Kelly Brazil
8f539af4ab add proc-softirqs parser 2022-09-16 14:50:14 -07:00
Kelly Brazil
122a4d8f32 add proc-slabinfo parser 2022-09-16 11:40:54 -07:00
Kelly Brazil
8bd935791e add proc-partitions parser 2022-09-16 11:17:02 -07:00
Kelly Brazil
edbae09a17 add proc-pagetypeinfo parser 2022-09-16 11:06:33 -07:00
Kelly Brazil
d115d43559 add proc-pid-numa-maps parser 2022-09-16 10:02:44 -07:00
Kelly Brazil
bdb218cb0f doc update 2022-09-15 16:59:15 -07:00
Kelly Brazil
e4e07b76ec doc update 2022-09-15 16:57:45 -07:00
Kelly Brazil
fd28fea3b6 Merge pull request #287 from kellyjonbrazil/procfile
Procfile
2022-09-15 16:15:30 +00:00
Kelly Brazil
d3c1a73ced doc update 2022-09-15 08:49:12 -07:00
Kelly Brazil
c4de1c53b9 Merge pull request #284 from pbrezina/id
id: support space in names
2022-09-15 15:46:32 +00:00
Kelly Brazil
860167b950 Merge pull request #286 from kellyjonbrazil/master
Sync to dev
2022-09-15 15:44:31 +00:00
Kelly Brazil
4ebde3af5f parser version bump 2022-09-15 08:40:58 -07:00
Pavel Březina
ab5e9a46b4 id: support space in names
id parser did not work correctly if space is present in user or group
name.
2022-09-14 13:36:56 +02:00
Kelly Brazil
c348fa89a9 proc-locks fixes 2022-09-13 20:40:48 -07:00
Kelly Brazil
140dc656a2 initial proc-locks parser 2022-09-13 16:45:33 -07:00
Kelly Brazil
2cad23a7f3 add proc-loadavg parser 2022-09-13 16:27:11 -07:00
Kelly Brazil
9e5c3ae6fb add proc-ioports parser 2022-09-13 14:12:24 -07:00
Kelly Brazil
ab33836637 add proc-iomem parser 2022-09-13 14:04:15 -07:00
Kelly Brazil
cb684fa6de update schema and docs 2022-09-13 13:42:06 -07:00
Kelly Brazil
de6307dc38 remove debug print 2022-09-12 22:59:14 -07:00
Kelly Brazil
da51b2b5a0 initial proc_interrupts parser 2022-09-12 22:43:37 -07:00
Kelly Brazil
03f0984e1d doc update 2022-09-09 17:13:43 -07:00
Kelly Brazil
e1f6007dea add proc-filesystems parser 2022-09-09 17:03:51 -07:00
Kelly Brazil
0508256d28 formatting 2022-09-09 16:32:33 -07:00
Kelly Brazil
993fcd989b add driver_rtc parser 2022-09-09 16:28:34 -07:00
Kelly Brazil
65d647bc0a tighten up diskstats signature 2022-09-09 15:20:38 -07:00
Kelly Brazil
23d5204634 simplify parser by using simple_table_parse 2022-09-09 15:07:44 -07:00
Kelly Brazil
8a239b8f9c add proc-diskstats parser 2022-09-09 14:33:12 -07:00
Kelly Brazil
0a89652ae5 doc update 2022-09-08 16:53:26 -07:00
Kelly Brazil
6d6054d1dc update compatibility 2022-09-08 16:52:26 -07:00
Kelly Brazil
bc9cdadfb0 updated schema 2022-09-07 15:23:48 -07:00
Kelly Brazil
cfe98506a5 fix help examples 2022-09-07 14:25:09 -07:00
Kelly Brazil
c4c159f056 clean up examples 2022-09-07 13:56:16 -07:00
Kelly Brazil
4d761d7e8a add exception handling for file open errors 2022-09-07 12:52:05 -07:00
Kelly Brazil
c1f36f7455 add magic syntax for /proc to docs 2022-09-07 12:31:17 -07:00
Kelly Brazil
c976c3226d add magic support for /proc files 2022-09-07 11:59:54 -07:00
Kelly Brazil
cc6287c124 try/except int conversions 2022-09-07 08:40:37 -07:00
Kelly Brazil
966fe97759 add proc-devices parser and doc update 2022-09-06 17:59:26 -07:00
Kelly Brazil
1f2fe65185 add proc-crypto parser and doc update 2022-09-06 17:29:56 -07:00
Kelly Brazil
b83cd24d57 add proc-cpuinfo parser and doc update 2022-09-06 17:05:14 -07:00
Kelly Brazil
5b4e4fd943 add proc-consoles parser and doc update 2022-09-06 15:52:26 -07:00
Kelly Brazil
61cd9acaa2 add buddyinfo parser and doc update 2022-09-06 15:19:59 -07:00
Kelly Brazil
d2895928bd add examples to doc 2022-09-06 11:46:35 -07:00
Kelly Brazil
5c354b02ea doc update 2022-09-06 11:42:24 -07:00
Kelly Brazil
a764642a85 fixup help, man, readme, about docs 2022-09-06 10:07:19 -07:00
Kelly Brazil
a9b0fe6728 add 'hidden' attribute to parsers and wire up to jc.lib.all_parser_info() 2022-09-06 09:21:40 -07:00
Kelly Brazil
79ade2c182 move to module architecture. first two proc parsers 2022-09-04 10:42:16 -07:00
Kelly Brazil
146dc070ea reorder patterns 2022-09-03 14:05:57 -07:00
Kelly Brazil
c1b2bae333 add more net files 2022-09-03 11:34:28 -07:00
Kelly Brazil
e771b36a18 add more signatures 2022-09-03 10:52:35 -07:00
Kelly Brazil
edcb2280cc add more filetypes 2022-09-02 19:20:36 -07:00
Kelly Brazil
a249ca1da3 add initial procfile parser 2022-09-02 18:29:16 -07:00
Kelly Brazil
f1383b5c66 Merge pull request #277 from kellyjonbrazil/dev
fix for ipv6 ip-address parser with older python and version bump
2022-08-29 15:02:04 +00:00
Kelly Brazil
00e497828e Merge branch 'master' into dev 2022-08-29 14:54:40 +00:00
Kelly Brazil
5968eb697e fix for ipv6 ip-address parser with older python and version bump 2022-08-29 07:51:27 -07:00
Kelly Brazil
ea78b389c9 Merge pull request #275 from kellyjonbrazil/dev
Dev v1.21.1
2022-08-28 23:54:24 +00:00
Kelly Brazil
0b726f7acc doc update 2022-08-28 16:41:06 -07:00
Kelly Brazil
4d4b95c995 fix for linx arp -a cases where an icomplete hw address is present 2022-08-28 12:40:46 -07:00
Kelly Brazil
fc06d195ec fix for arp -a cases where there are incomplete hw addresses 2022-08-28 12:31:57 -07:00
Kelly Brazil
c7fc2e3b92 fix for older python versions that don't provide the netmask attribute when a decimal ip is used 2022-08-28 11:58:51 -07:00
Kelly Brazil
980fc77812 version bump 2022-08-28 11:49:32 -07:00
Kelly Brazil
75dc1722da Merge branch 'dev' of https://github.com/kellyjonbrazil/jc into dev 2022-08-28 11:45:59 -07:00
Kelly Brazil
9326f1f0da Merge pull request #274 from kellyjonbrazil/master
Pull doc updates into Dev
2022-08-28 18:45:20 +00:00
Kelly Brazil
ac831444ce fix for older python versions that don't handle decimal ip's cleanly 2022-08-28 11:40:53 -07:00
Kelly Brazil
4746cb3814 add --meta-out info to exit code section 2022-08-24 09:24:03 -07:00
Kelly Brazil
6c38a3bbaa add echo $? to show exit code 2022-08-24 09:11:06 -07:00
Kelly Brazil
9699a184d1 add exit code with --meta-out to readme 2022-08-24 09:07:34 -07:00
Kelly Brazil
51eb2c9fa8 doc update 2022-08-21 16:23:56 -07:00
Kelly Brazil
abf6ea1fec doc update 2022-08-21 16:20:13 -07:00
Kelly Brazil
37835c1972 Merge pull request #273 from kellyjonbrazil/dev
Dev v1.21.0
2022-08-21 13:58:23 -07:00
Kelly Brazil
cd2f139409 doc update 2022-08-21 13:52:52 -07:00
Kelly Brazil
13bba1f4b8 only show magic command fields if magic as used 2022-08-21 13:52:39 -07:00
Kelly Brazil
4f21c7b7b4 change --time-out to --meta-out. add more meta fields 2022-08-21 12:38:55 -07:00
Kelly Brazil
65cf7960bf add traceroute -n tests 2022-08-21 11:08:10 -07:00
Kelly Brazil
96c5ef5fa2 add library credit 2022-08-20 13:43:47 -07:00
Kelly Brazil
f7c6a82e73 add cef tests 2022-08-20 13:38:20 -07:00
Kelly Brazil
23e81bc3fe add cef streaming parser. doc updates 2022-08-20 13:30:39 -07:00
Kelly Brazil
7c35845006 formatting 2022-08-20 12:37:45 -07:00
Kelly Brazil
7ad0f8a17f formatting 2022-08-20 12:37:11 -07:00
Kelly Brazil
b6cd123719 doc update 2022-08-20 12:30:52 -07:00
Kelly Brazil
944ae9f8d9 doc update 2022-08-20 11:31:52 -07:00
Kelly Brazil
935e114d40 add syslog streaming tests 2022-08-20 11:25:56 -07:00
Kelly Brazil
7fbfec4e5a remove unneeded raw strings 2022-08-20 11:13:32 -07:00
Kelly Brazil
6d5c72b54b add raid5 and container tests 2022-08-20 10:58:13 -07:00
Kelly Brazil
23ad501595 add -n support for ipv6 2022-08-20 09:48:38 -07:00
Kelly Brazil
985d7d28ed add -n support (ipv4) 2022-08-19 21:36:15 -07:00
Kelly Brazil
9ddaddfaa0 add case for timestamp-style datetime fields 2022-08-19 20:36:58 -07:00
Kelly Brazil
de11ae20a4 add git, syslog, and cef timestamp tests 2022-08-19 09:06:46 -07:00
Kelly Brazil
89574faef7 remove underscore in CEF_Version, doc update, timestamp optimization 2022-08-19 08:44:23 -07:00
Kelly Brazil
7bf6f1b870 formatting 2022-08-18 11:24:49 -07:00
Kelly Brazil
0ee0cb35bc add escape chars to doc 2022-08-18 11:23:03 -07:00
Kelly Brazil
780eb05553 doc update 2022-08-18 11:19:11 -07:00
Kelly Brazil
d71a7fbbed cleanup custom field processing and add datetime support 2022-08-18 10:55:37 -07:00
Kelly Brazil
5b597b6583 move conversions into process(). initial timestamp fields working 2022-08-17 17:46:24 -07:00
Kelly Brazil
42b24d71e9 add CEF time formats 2022-08-17 17:45:47 -07:00
Kelly Brazil
07c65351d5 rename keys to match spec. attempt type conversions for extended fields. 2022-08-17 15:20:18 -07:00
Kelly Brazil
cadf7e732e doc formatting 2022-08-17 12:54:12 -07:00
Kelly Brazil
8682a6bd0a normalize key names 2022-08-16 21:08:44 -07:00
Kelly Brazil
e20357663d doc formatting 2022-08-16 17:13:53 -07:00
Kelly Brazil
e777992b3e add schema docs 2022-08-16 17:12:09 -07:00
Kelly Brazil
5f43abc908 strip newline at the end of each line string 2022-08-16 17:00:09 -07:00
Kelly Brazil
8cbd92ccb6 add unparsable warning message 2022-08-16 16:39:00 -07:00
Kelly Brazil
80b4f7d037 add streamin syslog parsers 2022-08-16 16:33:50 -07:00
Kelly Brazil
d5839e199f add syslog-bsd-s streaming parser 2022-08-16 16:15:03 -07:00
Kelly Brazil
4b9ed91546 regex formatting 2022-08-16 15:59:08 -07:00
Kelly Brazil
2e9b9ab987 tighten up priority parsing 2022-08-16 15:10:00 -07:00
Kelly Brazil
9a50a0cc2c doc update 2022-08-16 14:43:05 -07:00
Kelly Brazil
167ea6dfcf add several fields based on user feedback 2022-08-16 14:36:00 -07:00
Kelly Brazil
f17d9ccbd6 doc update 2022-08-16 10:01:31 -07:00
Kelly Brazil
8a6bbc55d2 fix for missing tag 2022-08-16 10:01:27 -07:00
Kelly Brazil
d42ec58ad1 remove colon at the end of the hostname if it exists. 2022-08-15 18:21:58 -07:00
Kelly Brazil
c82c6a88f8 add tests 2022-08-15 18:10:48 -07:00
Kelly Brazil
e7c8778e30 add docs, int conversion, and better rfc compliance 2022-08-15 18:10:43 -07:00
Kelly Brazil
7c4cf66243 add syslog tests 2022-08-15 16:54:10 -07:00
Kelly Brazil
b4b3a11f01 tighten up key/value split 2022-08-15 16:54:02 -07:00
Kelly Brazil
17ce869939 add warning for unparsable lines 2022-08-15 15:39:20 -07:00
Kelly Brazil
05fd3cf787 add mdadm tests 2022-08-15 15:11:54 -07:00
Kelly Brazil
3daf90c5fe doc formatting 2022-08-15 13:51:48 -07:00
Kelly Brazil
02db3baf52 move test fixtures 2022-08-15 11:14:26 -07:00
Kelly Brazil
0bc7311473 doc update 2022-08-15 11:14:17 -07:00
Kelly Brazil
2fda7af8a7 change values to parameters in schema 2022-08-14 12:18:22 -07:00
Kelly Brazil
0cd471dfb2 doc update 2022-08-14 12:11:31 -07:00
Kelly Brazil
20982ab1a6 doc update 2022-08-14 12:03:16 -07:00
Kelly Brazil
81ed9c0c5c add timestamps 2022-08-14 11:48:41 -07:00
Kelly Brazil
23263bd83e add support for strings with UTC offset suffixes 2022-08-14 11:48:24 -07:00
Kelly Brazil
4d3d608e5c add support for ISO-like formats 2022-08-14 10:52:58 -07:00
Kelly Brazil
850a02b4c0 formatting 2022-08-12 18:20:11 -07:00
Kelly Brazil
2d4ace68e7 fix escape character fixups 2022-08-12 18:04:22 -07:00
Kelly Brazil
9adc66af63 version bump to 1.21.0 2022-08-12 17:35:47 -07:00
Kelly Brazil
c24c5f7985 extract structured data. need to fix corner cases 2022-08-12 17:35:28 -07:00
Kelly Brazil
5f280c3e24 doc update 2022-08-12 10:16:15 -07:00
Kelly Brazil
edff49a44f add syslog parsers 2022-08-11 13:29:53 -07:00
Kelly Brazil
345431bbcc add more escape chars 2022-08-09 21:33:54 -07:00
Kelly Brazil
b087e712ca initial cef parser 2022-08-09 20:25:54 -07:00
Kelly Brazil
b7a281c6c4 add val fields and append device table flags to state 2022-08-07 15:11:16 -07:00
Kelly Brazil
bc1521d937 add initial mdadm parser 2022-08-07 13:39:58 -07:00
Kelly Brazil
c15f7641f4 doc update 2022-08-06 17:05:03 -07:00
Kelly Brazil
123de1a3ce simplify timestamp field addition 2022-08-05 10:01:00 -07:00
Kelly Brazil
6d66557b11 add_timestamp_to tests in cli.py 2022-08-04 17:49:18 -07:00
Kelly Brazil
cb3484e1ab doc update 2022-08-04 15:43:44 -07:00
Kelly Brazil
3166600ac6 doc update 2022-08-04 11:43:49 -07:00
Kelly Brazil
ba39f35a01 disable YAML aliases 2022-08-04 11:28:22 -07:00
Kelly Brazil
934ef04694 change long timestamp option to --time-out so it doesn't clash with the timestamp parser name 2022-08-04 08:27:48 -07:00
Kelly Brazil
bfe41d0391 doc formatting 2022-08-04 07:44:36 -07:00
Kelly Brazil
5c9cd4e4cd timestamp working on standard and streaming parsers. updates existing _jc_meta if exists 2022-08-04 07:44:25 -07:00
Kelly Brazil
c57d3416b7 add timestamp option to cli 2022-08-03 17:40:39 -07:00
Kelly Brazil
498a2a314b doc formatting 2022-08-02 08:50:30 -07:00
Kelly Brazil
63961d8711 add plist tests 2022-08-01 11:11:26 -07:00
Kelly Brazil
02f7d73fca add fortisoar 2022-07-31 17:21:50 -07:00
Kelly Brazil
0bfb5f8a3c add FortiSOAR 2022-07-31 17:19:04 -07:00
Kelly Brazil
f22ac8db2b fix for empty string data 2022-07-31 17:16:17 -07:00
Kelly Brazil
86067f913b fix for unparsable bytes 2022-07-31 17:08:44 -07:00
Kelly Brazil
4744757726 fixup for byte and datetime values 2022-07-31 16:47:48 -07:00
Kelly Brazil
108e1b730e add plist parser 2022-07-31 16:14:04 -07:00
Kelly Brazil
bf93d60bf1 doc update 2022-07-31 10:52:00 -07:00
Kelly Brazil
cd5547dfd8 doc update 2022-07-30 12:23:43 -07:00
Kelly Brazil
ff7f830f65 add __main__.py entrypoint 2022-07-30 12:14:10 -07:00
Kelly Brazil
0993fec114 add tests 2022-07-30 11:10:10 -07:00
Kelly Brazil
ebec5c98b8 handle Binary Object Store Descriptor section (not implemented) 2022-07-30 10:04:52 -07:00
Kelly Brazil
4075bce26a version bump 2022-07-29 13:38:21 -07:00
Kelly Brazil
37b830a2fd doc update 2022-07-29 13:35:45 -07:00
Kelly Brazil
f22dd3aa88 doc update 2022-07-29 13:26:51 -07:00
Kelly Brazil
c27591e838 update schema docs 2022-07-29 13:26:07 -07:00
Kelly Brazil
790cdf2996 add device_qualifier section 2022-07-29 13:22:16 -07:00
Kelly Brazil
7f73740fc7 add dotted netmask test 2022-07-28 17:18:01 -07:00
Kelly Brazil
babb08c2e0 formatting 2022-07-28 16:30:13 -07:00
Kelly Brazil
24960cd02b fix scope matching issue 2022-07-28 15:42:25 -07:00
Kelly Brazil
1fcf844e8d manually pull scope_id for older python versions 2022-07-28 10:50:03 -07:00
Kelly Brazil
4b245952fe fix for ipv6 on python < 3.9 2022-07-28 10:36:09 -07:00
Kelly Brazil
4bb4cced90 fixes for python < 3.9 2022-07-28 10:25:21 -07:00
Kelly Brazil
6625ade578 add ip_address tests 2022-07-28 09:58:02 -07:00
Kelly Brazil
3f74571dfc formatting 2022-07-28 09:11:02 -07:00
Kelly Brazil
c8c3d5dc3d formatting 2022-07-28 09:03:49 -07:00
Kelly Brazil
6b862dc860 object cleanup 2022-07-28 09:00:56 -07:00
Kelly Brazil
92956cb1a7 doc update 2022-07-28 07:31:30 -07:00
Kelly Brazil
1df662102c remove subnet on compressed and exploded 2022-07-28 07:30:26 -07:00
Kelly Brazil
726bcc83d2 add docs 2022-07-27 17:21:04 -07:00
Kelly Brazil
b4fb2d102c add ipv6-only fields 2022-07-27 16:22:32 -07:00
Kelly Brazil
624fba9704 add hex and binary representations 2022-07-27 15:36:01 -07:00
Kelly Brazil
fdb629f82b fix host number calculations 2022-07-27 14:27:05 -07:00
Kelly Brazil
11d2eb35be calculate first and last host instead of using the slower iterable 2022-07-27 13:08:35 -07:00
Kelly Brazil
d970b435b4 do str/int conversions up front 2022-07-27 12:49:03 -07:00
Kelly Brazil
82398aef5a add ranges and fix ptr 2022-07-27 12:40:10 -07:00
Kelly Brazil
deaf1860fb add fields 2022-07-27 11:42:11 -07:00
Kelly Brazil
9fcf1eb9cb initial ip-address parser 2022-07-27 10:42:35 -07:00
Kelly Brazil
80de7ed5cb version bump. locale info changes. add ip-address parser 2022-07-27 08:27:28 -07:00
Kelly Brazil
e2f1b16cb9 Merge pull request #267 from kellyjonbrazil/dev
fix url parser for urls ending in slash
2022-07-23 13:43:14 -07:00
Kelly Brazil
73d0bb8bbd fix url parser for urls ending in slash 2022-07-23 13:33:12 -07:00
Kelly Brazil
2683dbb20a Merge pull request #266 from kellyjonbrazil/dev
Dev v1.20.3
2022-07-23 13:12:54 -07:00
Kelly Brazil
8b3228797e formatting 2022-07-23 12:55:56 -07:00
Kelly Brazil
947b37397f doc update 2022-07-23 12:52:42 -07:00
Kelly Brazil
f5f0e00e8d add timestamp tests 2022-07-23 12:51:27 -07:00
Kelly Brazil
73ab7da665 add timestamp parser 2022-07-23 12:43:17 -07:00
Kelly Brazil
6f00b6fd61 doc update 2022-07-23 10:57:46 -07:00
Kelly Brazil
8ada8b79c1 doc update 2022-07-23 10:45:11 -07:00
Kelly Brazil
cd293d4786 new email address schema 2022-07-23 10:45:04 -07:00
Kelly Brazil
b7d59bdd85 update tests for new email-address schema 2022-07-23 10:44:44 -07:00
Kelly Brazil
894f599f79 add tests for iso_datetime and jwt 2022-07-22 15:58:39 -07:00
Kelly Brazil
29bb10b8ff add url and email_address tests 2022-07-22 15:41:59 -07:00
Kelly Brazil
7224c7183b docfix: scheme can be string or null 2022-07-22 14:58:21 -07:00
Kelly Brazil
81301357e4 schema update: netloc can be string or null 2022-07-22 11:46:52 -07:00
Kelly Brazil
ddca18f25a remove unused import 2022-07-22 11:43:21 -07:00
Kelly Brazil
d1164290a6 formatting 2022-07-22 11:42:00 -07:00
Kelly Brazil
3949edc169 doc update 2022-07-22 11:37:00 -07:00
Kelly Brazil
a296ac2e8f fix port integer handling 2022-07-22 11:36:23 -07:00
Kelly Brazil
551f4b097d doc update 2022-07-22 09:28:27 -07:00
Kelly Brazil
8d42f747a7 schema update for normalized, encoded, and decoded fields 2022-07-22 09:28:18 -07:00
Kelly Brazil
163a76dd10 add microsecond field 2022-07-21 10:16:58 -07:00
Kelly Brazil
7389ed5d0c doc update 2022-07-21 09:52:03 -07:00
Kelly Brazil
5905058e97 clarify quoting rules 2022-07-21 09:51:58 -07:00
Kelly Brazil
2a11fefe45 add timestamp info 2022-07-20 23:02:16 -07:00
Kelly Brazil
e27ed0743c formatting 2022-07-20 22:31:04 -07:00
Kelly Brazil
9f6a788a98 doc update 2022-07-20 22:28:12 -07:00
Kelly Brazil
a15d20b400 add final encoded fields 2022-07-20 22:27:29 -07:00
Kelly Brazil
55ae836a43 add encoded fields 2022-07-20 21:46:06 -07:00
Kelly Brazil
c4fc5409e3 doc update 2022-07-20 17:09:09 -07:00
Kelly Brazil
956ad75168 add iso_datetime string parser 2022-07-20 17:06:29 -07:00
Kelly Brazil
71494a53ca doc update 2022-07-20 16:53:54 -07:00
Kelly Brazil
bc211b7c36 fix plus signs in quoted query 2022-07-20 16:39:31 -07:00
Kelly Brazil
2eaef09770 fixup schema and examples 2022-07-20 16:31:59 -07:00
Kelly Brazil
641d63604b doc fix 2022-07-20 15:59:33 -07:00
Kelly Brazil
750a3906c7 doc fix 2022-07-20 15:58:29 -07:00
Kelly Brazil
bd8e69ce98 initialize query variables 2022-07-20 15:57:05 -07:00
Kelly Brazil
16b17dd7aa remove unneded unwrap step 2022-07-20 15:51:34 -07:00
Kelly Brazil
d5a6c22cc6 add normalized fields 2022-07-20 15:43:08 -07:00
Kelly Brazil
b2271713e1 add to docs 2022-07-20 07:56:39 -07:00
Kelly Brazil
f0b9662c5e add docs 2022-07-20 07:54:50 -07:00
Kelly Brazil
720c6b5d42 add note about jc not checking the certificate integrity 2022-07-19 17:15:54 -07:00
Kelly Brazil
c30d44ea13 doc update 2022-07-19 15:24:38 -07:00
Kelly Brazil
b5788134b6 add jwt string parser 2022-07-19 15:23:42 -07:00
Kelly Brazil
790103fb48 doc update 2022-07-19 13:02:09 -07:00
Kelly Brazil
e56944dc24 formatting 2022-07-19 12:58:49 -07:00
Kelly Brazil
ed04951ed7 add email_address string parser 2022-07-19 12:58:44 -07:00
Kelly Brazil
84337fe3d1 change description 2022-07-19 08:46:34 -07:00
Kelly Brazil
da631c8b22 add username, password, hostname, and port 2022-07-19 08:23:27 -07:00
Kelly Brazil
450d0d5ddf document schema 2022-07-19 07:45:13 -07:00
Kelly Brazil
0ed47fc7ce fix query for non-http schemes. Set null for empty fields 2022-07-19 07:39:01 -07:00
Kelly Brazil
d57a00e8be fix up query object 2022-07-19 07:29:09 -07:00
Kelly Brazil
fa7721c31d add initial URL parser 2022-07-19 07:16:28 -07:00
Kelly Brazil
0f72d46050 add extension docs 2022-07-18 14:47:48 -07:00
Kelly Brazil
fe3b5bc2ed doc update 2022-07-18 14:31:13 -07:00
Kelly Brazil
4f7f8dd82b doc update 2022-07-18 14:23:52 -07:00
Kelly Brazil
81fb294859 add m3u example 2022-07-17 11:30:53 -07:00
Kelly Brazil
c04fd5bbf9 simplify single quote handling 2022-07-16 21:16:29 -07:00
Kelly Brazil
d6ed5a0eba doc update 2022-07-16 20:52:19 -07:00
Kelly Brazil
33b996f6be process optimizations 2022-07-16 20:51:18 -07:00
Kelly Brazil
26d4bbe9a4 add m3u tests 2022-07-16 19:43:19 -07:00
Kelly Brazil
5abea6d0c5 fix issue with single quotes in extended info 2022-07-16 19:32:23 -07:00
Kelly Brazil
afce7cdbd7 remove auto import 2022-07-16 11:43:41 -07:00
Kelly Brazil
8c3cff59c6 make parser more robust for non-standard extension fields 2022-07-16 11:27:58 -07:00
Kelly Brazil
bc15a636f1 optimizations up to netstat 2022-07-15 17:28:08 -07:00
Kelly Brazil
1564533161 formatting 2022-07-15 15:19:56 -07:00
Kelly Brazil
27fd6843cc add m3u file parser 2022-07-15 15:14:49 -07:00
Kelly Brazil
8c8d5552c8 version bump 2022-07-15 11:18:13 -07:00
Kelly Brazil
a7ee414c67 add pager functionality to parser documentation 2022-07-15 11:18:02 -07:00
Kelly Brazil
6573b355cc Merge pull request #262 from kellyjonbrazil/master
sync to dev
2022-07-15 10:53:37 -07:00
Kelly Brazil
eaa36a6a31 formatting 2022-07-07 12:56:18 -07:00
Kelly Brazil
8b1c4f923e doc fix 2022-07-07 09:23:02 -07:00
Kelly Brazil
89c36e4996 add pkcs12 example 2022-07-07 09:13:06 -07:00
Kelly Brazil
0ea5c9585a formatting 2022-07-06 20:27:41 -07:00
Kelly Brazil
5fa2fe3992 fix example 2022-07-06 17:20:56 -07:00
Kelly Brazil
014437298c add pkcs7 example 2022-07-06 17:08:12 -07:00
Kelly Brazil
04d91516e8 add license 2022-07-05 19:56:22 -07:00
Kelly Brazil
9b33a50bb0 Merge pull request #260 from kellyjonbrazil/dev
Dev v1.20.2
2022-07-05 19:39:40 -07:00
Kelly Brazil
b0e9d9fa9d fix encodings for windows tests 2022-07-05 19:23:22 -07:00
Kelly Brazil
991b612b62 add colon seperators to hex strings in python 3.6 and 3.7 2022-07-05 19:19:06 -07:00
Kelly Brazil
855c9363a5 add hexlify compatibility for python 3.6 and 3.7 2022-07-05 19:12:44 -07:00
Kelly Brazil
625544f53e add x509-cert tests 2022-07-05 18:59:55 -07:00
Kelly Brazil
f179da8cd1 sort set to list conversion 2022-07-05 18:59:47 -07:00
Kelly Brazil
eeee776555 add shell completion build scripts 2022-07-05 16:41:23 -07:00
Kelly Brazil
d0bde14a2a version bump 2022-07-05 16:15:35 -07:00
Kelly Brazil
69b0e407ad move pygments colors to cli_data.py 2022-07-05 16:15:26 -07:00
Kelly Brazil
ad2b9ab76c doc update 2022-07-05 15:07:10 -07:00
Kelly Brazil
32483de4f2 doc update 2022-07-05 14:59:21 -07:00
Kelly Brazil
ec713cfa1b doc update 2022-07-05 13:33:57 -07:00
Kelly Brazil
eac8c1c1a0 only attempt to decode certificate type 2022-07-05 12:55:38 -07:00
Kelly Brazil
4e15ab7924 fix _fix_objects: catch all sets and OrderedDicts 2022-07-05 11:33:56 -07:00
Kelly Brazil
5882755e7c convert larg integers to ascii-hex. simplify _fix_objects. add iso date strings. allow multiple certs in a PEM bundle 2022-07-05 11:29:24 -07:00
Kelly Brazil
13388df603 initial working x509 cert parser 2022-07-01 15:48:29 -07:00
Kelly Brazil
430385fa63 doc update 2022-06-30 09:25:01 -07:00
Kelly Brazil
7bfebdcfeb remove unnecessary list initialization 2022-06-30 09:24:05 -07:00
Kelly Brazil
e472c3b140 add gpg tests 2022-06-29 18:56:15 -07:00
Kelly Brazil
43ac3d951c doc update 2022-06-29 18:36:06 -07:00
Kelly Brazil
207fa232c3 add examples 2022-06-29 18:34:20 -07:00
Kelly Brazil
667dc1976a add support for special field types 2022-06-29 18:26:38 -07:00
Kelly Brazil
7437750de5 initial working gpg parser 2022-06-29 11:01:25 -07:00
Kelly Brazil
aab47c9e80 Merge pull request #258 from kellyjonbrazil/master
sync to dev
2022-06-28 16:07:05 -07:00
Kelly Brazil
f1ed803525 formatting 2022-06-16 18:03:51 -07:00
Kelly Brazil
093c1703d7 formatting 2022-06-16 18:00:40 -07:00
Kelly Brazil
1f2e16aeea formatting 2022-06-16 17:54:40 -07:00
Kelly Brazil
6f89745a58 formatting 2022-06-16 17:51:59 -07:00
Kelly Brazil
9b710b0b6f formatting 2022-06-16 17:51:20 -07:00
Kelly Brazil
992120b861 spelling 2022-06-16 17:48:07 -07:00
Kelly Brazil
229bef5f82 update anchor link 2022-06-16 07:52:58 -07:00
Kelly Brazil
c8a4890fc7 fix anchor link 2022-06-16 07:50:37 -07:00
Kelly Brazil
10a9848ac8 Merge branch 'master' of https://github.com/kellyjonbrazil/jc 2022-06-16 07:48:46 -07:00
Kelly Brazil
95189e37ba add streaming parsers link 2022-06-16 07:48:44 -07:00
Kelly Brazil
fe1f09f08d use github markdown renderer 2022-06-15 20:15:24 -07:00
Kelly Brazil
6adfa15742 formatting 2022-06-15 20:10:55 -07:00
Kelly Brazil
edef264f17 formatting 2022-06-15 20:04:39 -07:00
Kelly Brazil
9911b3fc9d formatting 2022-06-15 16:11:22 -07:00
Kelly Brazil
1675aa7a59 add shell completion wiki link 2022-06-15 16:08:31 -07:00
Kelly Brazil
7fd67fda13 Merge pull request #256 from kellyjonbrazil/dev
v1.20.1
2022-06-15 22:16:07 +00:00
Kelly Brazil
7583f315ce add long options tests 2022-06-15 13:21:37 -07:00
Kelly Brazil
7fd70d2088 doc update 2022-06-15 13:10:12 -07:00
Kelly Brazil
337ee73844 doc update 2022-06-15 12:51:42 -07:00
Kelly Brazil
43702a260b strip single quotes just like double quotes 2022-06-15 12:50:58 -07:00
Kelly Brazil
40208a9f76 doc update 2022-06-15 11:25:21 -07:00
Kelly Brazil
b958358389 update _snake_case comment 2022-06-15 11:15:26 -07:00
Kelly Brazil
c23aacedad doc update 2022-06-15 11:12:49 -07:00
Kelly Brazil
4f148469d7 preserve keyname case with -r 2022-06-15 11:12:43 -07:00
Kelly Brazil
247c43278c add postconf tests 2022-06-15 09:22:09 -07:00
Kelly Brazil
45f45e0511 add examples 2022-06-15 09:18:11 -07:00
Kelly Brazil
c0c469ae9b add comments 2022-06-14 17:03:54 -07:00
Kelly Brazil
4b86fd8d8a manipulate words and CURRENT to fix magic completions in Zsh 2022-06-14 16:51:45 -07:00
Kelly Brazil
8fba47f449 doc update 2022-06-14 12:42:30 -07:00
Kelly Brazil
f9ae964280 reuse arrays in zsh completions 2022-06-14 08:49:26 -07:00
Kelly Brazil
ca95615d7f partially working _normal completion for zsh 2022-06-14 07:42:55 -07:00
Kelly Brazil
747b255e34 zsh working same as bash except for magic command completions 2022-06-13 21:09:37 -07:00
Kelly Brazil
c0da9ebd6c only check previous words in bash completion 2022-06-10 17:25:19 -07:00
Kelly Brazil
5c40b38a05 fix help bash completions so they don't repeat parsers 2022-06-10 12:02:04 -07:00
Kelly Brazil
7bc03dcf06 add local vars to bash completion 2022-06-08 08:51:23 -07:00
Kelly Brazil
f62e6168fd fix help completions for bash 2022-06-08 08:50:20 -07:00
Kelly Brazil
39c1470ea6 add special options to bash completion 2022-06-07 11:57:48 -07:00
Kelly Brazil
e48b99f1c1 fix bash completion behavior 2022-06-07 11:02:05 -07:00
Kelly Brazil
71ae545907 better working bash completion 2022-06-06 16:24:52 -07:00
Kelly Brazil
b9a5eda187 formatting 2022-06-06 10:52:40 -07:00
Kelly Brazil
231a2039c2 update options 2022-06-06 10:49:17 -07:00
Kelly Brazil
a415bc23fa man page update 2022-06-06 10:32:18 -07:00
Kelly Brazil
79add35fc1 split long and short options 2022-06-05 18:09:44 -07:00
Kelly Brazil
901763fc39 fix hyphens 2022-06-05 18:06:38 -07:00
Kelly Brazil
1034cb1ea2 Merge branch 'dev' of https://github.com/kellyjonbrazil/jc into dev 2022-06-05 18:04:42 -07:00
Kelly Brazil
020093fd67 revert non-breaking hyphens 2022-06-05 18:04:35 -07:00
Kelly Brazil
f17b3fbd32 add non-breaking hyphens 2022-06-05 17:54:34 -07:00
Kelly Brazil
15b58e3a6b add long-options 2022-06-05 17:52:14 -07:00
Kelly Brazil
da6c98826b doc update 2022-06-05 17:40:05 -07:00
Kelly Brazil
26415e2978 formatting 2022-06-05 17:17:13 -07:00
Kelly Brazil
d849bd3b66 add bash and zsh completions to cli 2022-06-05 16:23:55 -07:00
Kelly Brazil
5996192455 remove indent at end of help text 2022-06-05 12:16:30 -07:00
Kelly Brazil
a38b6b5522 add long options 2022-06-05 12:12:58 -07:00
Kelly Brazil
1d6bc40bff fix no_wake_up_before_first_use to allow None 2022-06-03 10:35:49 -07:00
Kelly Brazil
437fa62cb1 update schema 2022-06-03 10:29:55 -07:00
Kelly Brazil
6cde26d9ed add process logic 2022-06-02 14:53:31 -07:00
Kelly Brazil
f6dd5a68cd doc update 2022-06-02 09:28:00 -07:00
Kelly Brazil
b1507dc576 initial postconf parser 2022-06-02 09:14:02 -07:00
Kelly Brazil
a5d5b1554f change variable name from list to my_list 2022-06-02 08:34:51 -07:00
Kelly Brazil
ec8efebc94 move _get_item outside of parse function 2022-06-02 08:31:28 -07:00
Kelly Brazil
f86cbf5527 Merge pull request #250 from pbrezina/id
id: parse output without name
2022-06-02 15:27:07 +00:00
Pavel Březina
57142d899c id: parse output without name
If a group does not exist only gid is present in the command output.
2022-06-02 12:51:11 +02:00
Kelly Brazil
504a04279e version bump 2022-06-01 12:13:50 -07:00
Kelly Brazil
3b4ef4a814 formatting 2022-06-01 12:13:41 -07:00
Kelly Brazil
a7e3d2fc86 Merge pull request #251 from kellyjonbrazil/master
sync to dev
2022-06-01 17:35:52 +00:00
Kelly Brazil
776ee66bae Merge pull request #249 from kellyjonbrazil/dev
Dev v1.20.0
2022-05-31 16:23:43 +00:00
Kelly Brazil
9bf2cd0691 doc update 2022-05-31 09:16:54 -07:00
Kelly Brazil
fec74cf305 doc formatting 2022-05-28 13:13:07 -07:00
Kelly Brazil
d3d7fbca61 doc formatting 2022-05-28 12:41:36 -07:00
Kelly Brazil
550862a415 doc update 2022-05-28 12:18:02 -07:00
Kelly Brazil
1763b530da add tests for new fields 2022-05-27 17:40:54 -07:00
Kelly Brazil
8307150cae add integer fields 2022-05-27 17:26:48 -07:00
Kelly Brazil
d2223c45d1 add new fields to schema 2022-05-27 17:20:54 -07:00
Kelly Brazil
472ee5e295 add new fields. allow for new unknown fields with warning 2022-05-27 17:07:39 -07:00
Kelly Brazil
1d0aebd836 add new fields 2022-05-27 16:54:49 -07:00
Kelly Brazil
8240626043 add idle status for newer top version support 2022-05-27 16:27:51 -07:00
Kelly Brazil
2cd14235c8 remove unnecessary pass line 2022-05-27 14:29:48 -07:00
Kelly Brazil
f774513554 add top-s tests 2022-05-27 14:29:33 -07:00
Kelly Brazil
388da9f003 remove try/except at end 2022-05-27 14:11:27 -07:00
Kelly Brazil
fa18243491 add check for top data 2022-05-27 13:48:13 -07:00
Kelly Brazil
5df1c1702b add top-s parser 2022-05-27 13:34:07 -07:00
Kelly Brazil
b6557802f4 change windows command prompt in docs 2022-05-27 08:54:37 -07:00
Kelly Brazil
15e3a511b6 doc update 2022-05-26 16:04:57 -07:00
Kelly Brazil
08fbde0e8f fix stdin stder quoting 2022-05-26 16:03:30 -07:00
Kelly Brazil
28ebb4e8dd fix notes 2022-05-26 15:54:39 -07:00
Kelly Brazil
04fda57cbe fix note 2022-05-26 15:11:58 -07:00
Kelly Brazil
b24495136c fix blockquotes 2022-05-26 15:07:54 -07:00
Kelly Brazil
7d3fa55571 doc update 2022-05-26 11:52:29 -07:00
Kelly Brazil
a76b5db8db doc update 2022-05-26 11:37:16 -07:00
Kelly Brazil
667dd01ac7 fix process table detection 2022-05-26 09:29:59 -07:00
Kelly Brazil
559bee962a add top tests 2022-05-26 09:19:47 -07:00
Kelly Brazil
9f977d06e0 fix asciitable parser for cases where centered rows cause misaligned fields 2022-05-26 08:57:35 -07:00
Kelly Brazil
f67a916940 add new parser counts to jc -a 2022-05-25 14:30:00 -07:00
Kelly Brazil
8a1308948f fix typo 2022-05-25 12:21:44 -07:00
Kelly Brazil
4e130d11a3 fix schema 2022-05-25 12:18:51 -07:00
Kelly Brazil
51aa5b268f fix for mem info in different units 2022-05-25 10:46:58 -07:00
Kelly Brazil
6869133f53 working top parser and doc update 2022-05-25 10:31:41 -07:00
Kelly Brazil
ad3d88e47f doc update 2022-05-25 08:14:14 -07:00
Kelly Brazil
6d29f8ba74 quiet option for warning messages 2022-05-25 07:37:21 -07:00
Kelly Brazil
c7cb89e91d more processing 2022-05-24 17:22:23 -07:00
Kelly Brazil
27f5118abd add top parser 2022-05-24 15:47:51 -07:00
Kelly Brazil
ac5a6e516d doc update 2022-05-23 15:12:14 -07:00
Kelly Brazil
5d5bfbc1d1 doc update 2022-05-23 13:58:24 -07:00
Kelly Brazil
9f4ba80000 refactor - create is_compatible function 2022-05-23 13:52:08 -07:00
Kelly Brazil
c21c334b73 version bump 2022-05-23 13:43:57 -07:00
Kelly Brazil
14093d9d43 Merge pull request #247 from kellyjonbrazil/yaml-dev
Yaml dev
2022-05-23 20:36:44 +00:00
Kelly Brazil
176ca2f75d docstring update 2022-05-23 13:16:57 -07:00
Kelly Brazil
cfb71c7dad add test for strings ending with colon 2022-05-22 09:13:32 -07:00
Kelly Brazil
722eab83b1 add Other Shell section 2022-05-21 07:00:43 -07:00
Kelly Brazil
d30edb2dae add yaml_out tests 2022-05-20 18:15:56 -07:00
Kelly Brazil
cba461ce8a remove JSONDecodeError detection 2022-05-20 17:48:52 -07:00
Kelly Brazil
f876505e25 add colors and ensure ascii on error 2022-05-20 17:22:56 -07:00
Kelly Brazil
5b9fcd5852 initial working yaml out 2022-05-20 14:51:23 -07:00
Kelly Brazil
8a122cd9e1 fix wiki language 2022-05-20 07:58:19 -07:00
Kelly Brazil
557e68225c add filtering capabilities for other shells 2022-05-19 11:16:25 -07:00
Kelly Brazil
dc0947b87e add other shell info. clean up parser table 2022-05-19 10:52:18 -07:00
Kelly Brazil
af2c06cd28 doc update 2022-05-15 22:28:12 -07:00
Kelly Brazil
67a4c6f797 add initial \n to first line of multiline fields 2022-05-15 22:23:00 -07:00
Kelly Brazil
0d1c857410 fix to keep first line of multiline field 2022-05-15 22:19:01 -07:00
Kelly Brazil
c7684dc94d allow multiline fields in pip-show 2022-05-15 22:06:43 -07:00
Kelly Brazil
a247572f64 changelog update 2022-05-15 20:49:41 -07:00
Kelly Brazil
306111303a Merge pull request #244 from kellyjonbrazil/master
Merge pull request #242 from kellyjonbrazil/dev sync to dev
2022-05-16 03:46:59 +00:00
Kelly Brazil
c12b48537a Merge pull request #242 from kellyjonbrazil/dev
Dev v1.19.0
2022-05-13 20:31:06 +00:00
Kelly Brazil
0bf69713ab Merge branch 'master' into dev 2022-05-13 20:26:12 +00:00
Kelly Brazil
c05f1475ed doc update 2022-05-13 13:23:14 -07:00
Kelly Brazil
416c262f02 remove top parsers 2022-05-13 13:17:16 -07:00
Kelly Brazil
40a5976f11 doc update 2022-05-13 12:45:27 -07:00
Kelly Brazil
dc582fbec8 fix for git-log coner cases 2022-05-13 12:44:01 -07:00
Kelly Brazil
7047f0a449 df fix for trailining newline char 2022-05-12 16:06:44 -07:00
Kelly Brazil
d7a884a567 doc update 2022-05-12 11:28:20 -07:00
Kelly Brazil
28de57792c formatting 2022-05-12 11:16:44 -07:00
Kelly Brazil
a230cdbd21 fix chage docs 2022-05-12 10:47:14 -07:00
Kelly Brazil
251a261679 add chage example 2022-05-11 18:56:13 -07:00
Kelly Brazil
3baef254fd maxsplit line 2022-05-11 18:47:56 -07:00
Kelly Brazil
9e69e928b2 add chage tests 2022-05-11 16:18:39 -07:00
Kelly Brazil
6eb595d2ca add chage parser 2022-05-11 16:12:29 -07:00
Kelly Brazil
acf07a5144 allow install on python 3.6 systems even though it is not supported 2022-05-11 08:00:05 -07:00
Kelly Brazil
7f53c58057 add ignore exception tests 2022-05-10 16:23:12 -07:00
Kelly Brazil
a069dc4855 add top -b parser 2022-05-10 16:08:56 -07:00
Kelly Brazil
febf544202 add git-log-s tests 2022-05-10 16:08:45 -07:00
Kelly Brazil
f2dd7b8815 doc update 2022-05-09 16:16:29 -07:00
Kelly Brazil
d758e37fe3 doc update 2022-05-09 16:10:41 -07:00
Kelly Brazil
9bc02a5623 doc update 2022-05-09 16:09:40 -07:00
Kelly Brazil
eb0ec265d0 Merge pull request #240 from fiskhest/master
Update README.md
2022-05-06 14:30:02 +00:00
fiskhest
1f236dc02a Update README.md 2022-05-06 16:20:33 +02:00
Kelly Brazil
86c279cbb2 add sep char test 2022-05-02 11:15:41 -07:00
Kelly Brazil
4a7f1bed3a doc update 2022-05-02 09:16:12 -07:00
Kelly Brazil
a730ae18c8 changelog update 2022-05-01 11:07:27 -07:00
Kelly Brazil
930bf439c0 check for separator characters in table cells. If detected, print a warning. 2022-05-01 11:04:35 -07:00
Kelly Brazil
f5f3133b87 add note about table column separators not being allowed in cell data 2022-05-01 10:27:34 -07:00
Kelly Brazil
cbca96de84 changelog update 2022-05-01 09:56:23 -07:00
Kelly Brazil
4d8ae3f124 doc update 2022-05-01 09:55:08 -07:00
Kelly Brazil
653127431d update plugin language 2022-04-29 06:50:37 -07:00
Kelly Brazil
22acef3765 generator to iterable object 2022-04-29 06:47:10 -07:00
Kelly Brazil
0d5bf11f0d change iterator to iterable 2022-04-29 06:42:11 -07:00
Kelly Brazil
a824ccaff3 add git-log-s parser 2022-04-28 16:23:56 -07:00
Kelly Brazil
97ac965ba5 version bump 2022-04-28 16:23:14 -07:00
Kelly Brazil
3e7f284df5 simplify streaming docs 2022-04-28 13:38:24 -07:00
Kelly Brazil
5c749fe26f simplify docs 2022-04-28 13:30:11 -07:00
Kelly Brazil
aa48b46f48 try page character 2022-04-28 11:09:19 -07:00
Kelly Brazil
6eaa4ae176 try arrow link 2022-04-28 11:05:43 -07:00
Kelly Brazil
60c330b342 move gentoo up 2022-04-28 10:59:12 -07:00
Kelly Brazil
fdeb994121 try using a table for parser list 2022-04-28 10:49:35 -07:00
Kelly Brazil
65ed92fe7b move safe_print_json. change argument from string to list_or_dict 2022-04-28 09:28:56 -07:00
Kelly Brazil
9c8730786b Merge pull request #238 from kellyjonbrazil/master
sync to dev
2022-04-28 16:21:22 +00:00
Kelly Brazil
7608823ea7 add git-log 2022-04-27 11:31:35 -07:00
Kelly Brazil
4f8c1a2ca2 version bump 2022-04-27 09:43:55 -07:00
Kelly Brazil
37489dd4e1 doc update 2022-04-27 09:10:38 -07:00
Kelly Brazil
a53aa1d0b8 fix bug when no slaves are present 2022-04-27 09:02:30 -07:00
Kelly Brazil
f7b64a5762 formatting 2022-04-27 08:26:12 -07:00
Kelly Brazil
9b1fe0d9a4 create safe_print_json function 2022-04-27 08:24:54 -07:00
Kelly Brazil
b876645fc5 doc update 2022-04-27 07:38:17 -07:00
Kelly Brazil
d9c0b8f8ad make _safe_print and _asciify private 2022-04-27 07:37:31 -07:00
Kelly Brazil
78d2b239c8 doc update 2022-04-26 17:51:30 -07:00
Kelly Brazil
5a12d98893 update history tests 2022-04-26 17:49:27 -07:00
Kelly Brazil
621f11e6f9 simplify history code 2022-04-26 17:46:16 -07:00
Kelly Brazil
8417f2fe4e use UTF-8 encoding in subprocess.Popen 2022-04-26 15:01:12 -07:00
Kelly Brazil
3ef2a0a065 rename j_data to j_string 2022-04-26 14:29:59 -07:00
Kelly Brazil
faec16d1f2 add line feed 2022-04-26 14:28:18 -07:00
Kelly Brazil
a4ef52b533 refactor try/except blocks to safe_print function 2022-04-26 14:25:34 -07:00
Kelly Brazil
0b407123c2 simplify json_out code 2022-04-26 10:18:49 -07:00
Kelly Brazil
98eedc69ec doc update 2022-04-26 09:57:50 -07:00
Kelly Brazil
dd231ae293 for for UnicodeEncodeError exception when printing JSON 2022-04-26 09:57:12 -07:00
Kelly Brazil
ad6196ddab Merge pull request #236 from kellyjonbrazil/dev
add gentoo to readme
2022-04-26 07:14:46 -07:00
Kelly Brazil
49ca0cecf4 Merge pull request #235 from mgorny/gentoo-install
Add Gentoo Linux install command
2022-04-26 07:10:47 -07:00
Michał Górny
148f2fb6db Add Gentoo Linux install command 2022-04-26 10:38:15 +02:00
Kelly Brazil
e04cd298fb version bump 2022-04-25 19:25:58 -07:00
Kelly Brazil
5bb4e2b4b6 revert f-string to regular string 2022-04-25 19:22:18 -07:00
Kelly Brazil
7b22db50d3 remove single quotes around asciified string 2022-04-25 18:50:36 -07:00
Kelly Brazil
fecb2193ae Merge pull request #234 from kellyjonbrazil/dev
Dev v1.18.7
2022-04-25 17:17:49 -07:00
Kelly Brazil
46af3bd0c0 add UnicodeError fix 2022-04-25 17:04:19 -07:00
Kelly Brazil
c245c89f82 don't try to detect locale, just asciify on exception 2022-04-25 16:51:00 -07:00
Kelly Brazil
a8f0cd9dae C locale fixes 2022-04-25 14:48:59 -07:00
Kelly Brazil
3101189d47 doc update 2022-04-25 08:39:33 -07:00
Kelly Brazil
3f0b644b85 fix test 2022-04-25 08:37:03 -07:00
Kelly Brazil
25c2c483f8 Merge pull request #233 from chriscroome/dev
Update name of alternative from name to alternative
2022-04-25 08:34:34 -07:00
Chris Croome
8bc2ea14a3 Whitespace fix 2022-04-25 11:20:36 +01:00
Chris Croome
8d4f22d9a5 Merge branch 'dev' of github.com:chriscroome/jc into dev 2022-04-25 11:16:47 +01:00
Chris Croome
d2adc2630c Use alternative rather than name to match manpage 2022-04-25 11:16:20 +01:00
Chris Croome
727f2b589e Use alternative rather than name toi match manpage 2022-04-25 11:14:18 +01:00
Kelly Brazil
abbfc92da0 clarify plugin filename requirements 2022-04-22 17:05:22 -07:00
Kelly Brazil
73b7e71cad add tests 2022-04-22 16:25:45 -07:00
Kelly Brazil
4825b16f07 doc update 2022-04-22 15:23:11 -07:00
Kelly Brazil
d2013366cc add update-alternatives examples 2022-04-22 15:20:20 -07:00
Kelly Brazil
96609a2c70 add update-alternatives --get-selections parser 2022-04-22 15:10:48 -07:00
Kelly Brazil
39306573da add update-alternatives parser 2022-04-22 14:47:07 -07:00
Kelly Brazil
01e330aa97 precompile regex patterns 2022-04-22 13:33:36 -07:00
Kelly Brazil
f08a74097d add tests 2022-04-22 12:12:45 -07:00
Kelly Brazil
79e37a7383 fix for oneline output 2022-04-22 12:12:38 -07:00
Kelly Brazil
3eebb6ee19 add update-alternatives parser info 2022-04-22 12:11:56 -07:00
Kelly Brazil
096fffdb79 use stat examples 2022-04-20 10:03:36 -04:00
Kelly Brazil
728d882ed0 add timestamp docs and examples 2022-04-20 09:50:19 -04:00
Kelly Brazil
b53e42aca6 add calculated timestamp 2022-04-20 09:44:42 -04:00
Kelly Brazil
477329ce5b add linefeed to version text 2022-04-20 08:26:26 -04:00
Kelly Brazil
283dc4efd5 add python interpreter version and path to -v and -a output 2022-04-19 17:44:15 -04:00
Kelly Brazil
d490bbcaa0 normalize add/update 2022-04-19 15:26:31 -04:00
Kelly Brazil
f49ddf8e5c doc update 2022-04-19 15:18:04 -04:00
Kelly Brazil
e1e341652b doc update 2022-04-19 15:10:40 -04:00
Kelly Brazil
ecda667549 process integers 2022-04-19 15:10:35 -04:00
Kelly Brazil
a0d96a188a doc update 2022-04-19 14:45:20 -04:00
Kelly Brazil
6c0f0cddfe fix for datetime objects in yaml files 2022-04-19 14:43:47 -04:00
Kelly Brazil
c7173ecd89 fix mypy issues 2022-04-19 14:34:53 -04:00
Kelly Brazil
e98240c905 extend instead of append list 2022-04-19 14:20:44 -04:00
Kelly Brazil
6cb7e25974 add docs 2022-04-19 13:17:24 -04:00
Kelly Brazil
c37980c05c add stat support 2022-04-19 13:17:16 -04:00
Kelly Brazil
b5943bd39d initial docstring 2022-04-19 10:32:55 -04:00
Kelly Brazil
49a3a7db3b initial git-log parser 2022-04-19 09:30:38 -04:00
Kelly Brazil
0c55240e9d move test templates to fix test failures on some systems 2022-04-13 10:54:28 -07:00
Kelly Brazil
f91988aed5 iterator -> iterable 2022-04-12 14:22:06 -07:00
Kelly Brazil
3c3ad9fc6a iterator -> iterable in doc 2022-04-12 14:20:58 -07:00
Kelly Brazil
291ab79e22 fix arch linux command 2022-04-12 11:07:34 -07:00
Kelly Brazil
e6d5892c14 Merge pull request #226 from kellyjonbrazil/master
sync to dev
2022-04-12 11:02:37 -07:00
Kelly Brazil
dcca7a57d5 Merge pull request #225 from adrianteri/patch-1
Update README
2022-04-12 11:00:51 -07:00
003
4ee8a69337 Update README
Specify the Arch package is in the AUR and NOT in the standard Archlinux repositories.
2022-04-12 20:53:39 +03:00
Kelly Brazil
c0414e7db7 clean up background tasks 2022-04-10 17:18:20 -07:00
Kelly Brazil
a419175fe6 enhance parallelization 2022-04-10 17:14:34 -07:00
Kelly Brazil
cd6dead034 man page update 2022-04-10 16:54:34 -07:00
Kelly Brazil
45342ea9fe parallelize doc gneration 2022-04-10 16:54:22 -07:00
Kelly Brazil
585bf0e159 xrandr update 2022-04-10 10:32:51 -07:00
Kelly Brazil
3a860b9bab add rotation field 2022-04-10 10:31:13 -07:00
Kelly Brazil
269180df77 Merge pull request #223 from anekos/fix/support-rotated-devices
Fix/support rotated devices
2022-04-10 10:19:50 -07:00
anekos
a1afed8d95 doc update 2022-04-10 19:53:37 +09:00
anekos
e39f150a21 Support rotated devices 2022-04-10 19:53:37 +09:00
Kelly Brazil
e85f11c6fc doc formatting 2022-04-04 12:00:41 -07:00
Kelly Brazil
49a9d7b07e doc update 2022-04-04 11:42:16 -07:00
Kelly Brazil
a2ef9c429e allow duplicate keys 2022-04-04 11:38:52 -07:00
Kelly Brazil
d5e9074f1c version bump 2022-04-04 11:38:04 -07:00
Kelly Brazil
774699f085 Merge pull request #220 from kellyjonbrazil/master
sync to dev
2022-04-04 18:21:15 +00:00
Kelly Brazil
7138eef3d1 fix newline chars in doc 2022-03-30 14:39:56 -07:00
Kelly Brazil
fad5e544aa formatting 2022-03-29 09:58:44 -07:00
Kelly Brazil
64757e2cf5 doc formatting 2022-03-29 09:35:54 -07:00
Kelly Brazil
e05be3f08b Merge pull request #213 from kellyjonbrazil/dev
Dev v1.18.6
2022-03-25 22:36:05 +00:00
Kelly Brazil
789f0735df doc update 2022-03-25 15:32:37 -07:00
Kelly Brazil
34bc775317 doc update 2022-03-25 15:32:11 -07:00
Kelly Brazil
38de059a1b doc update 2022-03-24 16:58:45 -07:00
Kelly Brazil
304ae6268f minor optimization by changing the expression order 2022-03-24 16:58:39 -07:00
Kelly Brazil
978caf4522 minor optimization by reordering expressions 2022-03-24 12:37:46 -07:00
Kelly Brazil
17df5bfcfc cache _is_separator function 2022-03-24 11:58:13 -07:00
Kelly Brazil
5e6a5068cf allow iterables for simple table parser 2022-03-24 11:57:01 -07:00
Kelly Brazil
619de68a61 formatting 2022-03-24 09:39:53 -07:00
Kelly Brazil
6748c3cc91 remove lines from corner detection and add rounded corners 2022-03-24 09:31:12 -07:00
Kelly Brazil
0a462978b7 fix for special characters in headers 2022-03-23 15:08:33 -07:00
Kelly Brazil
e66a82ff49 doc update 2022-03-23 10:50:34 -07:00
Kelly Brazil
f3aa797d96 add more pretty table separators 2022-03-22 17:47:19 -07:00
Kelly Brazil
e5b478218c add quiet=True to parse tests 2022-03-22 16:05:07 -07:00
Kelly Brazil
35e0e9c32a remove print statement 2022-03-22 15:57:43 -07:00
Kelly Brazil
17c3c2f029 add bold bar seperator and ANSI code tests 2022-03-22 15:55:59 -07:00
Kelly Brazil
cf83e6398b add fancy separators 2022-03-22 15:13:07 -07:00
Kelly Brazil
94e061b881 add asciitable parser tests 2022-03-22 14:53:34 -07:00
Kelly Brazil
720480e39c doc update 2022-03-22 13:21:10 -07:00
Kelly Brazil
82a63fe159 doc update 2022-03-22 12:42:07 -07:00
Kelly Brazil
9c1ec9940e doc update 2022-03-22 12:35:56 -07:00
Kelly Brazil
f23f19da45 doc update 2022-03-22 12:25:59 -07:00
Kelly Brazil
aea2e1b0a9 fix tests so blank strings are now None 2022-03-22 12:25:51 -07:00
Kelly Brazil
7d95d679bf add asciitable parser 2022-03-22 12:25:24 -07:00
Kelly Brazil
b3b140066b doc update 2022-03-22 07:21:19 -07:00
Kelly Brazil
b204c423c1 doc update 2022-03-22 07:05:14 -07:00
Kelly Brazil
d451c309bb change multiple or statements to any() 2022-03-22 06:30:07 -07:00
Kelly Brazil
01d53da68e remove debug print 2022-03-21 19:11:27 -07:00
Kelly Brazil
53dd05e52c fix rstrip and add tests 2022-03-21 19:10:02 -07:00
Kelly Brazil
ab564f5be8 add tests 2022-03-21 17:57:14 -07:00
Kelly Brazil
00c39450f9 enhance type annotation 2022-03-21 13:36:54 -07:00
Kelly Brazil
f611d08b50 formatting 2022-03-21 13:33:35 -07:00
Kelly Brazil
90e79b7df3 formatting 2022-03-21 13:27:44 -07:00
Kelly Brazil
4eb2d725d5 formatting 2022-03-21 13:09:50 -07:00
Kelly Brazil
51ae5ebcac new streamlined parser 2022-03-21 13:06:34 -07:00
Kelly Brazil
9ecbdb0916 use generator instead of iterable in function return annotation 2022-03-20 10:16:29 -07:00
Kelly Brazil
b3a2886fd0 formatting 2022-03-20 10:12:29 -07:00
Kelly Brazil
ceacec0f46 remove errant os sep import 2022-03-18 16:57:47 -07:00
Kelly Brazil
ff0f794b01 working 2022-03-18 16:53:23 -07:00
Kelly Brazil
70fafbf3f8 remove asciitable so tests pass for now 2022-03-18 14:19:00 -07:00
Kelly Brazil
5a248a8fc5 add multiline asciitable parser 2022-03-18 13:05:57 -07:00
Kelly Brazil
4a3a4e10df add asciitable and asciitable-m parsers 2022-03-18 13:03:43 -07:00
Kelly Brazil
c27bd5ff39 pad lines in sparse_table_parse and use str.isspace() 2022-03-17 16:24:18 -07:00
Kelly Brazil
f804c9627f copy input list so we don't mutate the caller's data 2022-03-15 16:04:58 -07:00
Kelly Brazil
3ab25d02f9 use _parser_is_streaming from lib 2022-03-14 12:30:09 -07:00
Kelly Brazil
9e80fd2b97 fallback if info and doc items don't exist 2022-03-14 12:17:18 -07:00
Kelly Brazil
ff9527a098 import cleanup and use all_parser_info in parsers_text 2022-03-14 11:35:57 -07:00
Kelly Brazil
7dac2f8dc3 doc update 2022-03-14 10:50:10 -07:00
Kelly Brazil
32e4d55e86 use parser_info for help_doc 2022-03-14 10:46:54 -07:00
Kelly Brazil
f9a9062147 add documentation argument to parser_info and all_parser_info 2022-03-14 10:46:23 -07:00
Kelly Brazil
89e5919796 add -A to second example 2022-03-14 09:56:50 -07:00
Kelly Brazil
e5f5b2591d changelog update 2022-03-14 09:45:17 -07:00
Kelly Brazil
77c667eec0 ubuntu fixes 2022-03-14 09:43:18 -07:00
Kelly Brazil
b257ce8c2f add mpstat_s tests 2022-03-13 12:25:50 -07:00
Kelly Brazil
c693c868ca add mpstat streaming parser 2022-03-11 15:59:38 -08:00
Kelly Brazil
6f98b27a05 add mpstat tests 2022-03-11 15:33:31 -08:00
Kelly Brazil
d7efd25d88 add mpstat to docs 2022-03-11 14:54:06 -08:00
Kelly Brazil
2cddb1f0bb working mpstat 2022-03-11 14:00:19 -08:00
Kelly Brazil
ae1c331595 initial working version 2022-03-11 13:15:39 -08:00
Kelly Brazil
bc97052ed4 initial add mpstat parser 2022-03-11 12:37:17 -08:00
Kelly Brazil
6c3e0e2aa0 formatting 2022-03-11 12:37:01 -08:00
Kelly Brazil
dd052e0146 add underscores to column examples 2022-03-11 10:25:24 -08:00
Kelly Brazil
54e8f58145 add table result examples 2022-03-10 16:50:55 -08:00
Kelly Brazil
def7aa5764 formatting 2022-03-10 15:36:11 -08:00
Kelly Brazil
6986c74f6d remove direct parser module example from doc 2022-03-10 15:18:27 -08:00
Kelly Brazil
b784db404d streaming doc formatting update 2022-03-10 13:32:26 -08:00
Kelly Brazil
8aee4517bb doc formatting 2022-03-10 13:02:50 -08:00
Kelly Brazil
a5fb8fbf94 streaming doc update 2022-03-10 10:10:57 -08:00
Kelly Brazil
b9365e2ac2 add pidstat-s tests 2022-03-10 09:23:36 -08:00
Kelly Brazil
696338c1a3 add streaming test template 2022-03-10 09:04:12 -08:00
Kelly Brazil
4f0616190b doc update 2022-03-10 08:14:58 -08:00
Kelly Brazil
3278cb0de3 add type hints 2022-03-10 08:14:46 -08:00
Kelly Brazil
4fc04256a5 rollback noReturn to tuple 2022-03-10 08:00:37 -08:00
Kelly Brazil
e4ae0fea63 fix type annotation 2022-03-09 16:28:55 -08:00
Kelly Brazil
d3727ea090 doc update 2022-03-09 16:09:35 -08:00
Kelly Brazil
0d13909cf6 add pidstat-s parser 2022-03-09 16:07:29 -08:00
Kelly Brazil
c52ca20e28 fix comment 2022-03-09 16:07:17 -08:00
Kelly Brazil
21f27f26c8 add pidstat tests 2022-03-09 15:37:10 -08:00
Kelly Brazil
5e7a87f397 add test template 2022-03-09 15:37:04 -08:00
Kelly Brazil
845d763829 format docs to fit 80 columns 2022-03-09 15:09:22 -08:00
Kelly Brazil
f5c7d52ec7 formatting 2022-03-09 14:43:56 -08:00
Kelly Brazil
c3198a5874 formatting 2022-03-09 14:17:48 -08:00
Kelly Brazil
bbd4afa735 add pidstat to docs 2022-03-09 14:09:58 -08:00
Kelly Brazil
ae754a84bf doc update 2022-03-09 14:06:34 -08:00
Kelly Brazil
3389eb5deb initial working parser 2022-03-09 13:18:04 -08:00
Kelly Brazil
01f2c1e71f add pidstat parser 2022-03-09 12:13:32 -08:00
Kelly Brazil
8bfbf8f1bc simplify error message 2022-03-09 12:13:07 -08:00
Kelly Brazil
f4242669ba minor cleanup 2022-03-09 10:52:40 -08:00
Kelly Brazil
bebd9331f1 Merge pull request #211 from kellyjonbrazil/master
sync to dev
2022-03-09 18:49:01 +00:00
Kelly Brazil
ac61e9ad2c add pypi link 2022-03-08 13:21:05 -08:00
Kelly Brazil
648ef4d8a9 update badge links 2022-03-08 13:19:20 -08:00
Kelly Brazil
727fc9a701 doc update 2022-03-05 15:19:25 -08:00
Kelly Brazil
306512d6bb force AM/PM to uppercase in date parser 2022-03-05 15:13:47 -08:00
Kelly Brazil
6afb1d389c Merge pull request #209 from kellyjonbrazil/dev
Dev v1.18.4
2022-03-05 21:49:36 +00:00
Kelly Brazil
9861983481 doc update 2022-03-05 13:45:28 -08:00
Kelly Brazil
ca79053db0 document pydoc version 2022-03-05 12:15:47 -08:00
Kelly Brazil
29c263f878 pydoc formatting fixes 2022-03-05 12:15:14 -08:00
Kelly Brazil
128c3c170a doc update 2022-03-04 16:38:49 -08:00
Kelly Brazil
a531ab8864 formatting 2022-03-04 16:35:06 -08:00
Kelly Brazil
0c1be7cc11 reduce dig example size 2022-03-04 16:29:36 -08:00
Kelly Brazil
e4222b45f5 fix names to mod names 2022-03-04 16:24:13 -08:00
Kelly Brazil
ac32c69c31 formatting 2022-03-04 13:35:16 -08:00
Kelly Brazil
cb2dfeac8d change name to JSON Convert 2022-03-04 13:27:39 -08:00
Kelly Brazil
9a3602e70b doc update 2022-03-04 08:57:11 -08:00
Kelly Brazil
a9f53ee258 optimize streaming parser detection in cli 2022-03-03 17:50:19 -08:00
Kelly Brazil
6be3d3d982 doc update 2022-03-03 17:38:47 -08:00
Kelly Brazil
e49df72083 use streaming parser list to find streaming parsers 2022-03-03 17:37:01 -08:00
Kelly Brazil
7ede7be7bf add standard and streaming list functions 2022-03-03 17:36:40 -08:00
Kelly Brazil
4758e28a36 formatting 2022-03-02 15:24:18 -08:00
Kelly Brazil
4a1ee151b3 add dhcp6 options to docs 2022-03-02 10:57:09 -08:00
Kelly Brazil
8c8afc1a92 formatting 2022-03-02 10:15:01 -08:00
Kelly Brazil
ed205f7720 doc update 2022-02-28 12:55:05 -08:00
Kelly Brazil
d65f7ae992 add nmcli 2022-02-28 12:26:06 -08:00
Kelly Brazil
e2ffef57b9 fix test 2022-02-28 12:20:39 -08:00
Kelly Brazil
002caa9fb3 add fedora tests 2022-02-28 12:19:02 -08:00
Kelly Brazil
b7c6faf3da enhance error message 2022-02-25 11:23:20 -08:00
Kelly Brazil
554ca61d17 add tests 2022-02-25 11:19:20 -08:00
Kelly Brazil
7b9722d255 fix formatting 2022-02-24 21:21:02 -08:00
Kelly Brazil
5505bde8ef doc update 2022-02-24 20:53:54 -08:00
Kelly Brazil
dbcd9a4060 bump version to 1.0 2022-02-24 20:52:28 -08:00
Kelly Brazil
4bdeb2b3aa simplify warning message 2022-02-24 20:52:18 -08:00
Kelly Brazil
6ae1d03187 doc fix 2022-02-24 20:47:15 -08:00
Kelly Brazil
f75b06abe4 doc update 2022-02-24 20:43:20 -08:00
Kelly Brazil
1923925710 update changelog 2022-02-24 20:35:00 -08:00
Kelly Brazil
2c5c57ae04 version bump 2022-02-24 20:33:10 -08:00
Kelly Brazil
f4d11d697e finish use cases and doc 2022-02-24 20:31:58 -08:00
Kelly Brazil
7f409b7082 enhance ParseError cli message 2022-02-24 20:31:09 -08:00
Kelly Brazil
937fa5aad2 split dhcp options 2022-02-24 18:22:19 -08:00
Kelly Brazil
19dcef5135 firm up flow. add/remove text. parse routes 2022-02-24 17:10:39 -08:00
Kelly Brazil
3d01356461 add text_kv function 2022-02-24 14:53:26 -08:00
Kelly Brazil
2d6f666fa4 add dev show and conn show parsers 2022-02-24 12:21:13 -08:00
Kelly Brazil
4dda895f12 initial nmcli parser 2022-02-24 11:25:14 -08:00
Kelly Brazil
52617b1722 Merge pull request #208 from kellyjonbrazil/master
sync to dev
2022-02-21 16:35:12 +00:00
Kelly Brazil
961968a0fc fix schema 2022-02-14 15:14:22 -08:00
Kelly Brazil
f026a788e5 add xrandr example 2022-02-14 11:30:03 -08:00
Kelly Brazil
2f7c03eb35 Merge pull request #207 from kellyjonbrazil/dev
Dev v1.18.3
2022-02-14 10:36:08 -08:00
Kelly Brazil
3afaa48eee doc update 2022-02-14 10:31:41 -08:00
Kelly Brazil
3201452564 add -p to example 2022-02-14 10:06:09 -08:00
Kelly Brazil
7ee1e34fc7 doc update 2022-02-14 10:03:52 -08:00
Kelly Brazil
67dbf05016 add type annotations 2022-02-14 09:58:31 -08:00
Kelly Brazil
4ac9f2e3da doc update 2022-02-14 09:37:37 -08:00
Kelly Brazil
3f5f6e39a7 formatting 2022-02-14 09:20:16 -08:00
Kelly Brazil
4723db8e3c doc updates 2022-02-14 09:14:46 -08:00
Kelly Brazil
ca914ec77d add nodata test 2022-02-14 09:14:38 -08:00
Kelly Brazil
dcc7f3f357 Merge pull request #204 from lyterk/xrandr
New parser: xrandr
2022-02-13 17:45:53 -08:00
Kevin Lyter
cbdc666236 Return empty object if no results and filenames
- If no results are returned, return {} instead of {"screens": [],
"unassociated_devices": []}
- simple_xrandr -> xrandr_simple
2022-02-09 22:06:23 -08:00
Kelly Brazil
184ef3a1fa doc update 2022-02-08 14:45:33 -08:00
Kelly Brazil
c732f75944 doc update 2022-02-08 14:43:14 -08:00
Kelly Brazil
7a1ae4f5fc add library tests 2022-02-08 13:32:22 -08:00
Kelly Brazil
d04bc3757c add xrandr 2022-02-08 07:33:26 -08:00
Kelly Brazil
73e8391653 formatting 2022-02-07 16:58:06 -08:00
Kelly Brazil
f6c1463c15 formatting 2022-02-07 16:31:43 -08:00
Kelly Brazil
d392c7f901 doc update 2022-02-07 15:44:54 -08:00
Kelly Brazil
d0387f5820 add timestamp format hints for better performance 2022-02-07 15:44:46 -08:00
Kelly Brazil
76f92908a3 add format hints for performance optimization 2022-02-07 15:43:24 -08:00
Kelly Brazil
1a115da67b add lru_cache maxsize for python 3.7 support 2022-02-07 08:34:34 -08:00
Kelly Brazil
f0a37ccf30 use lru_cache for significant performance boost to timestamp 2022-02-07 08:30:11 -08:00
Kelly Brazil
f331f53a53 use !r formatting instead of quotes 2022-02-07 08:06:48 -08:00
Kelly Brazil
8611aff06b add examples 2022-02-07 06:42:35 -08:00
Kelly Brazil
2f3f78e8d3 refine streaming parsers 2022-02-07 06:29:17 -08:00
Kelly Brazil
d1e0ee6123 use new streaming functions 2022-02-06 08:56:18 -08:00
Kelly Brazil
45314c9808 move some functions to streaming 2022-02-06 08:55:42 -08:00
Kelly Brazil
df00945b46 move try/except inside for loop 2022-02-04 16:03:44 -08:00
Kelly Brazil
fda0050d86 add rsync-s tests 2022-02-04 14:39:45 -08:00
Kelly Brazil
a76d46f9ec refactor ignore_exceptions 2022-02-04 12:14:16 -08:00
Kevin Lyter
6b069a82d0 Add xrandr to lib.py 2022-02-03 22:40:40 -08:00
Kevin Lyter
6b793d0521 Clean up types
* | operator => Union[]
* Remove unused import Iterator
* Remove comment
2022-02-03 22:40:35 -08:00
Kevin Lyter
ce9103f7cc Delete old files in template folder 2022-02-03 18:12:46 -08:00
Kelly Brazil
671d6dee36 doc update 2022-02-03 15:47:46 -08:00
Kelly Brazil
49929c714c add add_jc_meta decorator 2022-02-03 15:44:18 -08:00
Kelly Brazil
2986771f07 require python v3.7 and above since v3.6 is now deprecated 2022-02-03 09:21:20 -08:00
Kevin Lyter
520082d963 New parser: xrandr
Tests passing, working as intended in plugin directory
2022-02-02 20:33:25 -08:00
Kelly Brazil
021e296d45 move variable inits and regexes up 2022-02-02 17:06:20 -08:00
Kelly Brazil
42e56fbcea move regex up 2022-02-02 17:05:53 -08:00
Kelly Brazil
a5b62a4055 add processing and docs 2022-02-02 16:03:14 -08:00
Kelly Brazil
be98c9b7f6 simplify try/except by moving outside for loop 2022-02-02 15:59:12 -08:00
Kelly Brazil
aceeb84507 doc update 2022-02-02 15:58:29 -08:00
Kelly Brazil
1391063217 first draft rsync streaming parser 2022-02-02 11:49:39 -08:00
Kelly Brazil
52157addd0 fix compatible list 2022-02-02 11:49:24 -08:00
Kelly Brazil
ec0bc6615e formatting 2022-02-01 19:20:19 -08:00
Kelly Brazil
2f80800e38 simplify all_parser_info comprehension 2022-02-01 19:06:41 -08:00
Kelly Brazil
3959d3347c doc update 2022-02-01 18:33:07 -08:00
Kelly Brazil
b57d25c69a clean up return type for parser_info 2022-02-01 18:30:37 -08:00
Kelly Brazil
63e43a7cab doc updates 2022-02-01 17:57:12 -08:00
Kelly Brazil
21719f9a26 type annotation updates 2022-02-01 17:54:22 -08:00
Kelly Brazil
96ec70de4f remove unneeded optional 2022-02-01 17:18:55 -08:00
Kelly Brazil
a15a1967dc fix typo 2022-02-01 17:18:39 -08:00
Kelly Brazil
a10d756629 fixy mypy issues 2022-02-01 16:49:31 -08:00
Kelly Brazil
0700dc7a64 remove cygwin from compatible 2022-02-01 16:42:51 -08:00
Kelly Brazil
ca654b2140 fix parser order 2022-02-01 16:42:10 -08:00
Kelly Brazil
4ff3b87c1c remove future field from docstring 2022-02-01 16:18:38 -08:00
Kelly Brazil
ea244fb7a9 formatting 2022-02-01 16:17:03 -08:00
Kelly Brazil
8061f30e6f add centos -i nochange test 2022-02-01 16:16:33 -08:00
Kelly Brazil
8f3b12e81e add fixes for mac -i output 2022-02-01 14:52:51 -08:00
Kelly Brazil
d0694ce0db add nochange log test for mac 2022-02-01 14:20:53 -08:00
Kelly Brazil
0cd4c4bc7f add nochange tests 2022-02-01 13:58:51 -08:00
Kelly Brazil
12f90c349c update regexes for unchanged files 2022-02-01 13:54:25 -08:00
Kelly Brazil
26b8a1f167 remove packages from binaries and packages header 2022-02-01 09:58:18 -08:00
Kelly Brazil
3abe382c06 add examples 2022-01-31 16:01:42 -08:00
Kelly Brazil
1e2edc2c7b add timestamp 2022-01-31 15:54:05 -08:00
Kelly Brazil
5fe032a674 fix typo 2022-01-31 13:44:44 -08:00
Kelly Brazil
e825c02df1 add rsync tests 2022-01-31 13:23:31 -08:00
Kelly Brazil
a4a4d170b5 update docstring 2022-01-31 13:23:22 -08:00
Kelly Brazil
d0fcd523cb fix process conversions 2022-01-31 11:13:23 -08:00
Kelly Brazil
f72b7dc75d change keyname to files and remove future key 2022-01-30 16:37:45 -08:00
Kelly Brazil
4101dc6bf7 add log-file support 2022-01-30 16:21:03 -08:00
Kelly Brazil
ea5011b616 updated schema. add log-file option support 2022-01-29 17:24:43 -08:00
Kelly Brazil
d6de81747f add int/float conversions 2022-01-28 15:00:05 -08:00
Kelly Brazil
38f04b1c96 add summary 2022-01-28 14:45:01 -08:00
Kelly Brazil
84169e1a91 add rsync parser 2022-01-28 14:08:43 -08:00
Kelly Brazil
1f96586a5e reorder imports 2022-01-28 14:08:21 -08:00
Kelly Brazil
681176e4c9 Merge pull request #203 from kellyjonbrazil/dev
Dev v1.18.2
2022-01-27 16:53:37 -08:00
Kelly Brazil
8bb2663522 date update 2022-01-27 16:49:46 -08:00
Kelly Brazil
663abf3139 clean up scripts 2022-01-27 16:14:14 -08:00
Kelly Brazil
f7ac41db95 final doc update 2022-01-27 13:27:50 -08:00
Kelly Brazil
5502cda9e5 add additional test for dict inside list for all_parser_info() 2022-01-27 13:03:02 -08:00
Kelly Brazil
a2b165565f add lib tests for new functions 2022-01-27 12:54:44 -08:00
Kelly Brazil
b426369815 use all_parser_info() from lib in about function 2022-01-27 07:45:20 -08:00
Kelly Brazil
ac0840cc0a fix typo 2022-01-26 20:51:18 -08:00
Kelly Brazil
ee98ab0a4a doc update 2022-01-26 20:42:20 -08:00
Kelly Brazil
2adec2c003 update type hints with mypy help 2022-01-26 20:40:03 -08:00
Kelly Brazil
f19c9c71bf add type hints 2022-01-26 18:39:14 -08:00
Kelly Brazil
e93adf1884 fix doc 2022-01-26 18:09:30 -08:00
Kelly Brazil
254c4fc507 add new functions 2022-01-26 18:05:00 -08:00
Kelly Brazil
74d5f60d14 update console interview description 2022-01-26 17:17:40 -08:00
Kelly Brazil
db7dc0634b make **kwargs optional 2022-01-26 17:12:35 -08:00
Kelly Brazil
e156b0db45 add type hints 2022-01-26 17:08:03 -08:00
Kelly Brazil
50adc05fbd formatting 2022-01-26 16:58:48 -08:00
Kelly Brazil
446cac7c21 doc update 2022-01-26 16:55:39 -08:00
Kelly Brazil
28ffe3076b formatting 2022-01-26 16:34:23 -08:00
Kelly Brazil
d4d5e206ca type hints update 2022-01-26 15:54:36 -08:00
Kelly Brazil
42fbe40a4a simplify type hints 2022-01-26 15:54:18 -08:00
Kelly Brazil
27e4a120e2 remove trailing comma 2022-01-26 15:31:18 -08:00
Kelly Brazil
b5d5b7c73a remove private classes 2022-01-26 15:01:42 -08:00
Kelly Brazil
e7471556ba remove sed lines 2022-01-26 14:39:11 -08:00
Kelly Brazil
640a21341b fix indentation 2022-01-26 14:38:57 -08:00
Kelly Brazil
f5befad3e4 move docstring under __init__ 2022-01-26 14:21:06 -08:00
Kelly Brazil
f8223023c3 change header depth 2022-01-26 14:16:04 -08:00
Kelly Brazil
7028e87f9b remove TOC for parsers 2022-01-26 13:03:51 -08:00
Kelly Brazil
590728f9c1 try new pydoc-markdown formatting options 2022-01-26 11:50:25 -08:00
Kelly Brazil
7cc147fe2d increase heading size 2022-01-25 19:28:37 -08:00
Kelly Brazil
3cfb3965bb formatting 2022-01-25 19:28:04 -08:00
Kelly Brazil
155d421322 formatting 2022-01-25 19:18:54 -08:00
Kelly Brazil
d3e10bb87b add lsusb docs 2022-01-25 18:59:40 -08:00
Kelly Brazil
fd5433ee62 parse docstring formatting 2022-01-25 18:58:09 -08:00
Kelly Brazil
4568f2d06e formatting for parse docstring 2022-01-25 18:51:56 -08:00
Kelly Brazil
c36e513d1b formatting 2022-01-25 18:42:55 -08:00
Kelly Brazil
8e089baf3f remove info class from docs 2022-01-25 18:38:26 -08:00
Kelly Brazil
386f6c317e update markdown processor settings 2022-01-25 18:03:34 -08:00
Kelly Brazil
75cd84ce8a try new markdown conversion 2022-01-25 17:07:47 -08:00
Kelly Brazil
6fad44e35d fix type hint 2022-01-25 16:28:29 -08:00
Kelly Brazil
1caac750da Update type hints 2022-01-25 16:27:29 -08:00
Kelly Brazil
16370dcb3d update type hints 2022-01-25 15:49:48 -08:00
Kelly Brazil
c1302f2573 add type-hints to public api 2022-01-25 15:49:31 -08:00
Kelly Brazil
6f0ffe0955 docu update 2022-01-25 15:48:00 -08:00
Kelly Brazil
1f89745fe7 version bump 2022-01-25 11:17:18 -08:00
Kelly Brazil
a46ac18ef7 doc update 2022-01-25 10:47:05 -08:00
Kelly Brazil
1a05f1c575 add parser info functions. move _get_parser functionality from cli to lib 2022-01-25 10:46:58 -08:00
Kelly Brazil
08f818aa42 Merge pull request #199 from kellyjonbrazil/master
sync to dev
2022-01-25 00:45:53 +00:00
Kelly Brazil
b3896650c2 revert column formatting 2022-01-23 13:40:50 -08:00
Kelly Brazil
f285539526 conform to 80 columns 2022-01-23 13:36:22 -08:00
Kelly Brazil
a896dcdf3b formatting 2022-01-23 13:14:00 -08:00
Kelly Brazil
0a187d4ed0 add console interview links 2022-01-23 10:04:19 -08:00
Kelly Brazil
2d65bc57d5 add quotes 2022-01-21 16:58:45 -08:00
Kelly Brazil
ab63809fde update description 2022-01-21 16:13:00 -08:00
Kelly Brazil
6f04707dc6 add python package doc info to top of page 2022-01-21 15:33:43 -08:00
Kelly Brazil
d14a86a9b5 fix typo 2022-01-21 15:29:46 -08:00
Kelly Brazil
8e6a31d3da minor fix for macOS binary 2022-01-21 14:08:19 -08:00
1147 changed files with 471174 additions and 7696 deletions

View File

@@ -13,11 +13,11 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10"]
os: [macos-latest, ubuntu-20.04, windows-latest]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: "Set up timezone to America/Los_Angeles"
uses: szenius/set-timezone@v1.0
with:
@@ -25,7 +25,7 @@ jobs:
timezoneMacos: "America/Los_Angeles"
timezoneWindows: "Pacific Standard Time"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies

294
CHANGELOG
View File

@@ -1,5 +1,247 @@
jc changelog
20221230 v1.22.4
- Add `iwconfig` command parser
- Add NeXTSTEP format support to the PLIST file parser
- Fix `proc` parser magic signature detection for `/proc/pid/stat` hacks
- Fix `x509-cert` parser for string serial numbers
- Add category tags to parser metadata: generic, standard, file, string, binary, command
- Add "list parsers by category" view to help
- Fix python 3.6-related issues
- Add python 3.6 to automated tests
20221216 v1.22.3
- Add Common Log Format and Combined Log Format file parser (standard and streaming)
- Add PostgreSQL password file parser
- Add openvpn-status.log file parser
- Add `cbt` command parser (Google Big Table)
- Enhance `ifconfig` parser with interface lane information on BSD
- Enhance `ifconfig` parser with additional IPv6 `scope_id` info for BSD
- Fix `ifconfig` parser to capture some IPv6 addresses missed on BSD
- Fix `git-log` and `git-log-s` parsers for failure on empty author name
- Update `os-prober` parser with split EFI partition fields
- Add ISO string attribute (`.iso`) to `jc.utils.timestamp()`
- Fix several documentation typos
20221107 v1.22.2
- add `sshd_conf` parser for `sshd` configuration files and `sshd -T` output
- add `findmnt` command parser
- add `git ls-remote` command parser
- add `os-prober` command parser
- add SemVer string parser
- enhance the `ifconfig` parser so it can output multiple IPv4 and IPv6 addresses
- enhance the `ifconfig` parser so it can output additional fields common on BSD
- enhance `xml` parser with optional `_` prefix for attributes instead of
`@` by using the `--raw` option. This can make it easier to filter the
JSON output in some tools.
- fix the `xml` parser to output a normal Dictionary instead of OrderdDict.
This cleans up YAML output. (No `!!omap` comments)
- fix `csv` and `csv-s` parsers for UTF-8 encoded CSV files with leading BOM bytes
- fix exit code to be non-zero on interrupt
- allow parser module objects to be used as arguments to `jc.get_help()` and `jc.parser_info()`
- catch unexpected exceptions in the CLI
- add error message on interrupt to STDERR
- add python 3.11 tests to github actions
20221024 v1.22.1
- add `udevadm` command parser
- add `lspci` command parser
- add `pci.ids` file parser
- fix `proc-pid-stat` parser for command names with spaces and newlines
- enhance `ip-address` parser to add `ip_split` field
- rename `iso-datetime` parser to `datetime-iso`. A deprecation warning will
display until `iso-datetime` is removed in a future version.
- refactor cli module
- optimize performance of calculated timestamps
- add more type annotations
- add support for deprecating parsers
- move jc-web demo site from heroku to render.com
20220926 v1.22.0
- Add /proc file parsers for linux. Support for the following files:
`/proc/buddyinfo`
`/proc/consoles`
`/proc/cpuinfo`
`/proc/crypto`
`/proc/devices`
`/proc/diskstats`
`/proc/filesystems`
`/proc/interrupts`
`/proc/iomem`
`/proc/ioports`
`/proc/loadavg`
`/proc/locks`
`/proc/meminfo`
`/proc/modules`
`/proc/mtrr`
`/proc/pagetypeinfo`
`/proc/partitions`
`/proc/slabinfo`
`/proc/softirqs`
`/proc/stat`
`/proc/swaps`
`/proc/uptime`
`/proc/version`
`/proc/vmallocinfo`
`/proc/vmstat`
`/proc/zoneinfo`
`/proc/driver/rtc`
`/proc/net/arp`
`/proc/net/dev`
`/proc/net/dev_mcast`
`/proc/net/if_inet6`
`/proc/net/igmp`
`/proc/net/igmp6`
`/proc/net/ipv6_route`
`/proc/net/netlink`
`/proc/net/netstat`
`/proc/net/packet`
`/proc/net/protocols`
`/proc/net/route`
`/proc/net/unix`
`/proc/<pid>/fdinfo/<fd>`
`/proc/<pid>/io`
`/proc/<pid>/maps`
`/proc/<pid>/mountinfo`
`/proc/<pid>/numa_maps`
`/proc/<pid>/smaps`
`/proc/<pid>/stat`
`/proc/<pid>/statm`
`/proc/<pid>/status`
- Magic syntax support for `/proc` files
- Enhance bash and zsh autocompletions for `/proc` files
- Enhance `free` parser to support `-w` option integer conversions
- Fix `ini` and `kv` parsers so they don't change keynames to lower case
NOTE: This can be a breaking change in your scripts
- Fix `id` command parser to allow usernames and groupnames with spaces
- Enhance metadata output to output metadata even when results are empty
- Optimize tests
- Optimize documentation build script
20220829 v1.21.2
- Fix IP Address string parser for older python versions that don't cleanly
accept decimal input format - IPv6 fix (e.g. python 3.6)
20220828 v1.21.1
- Fix IP Address string parser for older python versions that don't cleanly
accept decimal input format - IPv4 fix (e.g. python 3.6)
- Fix `arp -a` parser for cases where incomplete hardware addresses are found
in the arp table on linux
20220821 v1.21.0
- Add IP Address string parser
- Add Syslog standard and streaming string parsers (RFC 3164 and RFC 5424)
- Add CEF standard and streaming string parser
- Add PLIST file parser (XML and binary support)
- Add `-n` support to the `traceroute` parser
- Add `mdadm` command parser tested on linux
- Add `--meta-out` or `-M` option to add metadata to the JSON output, including
a UTC timestamp, parser name, magic command, and magic command exit code
- Fix `lsusb` command parser for output containing a `Device Qualifier` and
`Binary Object Store Descriptor` sections
- Change `LANG=C` to `LC_ALL=C` in locale instructions
- Add `__main__.py` to package allowing `python -m jc` usage
- Add an enclosing top-level folder inside the windows.zip package
20220723 v1.20.4
- Fix URL string parser path list for URLs ending in a forward slash
20220723 v1.20.3
- Add URL string parser
- Add Email Address string parser
- Add JWT string parser
- Add ISO 8601 Datetime string parser
- Add UNIX Epoch Timestamp string parser
- Add M3U/M3U8 file parser
- Add pager functionality to help (parser documentation only)
- Minor parser performance optimizations
20220705 v1.20.2
- Add `gpg --with-colons` parser tested on linux
- Add DER and PEM encoded X.509 Certificate parser
- Add Bash and Zsh completion scripts to DEB and RPM packages
20220615 v1.20.1
- Add `postconf -M` parser tested on linux
- Update `asciitable` and `asciitable-m` parsers to preserve case in key
names when using the `-r` or `raw=True` options.
- Add long options (e.g. `--help`, `--about`, `--pretty`, etc.)
- Add shell completions for Bash and Zsh
- Fix `id` parser for cases where the user or group name is not present
20220531 v1.20.0
- Add YAML output option with `-y`
- Add `top -b` standard and streaming parsers tested on linux
- Add `plugin_parser_count`, `standard_parser_count`, and `streaming_parser_count`
keys to `jc -a` output
- Add `is_compatible` function to the `utils` module
- Fix `pip-show` parser for packages with a multi-line license field
- Fix ASCII Table parser for cases where centered headers cause mis-aligned fields
20220513 v1.19.0
- Add `chage --list` command parser tested on linux
- Add `git log` command streaming parser
- Fix `git log` standard parser for corner-cases where hash values are in messages
- Fix `df` command parser for rare instances when a newline is found at the end
- Allow jc to pip install on unsupported python version 3.6
- Fix `asciitable-m` parser to skip some rows that contain column separator
characters in cell data. A warning message will be printed to STDERR
unless `-q` or `quiet=True` is used.
20220427 v1.18.8
- Fix `update-alternatives --query` parser for cases where `slaves` are not present
- Fix UnicodeEncodeError on some systems where LANG=C is set and unicode
characters are in the output
- Update `history` parser: do not drop non-ASCII characters if the system
is configured for UTF-8 encoding
- Enhance "magic syntax" to always use UTF-8 encoding
20220425 v1.18.7
- Add `git log` command parser
- Add `update-alternatives --query` parser
- Add `update-alternatives --get-selections` parser
- Fix key/value and ini parsers to allow duplicate keys
- Fix yaml file parser for files including timestamp objects
- Update `xrandr` parser: add a 'rotation' field
- Fix failing tests by moving template files
- Add python interpreter version and path to -v and -a output
20220325 v1.18.6
- Add `pidstat` command parser tested on linux
- Add `pidstat` command streaming parser tested on linux
- Add `mpstat` command parser tested on linux
- Add `mpstat` command streaming parser tested on linux
- Add single-line ASCII and Unicode table parser
- Add multi-line ASCII and Unicode table parser
- Add documentation option to `parser_info()` and `all_parser_info()`
20220305 v1.18.5
- Fix date parser to ensure AM/PM period string is always uppercase
20220304 v1.18.4
- Add nmcli command parser tested on linux
- Enhance parse error messages at the cli
- Add standard and streaming parser list functions to the public API
- Enhance python developer documentation formatting
20220214 v1.18.3
- Add rsync command and log file parser tested on linux and macOS
- Add rsync command and log file streaming parser tested on linux and macOS
- Add xrandr command parser tested on linux
- Enhance timestamp performance with caching and format hints
- Refactor ignore_exceptions functionality in streaming parsers
- Fix man page in packages
20220127 v1.18.2
- Fix for plugin parsers with underscores in the name
- Add type hints to public API functions
- Add plugin attribute to plugin parser metadata
- Add C locale hint to parsing error messages
- Refactor more cli code into lib
20220121 v1.18.1
- Minor fix for MacOS binary
20220121 v1.18.0
- Add high-level parse API for built-in and plugin parsers
- Add python module developer documentation
@@ -325,16 +567,16 @@ jc changelog
- Add axfr support for dig command parser
20200312 v1.9.2
- Updated arp parser to fix OSX detection for some edge cases
- Update arp parser to fix OSX detection for some edge cases
20200312 v1.9.1
- Updated file command parser to make filename splitting more robust
- Update file command parser to make filename splitting more robust
20200311 v1.9.0
- Added ntpq command parser
- Added timedatectl status command parser
- Added airport -I and airport -s command parser
- Added file command parser
- Add ntpq command parser
- Add timedatectl status command parser
- Add airport -I and airport -s command parser
- Add file command parser
- Optimized history command parser by https://github.com/philippeitis
- Magic syntax fix for certain edge cases
@@ -342,27 +584,27 @@ jc changelog
- CLI optimizations by https://github.com/philippeitis
- Refactored magic syntax function and added tests (https://github.com/philippeitis)
- Github actions for CI testing on multiple platforms by https://github.com/philippeitis
- Updated ls parser to fix parsing error in OSX with -lR when there are empty folders
- Update ls parser to fix parsing error in OSX with -lR when there are empty folders
20200303 v1.8.0
- Added blkid command parser
- Added last and lastb command parser
- Added who command parser
- Added CSV file parser
- Added /etc/passwd file parser
- Added /etc/shadow file parser
- Added /etc/group file parser
- Added /etc/gshadow file parser
- Add blkid command parser
- Add last and lastb command parser
- Add who command parser
- Add CSV file parser
- Add /etc/passwd file parser
- Add /etc/shadow file parser
- Add /etc/group file parser
- Add /etc/gshadow file parser
20200227 v1.7.5
- Updated ls parser to support filenames with newline characters
- Update ls parser to support filenames with newline characters
20200219 v1.7.4
- Updated ls parser to support multiple directories, globbing, and -R (recursive)
- Update ls parser to support multiple directories, globbing, and -R (recursive)
20200211 v1.7.3
- Add alternative 'magic' syntax: e.g. `jc ls -al`
- Options can now be condensed (e.g. -prq is equivalant to -p -r -q)
- Options can now be condensed (e.g. -prq is equivalent to -p -r -q)
20200208 v1.7.2
- Include test fixtures in wheel and sdist
@@ -375,8 +617,8 @@ jc changelog
- Add crontab file parser with user support (tested on linux)
- Add __version__ variable to parser modules
- Add exit code on error
- Updated history parser to output "line" as an integer
- Updated compatibility list for some parsers
- Update history parser to output "line" as an integer
- Update compatibility list for some parsers
- Bugfix in crontab file parser: header insertion was clobbering first row
- Just-in-time loading of parser modules instead of loading all at start
@@ -389,7 +631,7 @@ jc changelog
- Add tests for ls, dig, ps, w, uptime on OSX
- Add about option
- Add universal parsers to refactor repetitive code
- Updated ifconfig parser to output 'state' as an array
- Update ifconfig parser to output 'state' as an array
20191117 v1.5.1
- Add ss parser
@@ -402,11 +644,11 @@ jc changelog
- Add -d option to debug parsing issues
- Add compatibility warnings to stderr
- Add documentation
- Updated iptables parser to allow --line-numbers option
- Updated lsblk parser to allow parsing of added columns
- Updated mount parser: changed 'access' field name to 'options'
- Updated netstat parser to allow parsing of unix sockets and raw network connections
- Updated w parser to fix unaligned data where blanks are possible
- Update iptables parser to allow --line-numbers option
- Update lsblk parser to allow parsing of added columns
- Update mount parser: changed 'access' field name to 'options'
- Update netstat parser to allow parsing of unix sockets and raw network connections
- Update w parser to fix unaligned data where blanks are possible
- Clean up code and reorganize package
20191031 v1.1.1

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,3 @@
include jc/man/jc.1.gz
include jc/py.typed
include man/jc.1
include CHANGELOG

616
README.md
View File

@@ -1,35 +1,53 @@
![Tests](https://github.com/kellyjonbrazil/jc/workflows/Tests/badge.svg?branch=master)
![Pypi](https://img.shields.io/pypi/v/jc.svg)
[![Tests](https://github.com/kellyjonbrazil/jc/workflows/Tests/badge.svg?branch=master)](https://github.com/kellyjonbrazil/jc/actions)
[![Pypi](https://img.shields.io/pypi/v/jc.svg)](https://pypi.org/project/jc/)
> Try the `jc` [web demo](https://jc-web-demo.herokuapp.com/)
> Check out the `jc` Python [package documentation](https://github.com/kellyjonbrazil/jc/tree/master/docs) for developers
> JC is [now available](https://galaxy.ansible.com/community/general) as an Ansible filter plugin in the `community.general` collection. See this [blog post](https://blog.kellybrazil.com/2020/08/30/parsing-command-output-in-ansible-with-jc/) for an example.
> Try the `jc` [web demo](https://jc-web.onrender.com/)
> JC is [now available](https://galaxy.ansible.com/community/general) as an
Ansible filter plugin in the `community.general` collection. See this
[blog post](https://blog.kellybrazil.com/2020/08/30/parsing-command-output-in-ansible-with-jc/)
for an example.
# JC
JSON CLI output utility
JSON Convert
`jc` JSONifies the output of many CLI tools and file-types for easier parsing in scripts. See the [**Parsers**](#parsers) section for supported commands and file-types.
`jc` JSONifies the output of many CLI tools, file-types, and common strings
for easier parsing in scripts. See the [**Parsers**](#parsers) section for
supported commands, file-types, and strings.
```bash
dig example.com | jc --dig
```
```json
[{"id":38052,"opcode":"QUERY","status":"NOERROR","flags":["qr","rd","ra"],"query_num":1,"answer_num":1,
"authority_num":0,"additional_num":1,"opt_pseudosection":{"edns":{"version":0,"flags":[],"udp":4096}},"question":
{"name":"example.com.","class":"IN","type":"A"},"answer":[{"name":"example.com.","class":"IN","type":"A","ttl":
39049,"data":"93.184.216.34"}],"query_time":49,"server":"2600:1700:bab0:d40::1#53(2600:1700:bab0:d40::1)","when":
"Fri Apr 16 16:09:00 PDT 2021","rcvd":56,"when_epoch":1618614540,"when_epoch_utc":null}]
[{"id":38052,"opcode":"QUERY","status":"NOERROR","flags":["qr","rd","ra"],
"query_num":1,"answer_num":1,"authority_num":0,"additional_num":1,
"opt_pseudosection":{"edns":{"version":0,"flags":[],"udp":4096}},"question":
{"name":"example.com.","class":"IN","type":"A"},"answer":[{"name":
"example.com.","class":"IN","type":"A","ttl":39049,"data":"93.184.216.34"}],
"query_time":49,"server":"2600:1700:bab0:d40::1#53(2600:1700:bab0:d40::1)",
"when":"Fri Apr 16 16:09:00 PDT 2021","rcvd":56,"when_epoch":1618614540,
"when_epoch_utc":null}]
```
This allows further command-line processing of output with tools like `jq` or [`jello`](https://github.com/kellyjonbrazil/jello) by piping commands:
This allows further command-line processing of output with tools like `jq`
or [`jello`](https://github.com/kellyjonbrazil/jello) by piping commands:
```bash
$ dig example.com | jc --dig | jq -r '.[].answer[].data'
93.184.216.34
```
or using the alternative "magic" syntax:
```bash
$ jc dig example.com | jq -r '.[].answer[].data'
93.184.216.34
```
The `jc` parsers can also be used as python modules. In this case the output will be a python dictionary, or list of dictionaries, instead of JSON:
`jc` can also be used as a python library. In this case the output will be
a python dictionary, a list of dictionaries, or even a
[lazy iterable of dictionaries](#using-streaming-parsers-as-python-modules)
instead of JSON:
```python
>>> import subprocess
>>> import jc
@@ -37,27 +55,31 @@ The `jc` parsers can also be used as python modules. In this case the output wil
>>> cmd_output = subprocess.check_output(['dig', 'example.com'], text=True)
>>> data = jc.parse('dig', cmd_output)
>>>
>>> data
[{'id': 64612, 'opcode': 'QUERY', 'status': 'NOERROR', 'flags': ['qr', 'rd', 'ra'], 'query_num': 1, 'answer_num':
1, 'authority_num': 0, 'additional_num': 1, 'opt_pseudosection': {'edns': {'version': 0, 'flags': [], 'udp':
4096}}, 'question': {'name': 'example.com.', 'class': 'IN', 'type': 'A'}, 'answer': [{'name': 'example.com.',
'class': 'IN', 'type': 'A', 'ttl': 29658, 'data': '93.184.216.34'}], 'query_time': 52, 'server':
'2600:1700:bab0:d40::1#53(2600:1700:bab0:d40::1)', 'when': 'Fri Apr 16 16:13:00 PDT 2021', 'rcvd': 56,
'when_epoch': 1618614780, 'when_epoch_utc': None}]
>>> data[0]['answer']
[{'name': 'example.com.', 'class': 'IN', 'type': 'A', 'ttl': 29658, 'data':
'93.184.216.34'}]
```
> For `jc` Python package documentation, use `help('jc')`, `help('jc.lib')`, or see the [online documentation](https://github.com/kellyjonbrazil/jc/tree/master/docs).
> For `jc` Python package documentation, use `help('jc')`, `help('jc.lib')`, or
see the [online documentation](https://github.com/kellyjonbrazil/jc/tree/master/docs).
Two representations of the data are available. The default representation uses a strict schema per parser and converts known numbers to int/float JSON values. Certain known values of `None` are converted to JSON `null`, known boolean values are converted, and, in some cases, additional semantic context fields are added.
Two representations of the data are available. The default representation uses a
strict schema per parser and converts known numbers to int/float JSON values.
Certain known values of `None` are converted to JSON `null`, known boolean
values are converted, and, in some cases, additional semantic context fields are
added.
To access the raw, pre-processed JSON, use the `-r` cli option or the `raw=True` function parameter in `parse()`.
To access the raw, pre-processed JSON, use the `-r` cli option or the `raw=True`
function parameter in `parse()` when using `jc` as a python library.
Schemas for each parser can be found at the documentation link beside each [**Parser**](#parsers) below.
Schemas for each parser can be found at the documentation link beside each
[**Parser**](#parsers) below.
Release notes can be found [here](https://blog.kellybrazil.com/category/jc-news/).
## Why Would Anyone Do This!?
For more information on the motivations for this project, please see my blog post on [Bringing the Unix Philosophy to the 21st Century](https://blog.kellybrazil.com/2019/11/26/bringing-the-unix-philosophy-to-the-21st-century/).
For more information on the motivations for this project, please see my blog
post on [Bringing the Unix Philosophy to the 21st Century](https://blog.kellybrazil.com/2019/11/26/bringing-the-unix-philosophy-to-the-21st-century/) and my [interview with Console](https://console.substack.com/p/console-89).
See also:
- [libxo on FreeBSD](http://juniper.github.io/libxo/libxo-manual.html)
@@ -71,164 +93,290 @@ Use Cases:
- [Ansible command output parsing](https://blog.kellybrazil.com/2020/08/30/parsing-command-output-in-ansible-with-jc/)
- [Saltstack command output parsing](https://blog.kellybrazil.com/2020/09/15/parsing-command-output-in-saltstack-with-jc/)
- [Nornir command output parsing](https://blog.kellybrazil.com/2020/12/09/parsing-command-output-in-nornir-with-jc/)
- [FortiSOAR command output parsing](https://docs.fortinet.com/document/fortisoar/1.0.0/jc-parse-command-output/323/jc-parse-command-output-v1-0-0)
## Installation
There are several ways to get `jc`. You can install via `pip`, OS package repositories, via DEB/RPM/MSI packaged binaries for linux and Windows, or by downloading the correct binary for your architecture and running it anywhere on your filesystem.
There are several ways to get `jc`. You can install via `pip`, OS package
[repositories](https://repology.org/project/jc/versions), or by downloading the
correct [binary](https://github.com/kellyjonbrazil/jc/releases) for your
architecture and running it anywhere on your filesystem.
### Pip (macOS, linux, unix, Windows)
[![Pypi](https://img.shields.io/pypi/v/jc.svg)](https://pypi.org/project/jc/)
```bash
pip3 install jc
```
### OS Package Repositories
| OS | Command |
|-----------------------|-------------------------------------------------------------------------------|
| Debian/Ubuntu linux | `apt-get install jc` |
| Fedora linux | `dnf install jc` |
| openSUSE linux | `zypper install jc` |
| Arch linux | `pacman -S jc` |
| NixOS linux | `nix-env -iA nixpkgs.jc` or `nix-env -iA nixos.jc` |
| Guix System linux | `guix install jc` |
| macOS | `brew install jc` |
| FreeBSD | `portsnap fetch update && cd /usr/ports/textproc/py-jc && make install clean` |
| Ansible filter plugin | `ansible-galaxy collection install community.general` |
| OS | Command |
|--------------------------------------|-------------------------------------------------------------------------------|
| Debian/Ubuntu linux | `apt-get install jc` |
| Fedora linux | `dnf install jc` |
| openSUSE linux | `zypper install jc` |
| Arch linux | `pacman -S jc` |
| NixOS linux | `nix-env -iA nixpkgs.jc` or `nix-env -iA nixos.jc` |
| Guix System linux | `guix install jc` |
| Gentoo Linux | `emerge dev-python/jc` |
| macOS | `brew install jc` |
| FreeBSD | `portsnap fetch update && cd /usr/ports/textproc/py-jc && make install clean` |
| Ansible filter plugin | `ansible-galaxy collection install community.general` |
| FortiSOAR connector | Install from FortiSOAR Connector Marketplace |
> 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.
### Binaries
For precompiled binaries, 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`.
`jc` accepts piped input from `STDIN` and outputs a JSON representation of the
previous command's output to `STDOUT`.
```bash
COMMAND | jc PARSER [OPTIONS]
COMMAND | jc [OPTIONS] PARSER
cat FILE | jc [OPTIONS] PARSER
echo STRING | jc [OPTIONS] PARSER
```
Alternatively, the "magic" syntax can be used by prepending `jc` to the command to be converted. Options can be passed to `jc` immediately before the command is given. (Note: command aliases and shell builtins are not supported)
Alternatively, the "magic" syntax can be used by prepending `jc` to the command
to be converted or in front of the absolute path for Proc files. Options can be
passed to `jc` immediately before the command or Proc file path is given.
(Note: command aliases and shell builtins are not supported)
```bash
jc [OPTIONS] COMMAND
jc [OPTIONS] /proc/<path-to-procfile>
```
The JSON output can be compact (default) or pretty formatted with the `-p` option.
The JSON output can be compact (default) or pretty formatted with the `-p`
option.
### Parsers
- `--acpi` enables the `acpi` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/acpi))
- `--airport` enables the `airport -I` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/airport))
- `--airport-s` enables the `airport -s` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/airport_s))
- `--arp` enables the `arp` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/arp))
- `--blkid` enables the `blkid` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/blkid))
- `--cksum` enables the `cksum` and `sum` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/cksum))
- `--crontab` enables the `crontab` command and file parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/crontab))
- `--crontab-u` enables the `crontab` file parser with user support ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/crontab_u))
- `--csv` enables the CSV file parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/csv))
- `--csv-s` enables the CSV file streaming parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/csv_s))
- `--date` enables the `date` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/date))
- `--df` enables the `df` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/df))
- `--dig` enables the `dig` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/dig))
- `--dir` enables the `dir` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/dir))
- `--dmidecode` enables the `dmidecode` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/dmidecode))
- `--dpkg-l` enables the `dpkg -l` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/dpkg_l))
- `--du` enables the `du` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/du))
- `--env` enables the `env` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/env))
- `--file` enables the `file` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/file))
- `--finger` enables the `finger` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/finger))
- `--free` enables the `free` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/free))
- `--fstab` enables the `/etc/fstab` file parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/fstab))
- `--group` enables the `/etc/group` file parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/group))
- `--gshadow` enables the `/etc/gshadow` file parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/gshadow))
- `--hash` enables the `hash` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/hash))
- `--hashsum` enables the hashsum command parser (`md5sum`, `shasum`, etc.) ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/hashsum))
- `--hciconfig` enables the `hciconfig` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/hciconfig))
- `--history` enables the `history` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/history))
- `--hosts` enables the `/etc/hosts` file parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/hosts))
- `--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))
- `--ls` enables the `ls` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/ls))
- `--ls-s` enables the `ls` command streaming parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/ls_s))
- `--lsblk` enables the `lsblk` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/lsblk))
- `--lsmod` enables the `lsmod` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/lsmod))
- `--lsof` enables the `lsof` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/lsof))
- `--lsusb` enables the `lsusb` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/lsusb))
- `--mount` enables the `mount` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/mount))
- `--netstat` enables the `netstat` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/netstat))
- `--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))
- `--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-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))
- `--route` enables the `route` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/route))
- `--rpm-qi` enables the `rpm -qi` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/rpm_qi))
- `--sfdisk` enables the `sfdisk` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/sfdisk))
- `--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))
- `--systemctl-ls` enables the `systemctl list-sockets` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/systemctl_ls))
- `--systemctl-luf` enables the `systemctl list-unit-files` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/systemctl_luf))
- `--systeminfo` enables the `systeminfo` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/systeminfo))
- `--time` enables the `/usr/bin/time` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/time))
- `--timedatectl` enables the `timedatectl status` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/timedatectl))
- `--tracepath` enables the `tracepath` and `tracepath6` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/tracepath))
- `--traceroute` enables the `traceroute` and `traceroute6` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/traceroute))
- `--ufw` enables the `ufw status` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/ufw))
- `--ufw-appinfo` enables the `ufw app info [application]` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/ufw_appinfo))
- `--uname` enables the `uname -a` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/uname))
- `--upower` enables the `upower` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/upower))
- `--uptime` enables the `uptime` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/uptime))
- `--vmstat` enables the `vmstat` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/vmstat))
- `--vmstat-s` enables the `vmstat` command streaming parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/vmstat_s))
- `--w` enables the `w` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/w))
- `--wc` enables the `wc` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/wc))
- `--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))
| Argument | Command or Filetype | Documentation |
|-------------------|---------------------------------------------------------|----------------------------------------------------------------------------|
| ` --acpi` | `acpi` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/acpi) |
| ` --airport` | `airport -I` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/airport) |
| ` --airport-s` | `airport -s` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/airport_s) |
| ` --arp` | `arp` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/arp) |
| ` --asciitable` | ASCII and Unicode table parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/asciitable) |
| ` --asciitable-m` | multi-line ASCII and Unicode table parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/asciitable_m) |
| ` --blkid` | `blkid` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/blkid) |
| ` --cbt` | `cbt` (Google Bigtable) command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/cbt) |
| ` --cef` | CEF string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/cef) |
| ` --cef-s` | CEF string streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/cef_s) |
| ` --chage` | `chage --list` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/chage) |
| ` --cksum` | `cksum` and `sum` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/cksum) |
| ` --clf` | Common and Combined Log Format file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/clf) |
| ` --clf-s` | Common and Combined Log Format file streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/clf_s) |
| ` --crontab` | `crontab` command and file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/crontab) |
| ` --crontab-u` | `crontab` file parser with user support | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/crontab_u) |
| ` --csv` | CSV file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/csv) |
| ` --csv-s` | CSV file streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/csv_s) |
| ` --date` | `date` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/date) |
| ` --datetime-iso` | ISO 8601 Datetime string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/datetime_iso) |
| ` --df` | `df` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/df) |
| ` --dig` | `dig` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/dig) |
| ` --dir` | `dir` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/dir) |
| ` --dmidecode` | `dmidecode` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/dmidecode) |
| ` --dpkg-l` | `dpkg -l` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/dpkg_l) |
| ` --du` | `du` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/du) |
| `--email-address` | Email Address string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/email_address) |
| ` --env` | `env` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/env) |
| ` --file` | `file` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/file) |
| ` --findmnt` | `findmnt` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/findmnt) |
| ` --finger` | `finger` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/finger) |
| ` --free` | `free` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/free) |
| ` --fstab` | `/etc/fstab` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/fstab) |
| ` --git-log` | `git log` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/git_log) |
| ` --git-log-s` | `git log` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/git_log_s) |
| `--git-ls-remote` | `git ls-remote` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/git_ls_remote) |
| ` --gpg` | `gpg --with-colons` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/gpg) |
| ` --group` | `/etc/group` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/group) |
| ` --gshadow` | `/etc/gshadow` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/gshadow) |
| ` --hash` | `hash` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/hash) |
| ` --hashsum` | hashsum command parser (`md5sum`, `shasum`, etc.) | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/hashsum) |
| ` --hciconfig` | `hciconfig` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/hciconfig) |
| ` --history` | `history` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/history) |
| ` --hosts` | `/etc/hosts` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/hosts) |
| ` --id` | `id` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/id) |
| ` --ifconfig` | `ifconfig` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ifconfig) |
| ` --ini` | INI file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ini) |
| ` --iostat` | `iostat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/iostat) |
| ` --iostat-s` | `iostat` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/iostat_s) |
| ` --ip-address` | IPv4 and IPv6 Address string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ip_address) |
| ` --iptables` | `iptables` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/iptables) |
| ` --iw-scan` | `iw dev [device] scan` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/iw_scan) |
| ` --iwconfig` | `iwconfig` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/iwconfig) |
| ` --jar-manifest` | Java MANIFEST.MF file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/jar_manifest) |
| ` --jobs` | `jobs` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/jobs) |
| ` --jwt` | JWT string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/jwt) |
| ` --kv` | Key/Value file and string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/kv) |
| ` --last` | `last` and `lastb` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/last) |
| ` --ls` | `ls` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ls) |
| ` --ls-s` | `ls` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ls_s) |
| ` --lsblk` | `lsblk` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/lsblk) |
| ` --lsmod` | `lsmod` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/lsmod) |
| ` --lsof` | `lsof` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/lsof) |
| ` --lspci` | `lspci -mmv` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/lspci) |
| ` --lsusb` | `lsusb` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/lsusb) |
| ` --m3u` | M3U and M3U8 file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/m3u) |
| ` --mdadm` | `mdadm` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/mdadm) |
| ` --mount` | `mount` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/mount) |
| ` --mpstat` | `mpstat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/mpstat) |
| ` --mpstat-s` | `mpstat` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/mpstat_s) |
| ` --netstat` | `netstat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/netstat) |
| ` --nmcli` | `nmcli` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/nmcli) |
| ` --ntpq` | `ntpq -p` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ntpq) |
| ` --openvpn` | openvpn-status.log file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/openvpn) |
| ` --os-prober` | `os-prober` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/os_prober) |
| ` --passwd` | `/etc/passwd` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/passwd) |
| ` --pci-ids` | `pci.ids` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pci_ids) |
| ` --pgpass` | PostgreSQL password file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pgpass) |
| ` --pidstat` | `pidstat -H` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pidstat) |
| ` --pidstat-s` | `pidstat -H` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pidstat_s) |
| ` --ping` | `ping` and `ping6` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ping) |
| ` --ping-s` | `ping` and `ping6` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ping_s) |
| ` --pip-list` | `pip list` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pip_list) |
| ` --pip-show` | `pip show` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pip_show) |
| ` --plist` | PLIST file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/plist) |
| ` --postconf` | `postconf -M` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/postconf) |
| ` --proc` | `/proc/` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/proc) |
| ` --ps` | `ps` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ps) |
| ` --route` | `route` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/route) |
| ` --rpm-qi` | `rpm -qi` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/rpm_qi) |
| ` --rsync` | `rsync` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/rsync) |
| ` --rsync-s` | `rsync` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/rsync_s) |
| ` --semver` | Semantic Version string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/semver) |
| ` --sfdisk` | `sfdisk` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/sfdisk) |
| ` --shadow` | `/etc/shadow` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/shadow) |
| ` --ss` | `ss` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ss) |
| ` --sshd-conf` | sshd config file and `sshd -T` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/sshd_conf) |
| ` --stat` | `stat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/stat) |
| ` --stat-s` | `stat` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/stat_s) |
| ` --sysctl` | `sysctl` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/sysctl) |
| ` --syslog` | Syslog RFC 5424 string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/syslog) |
| ` --syslog-s` | Syslog RFC 5424 string streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/syslog_s) |
| ` --syslog-bsd` | Syslog RFC 3164 string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/syslog_bsd) |
| ` --syslog-bsd-s` | Syslog RFC 3164 string streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/syslog_bsd_s) |
| ` --systemctl` | `systemctl` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/systemctl) |
| ` --systemctl-lj` | `systemctl list-jobs` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/systemctl_lj) |
| ` --systemctl-ls` | `systemctl list-sockets` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/systemctl_ls) |
| `--systemctl-luf` | `systemctl list-unit-files` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/systemctl_luf) |
| ` --systeminfo` | `systeminfo` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/systeminfo) |
| ` --time` | `/usr/bin/time` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/time) |
| ` --timedatectl` | `timedatectl status` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/timedatectl) |
| ` --timestamp` | Unix Epoch Timestamp string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/timestamp) |
| ` --top` | `top -b` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/top) |
| ` --top-s` | `top -b` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/top_s) |
| ` --tracepath` | `tracepath` and `tracepath6` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/tracepath) |
| ` --traceroute` | `traceroute` and `traceroute6` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/traceroute) |
| ` --udevadm` | `udevadm info` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/udevadm) |
| ` --ufw` | `ufw status` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ufw) |
| ` --ufw-appinfo` | `ufw app info [application]` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ufw_appinfo) |
| ` --uname` | `uname -a` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/uname) |
| `--update-alt-gs` | `update-alternatives --get-selections` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/update_alt_gs) |
| ` --update-alt-q` | `update-alternatives --query` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/update_alt_q) |
| ` --upower` | `upower` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/upower) |
| ` --uptime` | `uptime` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/uptime) |
| ` --url` | URL string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/url) |
| ` --vmstat` | `vmstat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/vmstat) |
| ` --vmstat-s` | `vmstat` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/vmstat_s) |
| ` --w` | `w` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/w) |
| ` --wc` | `wc` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/wc) |
| ` --who` | `who` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/who) |
| ` --x509-cert` | X.509 PEM and DER certificate file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/x509_cert) |
| ` --xml` | XML file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/xml) |
| ` --xrandr` | `xrandr` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/xrandr) |
| ` --yaml` | YAML file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/yaml) |
| ` --zipinfo` | `zipinfo` command parser | [details](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
- `-p` pretty format the JSON output
- `-q` quiet mode. Suppresses parser warning messages (use `-qq` to ignore streaming parser errors)
- `-r` raw output. Provides a more literal JSON output, typically with string values and no additional semantic processing
- `-u` unbuffer output
- `-v` version information
| Short | Long | Description |
|-------|-----------------|---------------------------------------------------------------------------------------------------------------------|
| `-a` | `--about` | About `jc`. Prints information about `jc` and the parsers (in JSON or YAML, of course!) |
| `-C` | `--force-color` | Force color output even when using pipes (overrides `-m` and the `NO_COLOR` env variable) |
| `-d` | `--debug` | Debug mode. Prints trace messages if parsing issues are encountered (use`-dd` for verbose debugging) |
| `-h` | `--help` | Help. Use `jc -h --parser_name` for parser documentation. Use twice to show hidden parsers (e.g. `-hh`) |
| `-m` | `--monochrome` | Monochrome output |
| `-M` | `--meta-out` | Add metadata to output including timestamp, parser name, magic command, magic command exit code, etc. | |
| `-p` | `--pretty` | Pretty format the JSON output |
| `-q` | `--quiet` | Quiet mode. Suppresses parser warning messages (use `-qq` to ignore streaming parser errors) |
| `-r` | `--raw` | Raw output. Provides more literal output, typically with string values and no additional semantic processing |
| `-u` | `--unbuffer` | Unbuffer output |
| `-v` | `--version` | Version information |
| `-y` | `--yaml-out` | YAML output |
| `-B` | `--bash-comp` | Generate Bash shell completion script ([more info](https://github.com/kellyjonbrazil/jc/wiki/Shell-Completions)) |
| `-Z` | `--zsh-comp` | Generate Zsh shell completion script ([more info](https://github.com/kellyjonbrazil/jc/wiki/Shell-Completions)) |
### Exit Codes
Any fatal errors within `jc` will generate an exit code of `100`, otherwise the exit code will be `0`. When using the "magic" syntax (e.g. `jc ifconfig eth0`), `jc` will store the exit code of the program being parsed and add it to the `jc` exit code. This way it is easier to determine if an error was from the parsed program or `jc`.
Any fatal errors within `jc` will generate an exit code of `100`, otherwise the
exit code will be `0`.
When using the "magic" syntax (e.g. `jc ifconfig eth0`),
`jc` will store the exit code of the program being parsed and add it to the `jc`
exit code. This way it is easier to determine if an error was from the parsed
program or `jc`.
Consider the following examples using `ifconfig`:
| `ifconfig` exit code | `jc` exit code | Combined exit code | Interpretation |
| `ifconfig` exit code | `jc` exit code | Combined exit code | Interpretation |
|----------------------|----------------|--------------------|------------------------------------|
| `0` | `0` | `0` | No errors |
| `1` | `0` | `1` | Error in `ifconfig` |
| `0` | `100` | `100` | Error in `jc` |
| `1` | `100` | `101` | Error in both `ifconfig` and `jc` |
When using the "magic" syntax you can also retrieve the exit code of the called
program by using the `--meta-out` or `-M` option. This will append a `_jc_meta`
object to the output that will include the magic command information, including
the exit code.
Here is an example with `ping`:
```bash
$ jc --meta-out -p ping -c2 192.168.1.252
{
"destination_ip": "192.168.1.252",
"data_bytes": 56,
"pattern": null,
"destination": "192.168.1.252",
"packets_transmitted": 2,
"packets_received": 0,
"packet_loss_percent": 100.0,
"duplicates": 0,
"responses": [
{
"type": "timeout",
"icmp_seq": 0,
"duplicate": false
}
],
"_jc_meta": {
"parser": "ping",
"timestamp": 1661357115.27949,
"magic_command": [
"ping",
"-c2",
"192.168.1.252"
],
"magic_command_exit": 2
}
}
$ echo $?
2
```
### Setting Custom Colors via Environment Variable
You can specify custom colors via the `JC_COLORS` environment variable. The `JC_COLORS` environment variable takes four comma separated string values in the following format:
You can specify custom colors via the `JC_COLORS` environment variable. The
`JC_COLORS` environment variable takes four comma separated string values in
the following format:
```bash
JC_COLORS=<keyname_color>,<keyword_color>,<number_color>,<string_color>
```
Where colors are: `black`, `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `gray`, `brightblack`, `brightred`, `brightgreen`, `brightyellow`, `brightblue`, `brightmagenta`, `brightcyan`, `white`, or `default`
Where colors are: `black`, `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`,
`gray`, `brightblack`, `brightred`, `brightgreen`, `brightyellow`, `brightblue`,
`brightmagenta`, `brightcyan`, `white`, or `default`
For example, to set to the default colors:
```bash
@@ -240,16 +388,33 @@ 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.
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.
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 outputting 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.
> Note: Streaming parsers cannot be used with the "magic" syntax
#### Ignoring Errors
You may want to ignore parsing errors when using streaming parsers since these may be used in long-lived processing pipelines and errors can break the pipe. To ignore parsing errors, use the `-qq` cli option or the `ignore_exceptions=True` argument with the `parse()` function. This will add a `_jc_meta` object to the JSON output with a `success` attribute. If `success` is `true`, then there were no issues parsing the line. If `success` is `false`, then a parsing issue was found and `error` and `line` fields will be added to include a short error description and the contents of the unparsable line, respectively:
You may want to ignore parsing errors when using streaming parsers since these
may be used in long-lived processing pipelines and errors can break the pipe. To
ignore parsing errors, use the `-qq` cli option or the `ignore_exceptions=True`
argument with the `parse()` function. This will add a `_jc_meta` object to the
JSON output with a `success` attribute. If `success` is `true`, then there were
no issues parsing the line. If `success` is `false`, then a parsing issue was
found and `error` and `line` fields will be added to include a short error
description and the contents of the unparsable line, respectively:
Successfully parsed line with `-qq` option:
```json
@@ -260,6 +425,7 @@ Successfully parsed line with `-qq` option:
}
}
```
Unsuccessfully parsed line with `-qq` option:
```json
{
@@ -273,25 +439,38 @@ Unsuccessfully parsed line with `-qq` option:
#### Unbuffering Output
Most operating systems will buffer output that is being piped from process to process. The buffer is usually around 4KB. When viewing the output in the terminal the OS buffer is not engaged so output is immediately displayed on the screen. When piping multiple processes together, though, it may seem as if the output is hanging when the input data is very slow (e.g. `ping`):
Most operating systems will buffer output that is being piped from process to
process. The buffer is usually around 4KB. When viewing the output in the
terminal the OS buffer is not engaged so output is immediately displayed on the
screen. When piping multiple processes together, though, it may seem as if the
output is hanging when the input data is very slow (e.g. `ping`):
```
$ ping 1.1.1.1 | jc --ping-s | jq
<slow output>
```
This is because the OS engages the 4KB buffer between `jc` and `jq` in this example. To display the data on the terminal in realtime, you can disable the buffer with the `-u` (unbuffer) cli option:
This is because the OS engages the 4KB buffer between `jc` and `jq` in this
example. To display the data on the terminal in realtime, you can disable the
buffer with the `-u` (unbuffer) cli option:
```
$ ping 1.1.1.1 | jc --ping-s -u | jq
{"type":"reply","pattern":null,"timestamp":null,"bytes":"64","response_ip":"1.1.1.1","icmp_seq":"1","ttl":"128","time_ms":"24.6","duplicate":false}
{"type":"reply","pattern":null,"timestamp":null,"bytes":"64","response_ip":"1.1.1.1","icmp_seq":"2","ttl":"128","time_ms":"26.8","duplicate":false}
{"type":"reply","pattern":null,"timestamp":null,"bytes":"64","respons...}
{"type":"reply","pattern":null,"timestamp":null,"bytes":"64","respons...}
...
```
> Note: Unbuffered output can be slower for large data streams.
#### Using Streaming Parsers as Python Modules
Streaming parsers accept any iterable object and return a generator iterator object allowing lazy processing of the data. The input data should iterate on lines of string data. Examples of good input data are `sys.stdin` or `str.splitlines()`.
Streaming parsers accept any iterable object and return an iterable object
allowing lazy processing of the data. The input data should iterate on lines
of string data. Examples of good input data are `sys.stdin` or
`str.splitlines()`.
To use the generator object in your code, simply loop through it or use the [next()](https://docs.python.org/3/library/functions.html#next) builtin function:
To use the returned iterable object in your code, simply loop through it or
use the [next()](https://docs.python.org/3/library/functions.html#next)
builtin function:
```python
import jc
@@ -301,49 +480,88 @@ for item in result:
```
### Custom Parsers
Custom local parser plugins may be placed in a `jc/jcparsers` folder in your local **"App data directory"**:
Custom local parser plugins may be placed in a `jc/jcparsers` folder in your
local **"App data directory"**:
- Linux/unix: `$HOME/.local/share/jc/jcparsers`
- 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) 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 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 and therefore must
start with a letter and consist entirely of alphanumerics and underscores.
Local plugins may override default parsers.
> Note: The application data directory follows the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html)
> Note: The application data directory follows the
[XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html)
### Caveats
#### Locale
For best results set the `LANG` locale environment variable to `C` or `en_US.UTF-8`. For example, either by setting directly on the command-line:
For best results set the locale environment variables to `C` or
`en_US.UTF-8` by modifying the `LC_ALL` variable:
```
$ LANG=C date | jc --date
$ LC_ALL=C date | jc --date
```
or by exporting to the environment before running commands:
You can also set the locale variables individually:
```
$ export LANG=C
$ export LC_NUMERIC=C
```
On some older systems UTF-8 output will be downgraded to ASCII with `\\u`
escape sequences if the `C` locale does not support UTF-8 encoding.
#### Timezones
Some parsers have calculated epoch timestamp fields added to the output. Unless a timestamp field name has a `_utc` suffix it is considered naive. (i.e. based on the local timezone of the system the `jc` parser was run on).
Some parsers have calculated epoch timestamp fields added to the output. Unless
a timestamp field name has a `_utc` suffix it is considered naive. (i.e. based
on the local timezone of the system the `jc` parser was run on).
If a UTC timezone can be detected in the text of the command output, the timestamp will be timezone aware and have a `_utc` suffix on the key name. (e.g. `epoch_utc`) No other timezones are supported for aware timestamps.
If a UTC timezone can be detected in the text of the command output, the
timestamp will be timezone aware and have a `_utc` suffix on the key name.
(e.g. `epoch_utc`) No other timezones are supported for aware timestamps.
## Use In Other Shells
`jc` can be used in most any shell. Some modern shells have JSON deserialization
and filtering capabilities built-in which makes using `jc` even more convenient.
For example, the following is possible in [NGS](https://ngs-lang.org/)
(Next Generation Shell):
```bash
myvar = ``jc dig www.google.com``[0].answer[0].data
```
This runs `jc`, parses the output JSON, and assigs the resulting data structure
to a variable in a single line of code.
For more examples of how to use `jc` in other shells, see this
[wiki page](https://github.com/kellyjonbrazil/jc/wiki/Using-jc-With-Different-Shells).
## Compatibility
Some parsers like `dig`, `xml`, `csv`, etc. will work on any platform. Other parsers that convert platform-specific output will generate a warning message if they are run on an unsupported platform. To see all parser information, including compatibility, run `jc -ap`.
Some parsers like `dig`, `xml`, `csv`, etc. will work on any platform. Other
parsers that convert platform-specific output will generate a warning message if
they are run on an unsupported platform. To see all parser information,
including compatibility, run `jc -ap`.
You may still use a parser on an unsupported platform - for example, you may want to parse a file with linux `lsof` output on an macOS or Windows laptop. In that case you can suppress the warning message with the `-q` cli option or the `quiet=True` function parameter in `parse()`:
You may still use a parser on an unsupported platform - for example, you may
want to parse a file with linux `lsof` output on an macOS or Windows laptop. In
that case you can suppress the warning message with the `-q` cli option or the
`quiet=True` function parameter in `parse()`:
macOS:
```bash
cat lsof.out | jc --lsof -q
cat lsof.out | jc -q --lsof
```
or Windows:
```bash
type lsof.out | jc --lsof -q
type lsof.out | jc -q --lsof
```
Tested on:
@@ -360,25 +578,34 @@ Tested on:
- Windows 2019 Server
## Contributions
Feel free to add/improve code or parsers! You can 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) parsers as a template and submit your parser with a pull request.
Feel free to add/improve code or parsers! You can 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) parsers as a template and submit your parser with a pull
request.
Please see the [Contributing Guidelines](https://github.com/kellyjonbrazil/jc/blob/master/CONTRIBUTING.md) for more information.
## Acknowledgments
- Local parser plugin feature contributed by [Dean Serenevy](https://github.com/duelafn)
- CI automation and code optimizations by [philippeitis](https://github.com/philippeitis)
- [`ifconfig-parser`](https://github.com/KnightWhoSayNi/ifconfig-parser) module by KnightWhoSayNi
- [`ifconfig-parser`](https://github.com/KnightWhoSayNi/ifconfig-parser) module
by KnightWhoSayNi
- [`xmltodict`](https://github.com/martinblech/xmltodict) module by Martín Blech
- [`ruamel.yaml`](https://pypi.org/project/ruamel.yaml) module by Anthon van der Neut
- [`ruamel.yaml`](https://pypi.org/project/ruamel.yaml) module by Anthon van
der Neut
- [`trparse`](https://github.com/lbenitez000/trparse) module by Luis Benitez
- Parsing [code](https://gist.github.com/cahna/43a1a3ff4d075bcd71f9d7120037a501) from Conor Heine adapted for some parsers
- Parsing [code](https://gist.github.com/cahna/43a1a3ff4d075bcd71f9d7120037a501)
from Conor Heine adapted for some parsers
- Excellent constructive feedback from [Ilya Sher](https://github.com/ilyash-b)
## Examples
Here are some examples of `jc` output. For more examples, see [here](https://kellyjonbrazil.github.io/jc/EXAMPLES) or the parser documentation.
Here are some examples of `jc` output. For more examples, see
[here](https://kellyjonbrazil.github.io/jc/EXAMPLES) or the parser
documentation.
### arp
```bash
arp | jc --arp -p # or: jc -p arp
arp | jc -p --arp # or: jc -p arp
```
```json
[
@@ -417,7 +644,7 @@ cat homes.csv
...
```
```bash
cat homes.csv | jc --csv -p
cat homes.csv | jc -p --csv
```
```json
[
@@ -458,7 +685,7 @@ cat homes.csv | jc --csv -p
```
### /etc/hosts file
```bash
cat /etc/hosts | jc --hosts -p
cat /etc/hosts | jc -p --hosts
```
```json
[
@@ -485,7 +712,7 @@ cat /etc/hosts | jc --hosts -p
```
### ifconfig
```bash
ifconfig | jc --ifconfig -p # or: jc -p ifconfig
ifconfig | jc -p --ifconfig # or: jc -p ifconfig
```
```json
[
@@ -543,29 +770,29 @@ Port = 50022
ForwardX11 = no
```
```bash
cat example.ini | jc --ini -p
cat example.ini | jc -p --ini
```
```json
{
"bitbucket.org": {
"serveraliveinterval": "45",
"compression": "yes",
"compressionlevel": "9",
"forwardx11": "yes",
"user": "hg"
"ServeraLiveInterval": "45",
"Compression": "yes",
"CompressionLevel": "9",
"ForwardX11": "yes",
"User": "hg"
},
"topsecret.server.com": {
"serveraliveinterval": "45",
"compression": "yes",
"compressionlevel": "9",
"forwardx11": "no",
"port": "50022"
"ServeraLiveInterval": "45",
"Compression": "yes",
"CompressionLevel": "9",
"ForwardX11": "no",
"Port": "50022"
}
}
```
### ls
```bash
$ ls -l /usr/bin | jc --ls -p # or: jc -p ls -l /usr/bin
$ ls -l /usr/bin | jc -p --ls # or: jc -p ls -l /usr/bin
```
```json
[
@@ -601,7 +828,7 @@ $ ls -l /usr/bin | jc --ls -p # or: jc -p ls -l /usr/bin
```
### netstat
```bash
netstat -apee | jc --netstat -p # or: jc -p netstat -apee
netstat -apee | jc -p --netstat # or: jc -p netstat -apee
```
```json
[
@@ -689,7 +916,7 @@ netstat -apee | jc --netstat -p # or: jc -p netstat -apee
```
### /etc/passwd file
```bash
cat /etc/passwd | jc --passwd -p
cat /etc/passwd | jc -p --passwd
```
```json
[
@@ -715,7 +942,7 @@ cat /etc/passwd | jc --passwd -p
```
### ping
```bash
ping 8.8.8.8 -c 3 | jc --ping -p # or: jc -p ping 8.8.8.8 -c 3
ping 8.8.8.8 -c 3 | jc -p --ping # or: jc -p ping 8.8.8.8 -c 3
```
```json
{
@@ -768,7 +995,7 @@ ping 8.8.8.8 -c 3 | jc --ping -p # or: jc -p ping 8.8.8.8 -c 3
```
### ps
```bash
ps axu | jc --ps -p # or: jc -p ps axu
ps axu | jc -p --ps # or: jc -p ps axu
```
```json
[
@@ -783,7 +1010,7 @@ ps axu | jc --ps -p # or: jc -p ps axu
"stat": "Ss",
"start": "Nov09",
"time": "0:08",
"command": "/usr/lib/systemd/systemd --switched-root --system --deserialize 22"
"command": "/usr/lib/systemd/systemd --switched-root --system --deseria..."
},
{
"user": "root",
@@ -815,7 +1042,8 @@ ps axu | jc --ps -p # or: jc -p ps axu
```
### traceroute
```bash
traceroute -m 2 8.8.8.8 | jc --traceroute -p # or: jc -p traceroute -m 2 8.8.8.8
traceroute -m 2 8.8.8.8 | jc -p --traceroute
# or: jc -p traceroute -m 2 8.8.8.8
```
```json
{
@@ -879,7 +1107,7 @@ traceroute -m 2 8.8.8.8 | jc --traceroute -p # or: jc -p traceroute -m
```
### uptime
```bash
uptime | jc --uptime -p # or: jc -p uptime
uptime | jc -p --uptime # or: jc -p uptime
```
```json
{
@@ -924,7 +1152,7 @@ cat cd_catalog.xml
...
```
```bash
cat cd_catalog.xml | jc --xml -p
cat cd_catalog.xml | jc -p --xml
```
```json
{
@@ -976,7 +1204,7 @@ spec:
mode: ISTIO_MUTUAL
```
```bash
cat istio.yaml | jc --yaml -p
cat istio.yaml | jc -p --yaml
```
```json
[

View File

@@ -1 +1,2 @@
theme: jekyll-theme-cayman
theme: jekyll-theme-cayman
markdown: GFM

9
build-completions.py Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env python3
# build Bash and Zsh completion scripts and add to the completions folder
from jc.shell_completions import bash_completion, zsh_completion
with open('completions/jc_bash_completion.sh', 'w') as f:
print(bash_completion(), file=f)
with open('completions/jc_zsh_completion.sh', 'w') as f:
print(zsh_completion(), file=f)

View File

@@ -0,0 +1,90 @@
_jc()
{
local cur prev words cword jc_commands jc_parsers jc_options \
jc_about_options jc_about_mod_options jc_help_options jc_special_options
jc_commands=(acpi airport arp blkid cbt chage cksum crontab date df dig dmidecode dpkg du env file findmnt finger free git gpg hciconfig id ifconfig iostat iptables iw iwconfig jobs last lastb ls lsblk lsmod lsof lspci lsusb md5 md5sum mdadm mount mpstat netstat nmcli ntpq os-prober pidstat ping ping6 pip pip3 postconf printenv ps route rpm rsync sfdisk sha1sum sha224sum sha256sum sha384sum sha512sum shasum ss sshd stat sum sysctl systemctl systeminfo timedatectl top tracepath tracepath6 traceroute traceroute6 udevadm ufw uname update-alternatives upower uptime vdir vmstat w wc who xrandr zipinfo)
jc_parsers=(--acpi --airport --airport-s --arp --asciitable --asciitable-m --blkid --cbt --cef --cef-s --chage --cksum --clf --clf-s --crontab --crontab-u --csv --csv-s --date --datetime-iso --df --dig --dir --dmidecode --dpkg-l --du --email-address --env --file --findmnt --finger --free --fstab --git-log --git-log-s --git-ls-remote --gpg --group --gshadow --hash --hashsum --hciconfig --history --hosts --id --ifconfig --ini --iostat --iostat-s --ip-address --iptables --iw-scan --iwconfig --jar-manifest --jobs --jwt --kv --last --ls --ls-s --lsblk --lsmod --lsof --lspci --lsusb --m3u --mdadm --mount --mpstat --mpstat-s --netstat --nmcli --ntpq --openvpn --os-prober --passwd --pci-ids --pgpass --pidstat --pidstat-s --ping --ping-s --pip-list --pip-show --plist --postconf --proc --proc-buddyinfo --proc-consoles --proc-cpuinfo --proc-crypto --proc-devices --proc-diskstats --proc-filesystems --proc-interrupts --proc-iomem --proc-ioports --proc-loadavg --proc-locks --proc-meminfo --proc-modules --proc-mtrr --proc-pagetypeinfo --proc-partitions --proc-slabinfo --proc-softirqs --proc-stat --proc-swaps --proc-uptime --proc-version --proc-vmallocinfo --proc-vmstat --proc-zoneinfo --proc-driver-rtc --proc-net-arp --proc-net-dev --proc-net-dev-mcast --proc-net-if-inet6 --proc-net-igmp --proc-net-igmp6 --proc-net-ipv6-route --proc-net-netlink --proc-net-netstat --proc-net-packet --proc-net-protocols --proc-net-route --proc-net-unix --proc-pid-fdinfo --proc-pid-io --proc-pid-maps --proc-pid-mountinfo --proc-pid-numa-maps --proc-pid-smaps --proc-pid-stat --proc-pid-statm --proc-pid-status --ps --route --rpm-qi --rsync --rsync-s --semver --sfdisk --shadow --ss --sshd-conf --stat --stat-s --sysctl --syslog --syslog-s --syslog-bsd --syslog-bsd-s --systemctl --systemctl-lj --systemctl-ls --systemctl-luf --systeminfo --time --timedatectl --timestamp --top --top-s --tracepath --traceroute --udevadm --ufw --ufw-appinfo --uname --update-alt-gs --update-alt-q --upower --uptime --url --vmstat --vmstat-s --w --wc --who --x509-cert --xml --xrandr --yaml --zipinfo)
jc_options=(--force-color -C --debug -d --monochrome -m --meta-out -M --pretty -p --quiet -q --raw -r --unbuffer -u --yaml-out -y)
jc_about_options=(--about -a)
jc_about_mod_options=(--pretty -p --yaml-out -y --monochrome -m --force-color -C)
jc_help_options=(--help -h)
jc_special_options=(--version -v --bash-comp -B --zsh-comp -Z)
COMPREPLY=()
_get_comp_words_by_ref cur prev words cword
# if jc_about_options are found anywhere in the line, then only complete from jc_about_mod_options
for i in "${words[@]::${#words[@]}-1}"; do
if [[ " ${jc_about_options[*]} " =~ " ${i} " ]]; then
COMPREPLY=( $( compgen -W "${jc_about_mod_options[*]}" \
-- "${cur}" ) )
return 0
fi
done
# if jc_help_options and a parser are found anywhere in the line, then no more completions
if
(
for i in "${words[@]::${#words[@]}-1}"; do
if [[ " ${jc_help_options[*]} " =~ " ${i} " ]]; then
return 0
fi
done
return 1
) && (
for i in "${words[@]::${#words[@]}-1}"; do
if [[ " ${jc_parsers[*]} " =~ " ${i} " ]]; then
return 0
fi
done
return 1
); then
return 0
fi
# if jc_help_options are found anywhere in the line, then only complete with parsers
for i in "${words[@]::${#words[@]}-1}"; do
if [[ " ${jc_help_options[*]} " =~ " ${i} " ]]; then
COMPREPLY=( $( compgen -W "${jc_parsers[*]}" \
-- "${cur}" ) )
return 0
fi
done
# if special options are found anywhere in the line, then no more completions
for i in "${words[@]::${#words[@]}-1}"; do
if [[ " ${jc_special_options[*]} " =~ " ${i} " ]]; then
return 0
fi
done
# if magic command is found anywhere in the line, use called command's autocompletion
for i in "${words[@]::${#words[@]}-1}"; do
if [[ " ${jc_commands[*]} " =~ " ${i} " ]]; then
_command
return 0
fi
done
# if "/pr[oc]" (magic for Procfile parsers) is in the current word, complete with files/directories in the path
if [[ "${cur}" =~ "/pr" ]]; then
_filedir
return 0
fi
# if a parser arg is found anywhere in the line, only show options and help options
for i in "${words[@]::${#words[@]}-1}"; do
if [[ " ${jc_parsers[*]} " =~ " ${i} " ]]; then
COMPREPLY=( $( compgen -W "${jc_options[*]} ${jc_help_options[*]}" \
-- "${cur}" ) )
return 0
fi
done
# default completion
COMPREPLY=( $( compgen -W "${jc_options[*]} ${jc_about_options[*]} ${jc_help_options[*]} ${jc_special_options[*]} ${jc_parsers[*]} ${jc_commands[*]}" \
-- "${cur}" ) )
} &&
complete -F _jc jc

View File

@@ -0,0 +1,421 @@
#compdef jc
_jc() {
local -a jc_commands jc_commands_describe \
jc_parsers jc_parsers_describe \
jc_options jc_options_describe \
jc_about_options jc_about_options_describe \
jc_about_mod_options jc_about_mod_options_describe \
jc_help_options jc_help_options_describe \
jc_special_options jc_special_options_describe
jc_commands=(acpi airport arp blkid cbt chage cksum crontab date df dig dmidecode dpkg du env file findmnt finger free git gpg hciconfig id ifconfig iostat iptables iw iwconfig jobs last lastb ls lsblk lsmod lsof lspci lsusb md5 md5sum mdadm mount mpstat netstat nmcli ntpq os-prober pidstat ping ping6 pip pip3 postconf printenv ps route rpm rsync sfdisk sha1sum sha224sum sha256sum sha384sum sha512sum shasum ss sshd stat sum sysctl systemctl systeminfo timedatectl top tracepath tracepath6 traceroute traceroute6 udevadm ufw uname update-alternatives upower uptime vdir vmstat w wc who xrandr zipinfo)
jc_commands_describe=(
'acpi:run "acpi" command with magic syntax.'
'airport:run "airport" command with magic syntax.'
'arp:run "arp" command with magic syntax.'
'blkid:run "blkid" command with magic syntax.'
'cbt:run "cbt" command with magic syntax.'
'chage:run "chage" command with magic syntax.'
'cksum:run "cksum" command with magic syntax.'
'crontab:run "crontab" command with magic syntax.'
'date:run "date" command with magic syntax.'
'df:run "df" command with magic syntax.'
'dig:run "dig" command with magic syntax.'
'dmidecode:run "dmidecode" command with magic syntax.'
'dpkg:run "dpkg" command with magic syntax.'
'du:run "du" command with magic syntax.'
'env:run "env" command with magic syntax.'
'file:run "file" command with magic syntax.'
'findmnt:run "findmnt" command with magic syntax.'
'finger:run "finger" command with magic syntax.'
'free:run "free" command with magic syntax.'
'git:run "git" command with magic syntax.'
'gpg:run "gpg" command with magic syntax.'
'hciconfig:run "hciconfig" command with magic syntax.'
'id:run "id" command with magic syntax.'
'ifconfig:run "ifconfig" command with magic syntax.'
'iostat:run "iostat" command with magic syntax.'
'iptables:run "iptables" command with magic syntax.'
'iw:run "iw" command with magic syntax.'
'iwconfig:run "iwconfig" command with magic syntax.'
'jobs:run "jobs" command with magic syntax.'
'last:run "last" command with magic syntax.'
'lastb:run "lastb" command with magic syntax.'
'ls:run "ls" command with magic syntax.'
'lsblk:run "lsblk" command with magic syntax.'
'lsmod:run "lsmod" command with magic syntax.'
'lsof:run "lsof" command with magic syntax.'
'lspci:run "lspci" command with magic syntax.'
'lsusb:run "lsusb" command with magic syntax.'
'md5:run "md5" command with magic syntax.'
'md5sum:run "md5sum" command with magic syntax.'
'mdadm:run "mdadm" command with magic syntax.'
'mount:run "mount" command with magic syntax.'
'mpstat:run "mpstat" command with magic syntax.'
'netstat:run "netstat" command with magic syntax.'
'nmcli:run "nmcli" command with magic syntax.'
'ntpq:run "ntpq" command with magic syntax.'
'os-prober:run "os-prober" command with magic syntax.'
'pidstat:run "pidstat" command with magic syntax.'
'ping:run "ping" command with magic syntax.'
'ping6:run "ping6" command with magic syntax.'
'pip:run "pip" command with magic syntax.'
'pip3:run "pip3" command with magic syntax.'
'postconf:run "postconf" command with magic syntax.'
'printenv:run "printenv" command with magic syntax.'
'ps:run "ps" command with magic syntax.'
'route:run "route" command with magic syntax.'
'rpm:run "rpm" command with magic syntax.'
'rsync:run "rsync" command with magic syntax.'
'sfdisk:run "sfdisk" command with magic syntax.'
'sha1sum:run "sha1sum" command with magic syntax.'
'sha224sum:run "sha224sum" command with magic syntax.'
'sha256sum:run "sha256sum" command with magic syntax.'
'sha384sum:run "sha384sum" command with magic syntax.'
'sha512sum:run "sha512sum" command with magic syntax.'
'shasum:run "shasum" command with magic syntax.'
'ss:run "ss" command with magic syntax.'
'sshd:run "sshd" command with magic syntax.'
'stat:run "stat" command with magic syntax.'
'sum:run "sum" command with magic syntax.'
'sysctl:run "sysctl" command with magic syntax.'
'systemctl:run "systemctl" command with magic syntax.'
'systeminfo:run "systeminfo" command with magic syntax.'
'timedatectl:run "timedatectl" command with magic syntax.'
'top:run "top" command with magic syntax.'
'tracepath:run "tracepath" command with magic syntax.'
'tracepath6:run "tracepath6" command with magic syntax.'
'traceroute:run "traceroute" command with magic syntax.'
'traceroute6:run "traceroute6" command with magic syntax.'
'udevadm:run "udevadm" command with magic syntax.'
'ufw:run "ufw" command with magic syntax.'
'uname:run "uname" command with magic syntax.'
'update-alternatives:run "update-alternatives" command with magic syntax.'
'upower:run "upower" command with magic syntax.'
'uptime:run "uptime" command with magic syntax.'
'vdir:run "vdir" command with magic syntax.'
'vmstat:run "vmstat" command with magic syntax.'
'w:run "w" command with magic syntax.'
'wc:run "wc" command with magic syntax.'
'who:run "who" command with magic syntax.'
'xrandr:run "xrandr" command with magic syntax.'
'zipinfo:run "zipinfo" command with magic syntax.'
)
jc_parsers=(--acpi --airport --airport-s --arp --asciitable --asciitable-m --blkid --cbt --cef --cef-s --chage --cksum --clf --clf-s --crontab --crontab-u --csv --csv-s --date --datetime-iso --df --dig --dir --dmidecode --dpkg-l --du --email-address --env --file --findmnt --finger --free --fstab --git-log --git-log-s --git-ls-remote --gpg --group --gshadow --hash --hashsum --hciconfig --history --hosts --id --ifconfig --ini --iostat --iostat-s --ip-address --iptables --iw-scan --iwconfig --jar-manifest --jobs --jwt --kv --last --ls --ls-s --lsblk --lsmod --lsof --lspci --lsusb --m3u --mdadm --mount --mpstat --mpstat-s --netstat --nmcli --ntpq --openvpn --os-prober --passwd --pci-ids --pgpass --pidstat --pidstat-s --ping --ping-s --pip-list --pip-show --plist --postconf --proc --proc-buddyinfo --proc-consoles --proc-cpuinfo --proc-crypto --proc-devices --proc-diskstats --proc-filesystems --proc-interrupts --proc-iomem --proc-ioports --proc-loadavg --proc-locks --proc-meminfo --proc-modules --proc-mtrr --proc-pagetypeinfo --proc-partitions --proc-slabinfo --proc-softirqs --proc-stat --proc-swaps --proc-uptime --proc-version --proc-vmallocinfo --proc-vmstat --proc-zoneinfo --proc-driver-rtc --proc-net-arp --proc-net-dev --proc-net-dev-mcast --proc-net-if-inet6 --proc-net-igmp --proc-net-igmp6 --proc-net-ipv6-route --proc-net-netlink --proc-net-netstat --proc-net-packet --proc-net-protocols --proc-net-route --proc-net-unix --proc-pid-fdinfo --proc-pid-io --proc-pid-maps --proc-pid-mountinfo --proc-pid-numa-maps --proc-pid-smaps --proc-pid-stat --proc-pid-statm --proc-pid-status --ps --route --rpm-qi --rsync --rsync-s --semver --sfdisk --shadow --ss --sshd-conf --stat --stat-s --sysctl --syslog --syslog-s --syslog-bsd --syslog-bsd-s --systemctl --systemctl-lj --systemctl-ls --systemctl-luf --systeminfo --time --timedatectl --timestamp --top --top-s --tracepath --traceroute --udevadm --ufw --ufw-appinfo --uname --update-alt-gs --update-alt-q --upower --uptime --url --vmstat --vmstat-s --w --wc --who --x509-cert --xml --xrandr --yaml --zipinfo)
jc_parsers_describe=(
'--acpi:`acpi` command parser'
'--airport:`airport -I` command parser'
'--airport-s:`airport -s` command parser'
'--arp:`arp` command parser'
'--asciitable:ASCII and Unicode table parser'
'--asciitable-m:multi-line ASCII and Unicode table parser'
'--blkid:`blkid` command parser'
'--cbt:`cbt` (Google Bigtable) command parser'
'--cef:CEF string parser'
'--cef-s:CEF string streaming parser'
'--chage:`chage --list` command parser'
'--cksum:`cksum` and `sum` command parser'
'--clf:Common and Combined Log Format file parser'
'--clf-s:Common and Combined Log Format file streaming parser'
'--crontab:`crontab` command and file parser'
'--crontab-u:`crontab` file parser with user support'
'--csv:CSV file parser'
'--csv-s:CSV file streaming parser'
'--date:`date` command parser'
'--datetime-iso:ISO 8601 Datetime string parser'
'--df:`df` command parser'
'--dig:`dig` command parser'
'--dir:`dir` command parser'
'--dmidecode:`dmidecode` command parser'
'--dpkg-l:`dpkg -l` command parser'
'--du:`du` command parser'
'--email-address:Email Address string parser'
'--env:`env` command parser'
'--file:`file` command parser'
'--findmnt:`findmnt` command parser'
'--finger:`finger` command parser'
'--free:`free` command parser'
'--fstab:`/etc/fstab` file parser'
'--git-log:`git log` command parser'
'--git-log-s:`git log` command streaming parser'
'--git-ls-remote:`git ls-remote` command parser'
'--gpg:`gpg --with-colons` command parser'
'--group:`/etc/group` file parser'
'--gshadow:`/etc/gshadow` file parser'
'--hash:`hash` command parser'
'--hashsum:hashsum command parser (`md5sum`, `shasum`, etc.)'
'--hciconfig:`hciconfig` command parser'
'--history:`history` command parser'
'--hosts:`/etc/hosts` file parser'
'--id:`id` command parser'
'--ifconfig:`ifconfig` command parser'
'--ini:INI file parser'
'--iostat:`iostat` command parser'
'--iostat-s:`iostat` command streaming parser'
'--ip-address:IPv4 and IPv6 Address string parser'
'--iptables:`iptables` command parser'
'--iw-scan:`iw dev [device] scan` command parser'
'--iwconfig:`iwconfig` command parser'
'--jar-manifest:Java MANIFEST.MF file parser'
'--jobs:`jobs` command parser'
'--jwt:JWT string parser'
'--kv:Key/Value file and string parser'
'--last:`last` and `lastb` command parser'
'--ls:`ls` command parser'
'--ls-s:`ls` command streaming parser'
'--lsblk:`lsblk` command parser'
'--lsmod:`lsmod` command parser'
'--lsof:`lsof` command parser'
'--lspci:`lspci -mmv` command parser'
'--lsusb:`lsusb` command parser'
'--m3u:M3U and M3U8 file parser'
'--mdadm:`mdadm` command parser'
'--mount:`mount` command parser'
'--mpstat:`mpstat` command parser'
'--mpstat-s:`mpstat` command streaming parser'
'--netstat:`netstat` command parser'
'--nmcli:`nmcli` command parser'
'--ntpq:`ntpq -p` command parser'
'--openvpn:openvpn-status.log file parser'
'--os-prober:`os-prober` command parser'
'--passwd:`/etc/passwd` file parser'
'--pci-ids:`pci.ids` file parser'
'--pgpass:PostgreSQL password file parser'
'--pidstat:`pidstat -H` command parser'
'--pidstat-s:`pidstat -H` command streaming parser'
'--ping:`ping` and `ping6` command parser'
'--ping-s:`ping` and `ping6` command streaming parser'
'--pip-list:`pip list` command parser'
'--pip-show:`pip show` command parser'
'--plist:PLIST file parser'
'--postconf:`postconf -M` command parser'
'--proc:`/proc/` file parser'
'--proc-buddyinfo:`/proc/buddyinfo` file parser'
'--proc-consoles:`/proc/consoles` file parser'
'--proc-cpuinfo:`/proc/cpuinfo` file parser'
'--proc-crypto:`/proc/crypto` file parser'
'--proc-devices:`/proc/devices` file parser'
'--proc-diskstats:`/proc/diskstats` file parser'
'--proc-filesystems:`/proc/filesystems` file parser'
'--proc-interrupts:`/proc/interrupts` file parser'
'--proc-iomem:`/proc/iomem` file parser'
'--proc-ioports:`/proc/ioports` file parser'
'--proc-loadavg:`/proc/loadavg` file parser'
'--proc-locks:`/proc/locks` file parser'
'--proc-meminfo:`/proc/meminfo` file parser'
'--proc-modules:`/proc/modules` file parser'
'--proc-mtrr:`/proc/mtrr` file parser'
'--proc-pagetypeinfo:`/proc/pagetypeinfo` file parser'
'--proc-partitions:`/proc/partitions` file parser'
'--proc-slabinfo:`/proc/slabinfo` file parser'
'--proc-softirqs:`/proc/softirqs` file parser'
'--proc-stat:`/proc/stat` file parser'
'--proc-swaps:`/proc/swaps` file parser'
'--proc-uptime:`/proc/uptime` file parser'
'--proc-version:`/proc/version` file parser'
'--proc-vmallocinfo:`/proc/vmallocinfo` file parser'
'--proc-vmstat:`/proc/vmstat` file parser'
'--proc-zoneinfo:`/proc/zoneinfo` file parser'
'--proc-driver-rtc:`/proc/driver/rtc` file parser'
'--proc-net-arp:`/proc/net/arp` file parser'
'--proc-net-dev:`/proc/net/dev` file parser'
'--proc-net-dev-mcast:`/proc/net/dev_mcast` file parser'
'--proc-net-if-inet6:`/proc/net/if_inet6` file parser'
'--proc-net-igmp:`/proc/net/igmp` file parser'
'--proc-net-igmp6:`/proc/net/igmp6` file parser'
'--proc-net-ipv6-route:`/proc/net/ipv6_route` file parser'
'--proc-net-netlink:`/proc/net/netlink` file parser'
'--proc-net-netstat:`/proc/net/netstat` file parser'
'--proc-net-packet:`/proc/net/packet` file parser'
'--proc-net-protocols:`/proc/net/protocols` file parser'
'--proc-net-route:`/proc/net/route` file parser'
'--proc-net-unix:`/proc/net/unix` file parser'
'--proc-pid-fdinfo:`/proc/<pid>/fdinfo/<fd>` file parser'
'--proc-pid-io:`/proc/<pid>/io` file parser'
'--proc-pid-maps:`/proc/<pid>/maps` file parser'
'--proc-pid-mountinfo:`/proc/<pid>/mountinfo` file parser'
'--proc-pid-numa-maps:`/proc/<pid>/numa_maps` file parser'
'--proc-pid-smaps:`/proc/<pid>/smaps` file parser'
'--proc-pid-stat:`/proc/<pid>/stat` file parser'
'--proc-pid-statm:`/proc/<pid>/statm` file parser'
'--proc-pid-status:`/proc/<pid>/status` file parser'
'--ps:`ps` command parser'
'--route:`route` command parser'
'--rpm-qi:`rpm -qi` command parser'
'--rsync:`rsync` command parser'
'--rsync-s:`rsync` command streaming parser'
'--semver:Semantic Version string parser'
'--sfdisk:`sfdisk` command parser'
'--shadow:`/etc/shadow` file parser'
'--ss:`ss` command parser'
'--sshd-conf:sshd config file and `sshd -T` command parser'
'--stat:`stat` command parser'
'--stat-s:`stat` command streaming parser'
'--sysctl:`sysctl` command parser'
'--syslog:Syslog RFC 5424 string parser'
'--syslog-s:Syslog RFC 5424 string streaming parser'
'--syslog-bsd:Syslog RFC 3164 string parser'
'--syslog-bsd-s:Syslog RFC 3164 string streaming parser'
'--systemctl:`systemctl` command parser'
'--systemctl-lj:`systemctl list-jobs` command parser'
'--systemctl-ls:`systemctl list-sockets` command parser'
'--systemctl-luf:`systemctl list-unit-files` command parser'
'--systeminfo:`systeminfo` command parser'
'--time:`/usr/bin/time` command parser'
'--timedatectl:`timedatectl status` command parser'
'--timestamp:Unix Epoch Timestamp string parser'
'--top:`top -b` command parser'
'--top-s:`top -b` command streaming parser'
'--tracepath:`tracepath` and `tracepath6` command parser'
'--traceroute:`traceroute` and `traceroute6` command parser'
'--udevadm:`udevadm info` command parser'
'--ufw:`ufw status` command parser'
'--ufw-appinfo:`ufw app info [application]` command parser'
'--uname:`uname -a` command parser'
'--update-alt-gs:`update-alternatives --get-selections` command parser'
'--update-alt-q:`update-alternatives --query` command parser'
'--upower:`upower` command parser'
'--uptime:`uptime` command parser'
'--url:URL string parser'
'--vmstat:`vmstat` command parser'
'--vmstat-s:`vmstat` command streaming parser'
'--w:`w` command parser'
'--wc:`wc` command parser'
'--who:`who` command parser'
'--x509-cert:X.509 PEM and DER certificate file parser'
'--xml:XML file parser'
'--xrandr:`xrandr` command parser'
'--yaml:YAML file parser'
'--zipinfo:`zipinfo` command parser'
)
jc_options=(--force-color -C --debug -d --monochrome -m --meta-out -M --pretty -p --quiet -q --raw -r --unbuffer -u --yaml-out -y)
jc_options_describe=(
'--force-color:force color output (overrides -m)'
'-C:force color output (overrides -m)'
'--debug:debug (double for verbose debug)'
'-d:debug (double for verbose debug)'
'--monochrome:monochrome output'
'-m:monochrome output'
'--meta-out:add metadata to output including timestamp, etc.'
'-M:add metadata to output including timestamp, etc.'
'--pretty:pretty print output'
'-p:pretty print output'
'--quiet:suppress warnings (double to ignore streaming errors)'
'-q:suppress warnings (double to ignore streaming errors)'
'--raw:raw output'
'-r:raw output'
'--unbuffer:unbuffer output'
'-u:unbuffer output'
'--yaml-out:YAML output'
'-y:YAML output'
)
jc_about_options=(--about -a)
jc_about_options_describe=(
'--about:about jc'
'-a:about jc'
)
jc_about_mod_options=(--pretty -p --yaml-out -y --monochrome -m --force-color -C)
jc_about_mod_options_describe=(
'--pretty:pretty print output'
'-p:pretty print output'
'--yaml-out:YAML output'
'-y:YAML output'
'--monochrome:monochrome output'
'-m:monochrome output'
'--force-color:force color output (overrides -m)'
'-C:force color output (overrides -m)'
)
jc_help_options=(--help -h)
jc_help_options_describe=(
'--help:help (--help --parser_name for parser documentation)'
'-h:help (--help --parser_name for parser documentation)'
)
jc_special_options=(--version -v --bash-comp -B --zsh-comp -Z)
jc_special_options_describe=(
'--version:version info'
'-v:version info'
'--bash-comp:gen Bash completion: jc -B > /etc/bash_completion.d/jc'
'-B:gen Bash completion: jc -B > /etc/bash_completion.d/jc'
'--zsh-comp:gen Zsh completion: jc -Z > "${fpath[1]}/_jc"'
'-Z:gen Zsh completion: jc -Z > "${fpath[1]}/_jc"'
)
# if jc_about_options are found anywhere in the line, then only complete from jc_about_mod_options
for i in ${words:0:-1}; do
if (( $jc_about_options[(Ie)${i}] )); then
_describe 'commands' jc_about_mod_options_describe
return 0
fi
done
# if jc_help_options and a parser are found anywhere in the line, then no more completions
if
(
for i in ${words:0:-1}; do
if (( $jc_help_options[(Ie)${i}] )); then
return 0
fi
done
return 1
) && (
for i in ${words:0:-1}; do
if (( $jc_parsers[(Ie)${i}] )); then
return 0
fi
done
return 1
); then
return 0
fi
# if jc_help_options are found anywhere in the line, then only complete with parsers
for i in ${words:0:-1}; do
if (( $jc_help_options[(Ie)${i}] )); then
_describe 'commands' jc_parsers_describe
return 0
fi
done
# if special options are found anywhere in the line, then no more completions
for i in ${words:0:-1}; do
if (( $jc_special_options[(Ie)${i}] )); then
return 0
fi
done
# if magic command is found anywhere in the line, use called command's autocompletion
for i in ${words:0:-1}; do
if (( $jc_commands[(Ie)${i}] )); then
# hack to remove options between jc and the magic command
shift $(( ${#words} - 2 )) words
words[1,0]=(jc)
CURRENT=${#words}
# run the magic command's completions
_arguments '*::arguments:_normal'
return 0
fi
done
# if "/pr[oc]" (magic for Procfile parsers) is in the current word, complete with files/directories in the path
if [[ "${words[-1]}" =~ "/pr" ]]; then
# run files completion
_files
return 0
fi
# if a parser arg is found anywhere in the line, only show options and help options
for i in ${words:0:-1}; do
if (( $jc_parsers[(Ie)${i}] )); then
_describe 'commands' jc_options_describe -- jc_help_options_describe
return 0
fi
done
# default completion
_describe 'commands' jc_options_describe -- jc_about_options_describe -- jc_help_options_describe -- jc_special_options_describe -- jc_parsers_describe -- jc_commands_describe
}
_jc

143
docgen.sh
View File

@@ -1,44 +1,139 @@
#!/bin/bash
# Generate docs.md
# requires pydoc-markdown 2.1.0.post1
# requires pydoc-markdown 4.6.1
# use ./docgen all to generate all docs
readme_config=$(cat <<'EOF'
{
"processors": [
{
"type": "filter"
},
{
"type": "pydocmd"
}
],
"renderer": {
"type": "markdown",
"header_level_by_type": {
"Module": 1,
"Class": 3,
"Method": 3,
"Function": 3,
"Variable": 3
}
}
}
EOF
)
toc_config=$(cat <<'EOF'
{
"processors": [
{
"type": "filter"
},
{
"type": "pydocmd"
}
],
"renderer": {
"type": "markdown",
"render_toc": true,
"header_level_by_type": {
"Module": 1,
"Class": 3,
"Method": 3,
"Function": 3,
"Variable": 3
}
}
}
EOF
)
parser_config=$(cat <<'EOF'
{
"processors": [
{
"type": "filter",
"expression": "not name == \"info\" and not name.startswith(\"_\") and default()"
},
{
"type": "pydocmd"
}
],
"renderer": {
"type": "markdown",
"header_level_by_type": {
"Module": 1,
"Class": 3,
"Method": 3,
"Function": 3,
"Variable": 3
}
}
}
EOF
)
cd jc
echo Building docs for: package
pydocmd simple jc+ > ../docs/readme.md
(
echo Building docs for: package
pydoc-markdown -m jc "${readme_config}" > ../docs/readme.md; echo "+++ package docs complete"
) &
echo Building docs for: lib
pydocmd simple lib+ > ../docs/lib.md
(
echo Building docs for: lib
pydoc-markdown -m jc.lib "${toc_config}" > ../docs/lib.md; echo "+++ lib docs complete"
) &
echo Building docs for: utils
pydocmd simple utils+ > ../docs/utils.md
(
echo Building docs for: utils
pydoc-markdown -m jc.utils "${toc_config}" > ../docs/utils.md; echo "+++ utils docs complete"
) &
echo Building docs for: universal parser
pydocmd simple jc.parsers.universal+ > ../docs/parsers/universal.md
(
echo Building docs for: streaming
pydoc-markdown -m jc.streaming "${toc_config}" > ../docs/streaming.md; echo "+++ streaming docs complete"
) &
(
echo Building docs for: universal parser
pydoc-markdown -m jc.parsers.universal "${toc_config}" > ../docs/parsers/universal.md; echo "+++ universal parser docs complete"
) &
# a bit of inception here... jc is being used to help
# automate the generation of its own documentation. :)
# pull jc parser objects into a bash array from jq
# filter out any plugin parsers
parsers=()
while read -r value
do
parsers+=("$value")
done < <(jc -a | jq -c '.parsers[]')
done < <(jc -a | jq -c '.parsers[] | select(.plugin != true)')
# iterate over the bash array
for parser in "${parsers[@]}"
do
for parser in "${parsers[@]}"; do
parser_name=$(jq -r '.name' <<< "$parser")
compatible=$(jq -r '.compatible | join(", ")' <<< "$parser")
version=$(jq -r '.version' <<< "$parser")
author=$(jq -r '.author' <<< "$parser")
author_email=$(jq -r '.author_email' <<< "$parser")
{
if [[ $1 == "all" ]] || ! git diff --quiet --exit-code HEAD~5 -- "parsers/${parser_name}.py"; then
compatible=$(jq -r '.compatible | join(", ")' <<< "$parser")
version=$(jq -r '.version' <<< "$parser")
author=$(jq -r '.author' <<< "$parser")
author_email=$(jq -r '.author_email' <<< "$parser")
echo "Building docs for: ${parser_name}"
echo "[Home](https://kellyjonbrazil.github.io/jc/)" > ../docs/parsers/"${parser_name}".md
pydocmd simple jc.parsers."${parser_name}"+ >> ../docs/parsers/"${parser_name}".md
echo "## Parser Information" >> ../docs/parsers/"${parser_name}".md
echo "Compatibility: ${compatible}" >> ../docs/parsers/"${parser_name}".md
echo >> ../docs/parsers/"${parser_name}".md
echo "Version ${version} by ${author} (${author_email})" >> ../docs/parsers/"${parser_name}".md
echo "Building docs for: ${parser_name}"
echo "[Home](https://kellyjonbrazil.github.io/jc/)" > ../docs/parsers/"${parser_name}".md
pydoc-markdown -m jc.parsers."${parser_name}" "${parser_config}" >> ../docs/parsers/"${parser_name}".md
echo "### Parser Information" >> ../docs/parsers/"${parser_name}".md
echo "Compatibility: ${compatible}" >> ../docs/parsers/"${parser_name}".md
echo >> ../docs/parsers/"${parser_name}".md
echo "Version ${version} by ${author} (${author_email})" >> ../docs/parsers/"${parser_name}".md
echo "+++ ${parser_name} docs complete"
fi
} &
done
wait
echo "Document Generation Complete"

View File

@@ -1,33 +1,68 @@
# Table of Contents
# lib
jc - JSON CLI output utility
JC lib module
* [jc.lib](#jc.lib)
* [parse](#jc.lib.parse)
* [parser\_mod\_list](#jc.lib.parser_mod_list)
* [plugin\_parser\_mod\_list](#jc.lib.plugin_parser_mod_list)
* [standard\_parser\_mod\_list](#jc.lib.standard_parser_mod_list)
* [streaming\_parser\_mod\_list](#jc.lib.streaming_parser_mod_list)
* [parser\_info](#jc.lib.parser_info)
* [all\_parser\_info](#jc.lib.all_parser_info)
* [get\_help](#jc.lib.get_help)
<a id="jc.lib"></a>
# jc.lib
jc - JSON Convert lib module
<a id="jc.lib.parse"></a>
### parse
## parse
```python
parse(parser_mod_name,
data,
quiet=False,
raw=False,
ignore_exceptions=None,
**kwargs)
def parse(
parser_mod_name: Union[str, ModuleType],
data: Union[str, bytes, Iterable[str]],
quiet: bool = False,
raw: bool = False,
ignore_exceptions: bool = None,
**kwargs
) -> Union[JSONDictType, List[JSONDictType], Iterator[JSONDictType]]
```
Parse the string data using the supplied parser module.
Parse the data (string or bytes) using the supplied parser (string or
module object).
This function provides a high-level API to simplify parser use. This
function will call built-in parsers and custom plugin parsers.
Example:
Example (standard parsers):
>>> import jc
>>> jc.parse('date', 'Tue Jan 18 10:23:07 PST 2022')
{'year': 2022, 'month': 'Jan', 'month_num': 1, 'day'...}
>>> date_obj = jc.parse('date', 'Tue Jan 18 10:23:07 PST 2022')
>>> print(f'The year is: {date_obj["year"]}')
The year is: 2022
To get a list of available parser module names, use `parser_mod_list()`
or `plugin_parser_mod_list()`. `plugin_parser_mod_list()` is a subset
of `parser_mod_list()`.
Example (streaming parsers):
>>> import jc
>>> ping_gen = jc.parse('ping_s', ping_output.splitlines())
>>> for item in ping_gen:
>>> print(f'Response time: {item["time_ms"]} ms')
Response time: 102 ms
Response time: 109 ms
...
To get a list of available parser module names, use `parser_mod_list()`.
Alternatively, a parser module object can be supplied:
>>> import jc
>>> import jc.parsers.date as jc_date
>>> date_obj = jc.parse(jc_date, 'Tue Jan 18 10:23:07 PST 2022')
>>> print(f'The year is: {date_obj["year"]}')
The year is: 2022
You can also use the lower-level parser modules directly:
@@ -49,11 +84,17 @@ parsers without this API:
Parameters:
parser_mod_name: (string) name of the parser module
parser_mod_name: (string or name of the parser module. This
Module) function will accept module_name,
cli-name, and --argument-name
variants of the module name.
data: (string or data to parse (string for normal
iterator) parsers, iterator of strings for
streaming parsers)
A Module object can also be passed
directly or via _get_parser()
data: (string or data to parse (string or bytes for
bytes or standard parsers, iterable of
iterable) strings for streaming parsers)
raw: (boolean) output preprocessed JSON if True
@@ -67,24 +108,108 @@ Returns:
Standard Parsers: Dictionary or List of Dictionaries
Streaming Parsers: Generator Object containing Dictionaries
<a id="jc.lib.parser_mod_list"></a>
### parser\_mod\_list
## parser_mod_list
```python
parser_mod_list()
def parser_mod_list(show_hidden: bool = False,
show_deprecated: bool = False) -> List[str]
```
Returns a list of all available parser module names.
## plugin_parser_mod_list
<a id="jc.lib.plugin_parser_mod_list"></a>
### plugin\_parser\_mod\_list
```python
plugin_parser_mod_list()
def plugin_parser_mod_list(show_hidden: bool = False,
show_deprecated: bool = False) -> List[str]
```
Returns a list of plugin parser module names. This function is a
subset of `parser_mod_list()`.
<a id="jc.lib.standard_parser_mod_list"></a>
### standard\_parser\_mod\_list
## get_help
```python
get_help(parser_mod_name)
def standard_parser_mod_list(show_hidden: bool = False,
show_deprecated: bool = False) -> List[str]
```
Returns a list of standard parser module names. This function is a
subset of `parser_mod_list()` and does not contain any streaming
parsers.
<a id="jc.lib.streaming_parser_mod_list"></a>
### streaming\_parser\_mod\_list
```python
def streaming_parser_mod_list(show_hidden: bool = False,
show_deprecated: bool = False) -> List[str]
```
Returns a list of streaming parser module names. This function is a
subset of `parser_mod_list()`.
<a id="jc.lib.parser_info"></a>
### parser\_info
```python
def parser_info(parser_mod_name: Union[str, ModuleType],
documentation: bool = False) -> ParserInfoType
```
Returns a dictionary that includes the parser module metadata.
Parameters:
parser_mod_name: (string or name of the parser module. This
Module) function will accept module_name,
cli-name, and --argument-name
variants of the module name as well
as a parser module object.
documentation: (boolean) include parser docstring if True
<a id="jc.lib.all_parser_info"></a>
### all\_parser\_info
```python
def all_parser_info(documentation: bool = False,
show_hidden: bool = False,
show_deprecated: bool = False) -> List[ParserInfoType]
```
Returns a list of dictionaries that includes metadata for all parser
modules. By default only non-hidden, non-deprecated parsers are
returned.
Parameters:
documentation: (boolean) include parser docstrings if True
show_hidden: (boolean) also show parsers marked as hidden
in their info metadata.
show_deprecated: (boolean) also show parsers marked as
deprecated in their info metadata.
<a id="jc.lib.get_help"></a>
### get\_help
```python
def get_help(parser_mod_name: Union[str, ModuleType]) -> None
```
Show help screen for the selected parser.
This function will accept **module_name**, **cli-name**, and
**--argument-name** variants of the module name string as well as a
parser module object.

View File

@@ -1,13 +1,15 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.acpi"></a>
# jc.parsers.acpi
jc - JSON CLI output utility `acpi` command output parser
jc - JSON Convert `acpi` command output parser
Usage (cli):
$ acpi -V | jc --acpi
or
or
$ jc acpi -V
@@ -16,11 +18,6 @@ Usage (module):
import jc
result = jc.parse('acpi', acpi_command_output)
or
import jc.parsers.acpi
result = jc.parsers.acpi.parse(acpi_command_output)
Schema:
[
@@ -230,16 +227,12 @@ Examples:
}
]
<a id="jc.parsers.acpi.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -254,7 +247,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.airport"></a>
# jc.parsers.airport
jc - JSON CLI output utility `airport -I` command output parser
jc - JSON Convert `airport -I` command output parser
The `airport` program can be found at `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport`.
@@ -9,7 +11,7 @@ Usage (cli):
$ airport -I | jc --airport
or
or
$ jc airport -I
@@ -18,11 +20,6 @@ Usage (module):
import jc
result = jc.parse('airport', airport_command_output)
or
import jc.parsers.airport
result = jc.parsers.airport.parse(airport_command_output)
Schema:
{
@@ -83,16 +80,12 @@ Examples:
"channel": "48,80"
}
<a id="jc.parsers.airport.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -107,7 +100,7 @@ Returns:
Dictionary. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: darwin
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.airport_s"></a>
# jc.parsers.airport_s
jc - JSON CLI output utility `airport -s` command output parser
# jc.parsers.airport\_s
jc - JSON Convert `airport -s` command output parser
The `airport` program can be found at `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport`.
@@ -9,7 +11,7 @@ Usage (cli):
$ airport -s | jc --airport-s
or
or
$ jc airport -s
@@ -18,11 +20,6 @@ Usage (module):
import jc
result = jc.parse('airport_s', airport_s_command_output)
or
import jc.parsers.airport_s
result = jc.parsers.airport_s.parse(airport_s_command_output)
Schema:
[
@@ -111,16 +108,12 @@ Examples:
...
]
<a id="jc.parsers.airport_s.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -135,7 +128,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: darwin
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.arp"></a>
# jc.parsers.arp
jc - JSON CLI output utility `arp` command output parser
jc - JSON Convert `arp` command output parser
Supports `arp` and `arp -a` output.
@@ -9,7 +11,7 @@ Usage (cli):
$ arp | jc --arp
or
or
$ jc arp
@@ -18,11 +20,6 @@ Usage (module):
import jc
result = jc.parse('arp', arp_command_output)
or
import jc.parsers.arp
result = jc.parsers.arp.parse(arp_command_output)
Schema:
[
@@ -120,16 +117,12 @@ Examples:
}
]
<a id="jc.parsers.arp.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]
```
Main text parsing function
@@ -144,7 +137,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, aix, freebsd, darwin
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.11 by Kelly Brazil (kellyjonbrazil@gmail.com)

147
docs/parsers/asciitable.md Normal file
View File

@@ -0,0 +1,147 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.asciitable"></a>
# jc.parsers.asciitable
jc - JSON Convert `asciitable` parser
This parser converts ASCII and Unicode text tables with single-line rows.
Column headers must be at least two spaces apart from each other and must
be unique. For best results, column headers should be left-justified. If
column separators are present, then non-left-justified headers will be fixed
automatically.
Row separators are optional and are ignored. Each non-row-separator line is
considered a separate row in the table.
For example:
╒══════════╤═════════╤════════╕
│ foo │ bar │ baz │
╞══════════╪═════════╪════════╡
│ good day │ │ 12345 │
├──────────┼─────────┼────────┤
│ hi there │ abc def │ 3.14 │
╘══════════╧═════════╧════════╛
or
+-----------------------------+
| foo bar baz |
+-----------------------------+
| good day 12345 |
| hi there abc def 3.14 |
+-----------------------------+
or
| foo | bar | baz |
|----------|---------|--------|
| good day | | 12345 |
| hi there | abc def | 3.14 |
or
foo bar baz
--------- -------- ------
good day 12345
hi there abc def 3.14
or
foo bar baz
good day 12345
hi there abc def 3.14
etc...
Headers (keys) are converted to snake-case. All values are returned as
strings, except empty strings, which are converted to None/null.
> Note: To preserve the case of the keys use the `-r` cli option or
> `raw=True` argument in `parse()`.
Usage (cli):
$ cat table.txt | jc --asciitable
Usage (module):
import jc
result = jc.parse('asciitable', asciitable_string)
Schema:
[
{
"column_name1": string, # empty string is null
"column_name2": string # empty string is null
}
]
Examples:
$ echo '
> ╒══════════╤═════════╤════════╕
> │ foo │ bar │ baz │
> ╞══════════╪═════════╪════════╡
> │ good day │ │ 12345 │
> ├──────────┼─────────┼────────┤
> │ hi there │ abc def │ 3.14 │
> ╘══════════╧═════════╧════════╛' | jc --asciitable -p
[
{
"foo": "good day",
"bar": null,
"baz": "12345"
},
{
"foo": "hi there",
"bar": "abc def",
"baz": "3.14"
}
]
$ echo '
> foo bar baz
> --------- -------- ------
> good day 12345
> hi there abc def 3.14' | jc --asciitable -p
[
{
"foo": "good day",
"bar": null,
"baz": "12345"
},
{
"foo": "hi there",
"bar": "abc def",
"baz": "3.14"
}
]
<a id="jc.parsers.asciitable.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output 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 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -0,0 +1,132 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.asciitable_m"></a>
# jc.parsers.asciitable\_m
jc - JSON Convert `asciitable-m` parser
This parser converts various styles of ASCII and Unicode text tables with
multi-line rows. Tables must have a header row and separator line between
rows.
For example:
╒══════════╤═════════╤════════╕
│ foo │ bar baz │ fiz │
│ │ │ buz │
╞══════════╪═════════╪════════╡
│ good day │ 12345 │ │
│ mate │ │ │
├──────────┼─────────┼────────┤
│ hi there │ abc def │ 3.14 │
│ │ │ │
╘══════════╧═════════╧════════╛
Cells with multiple lines within rows will be joined with a newline
character ('\\n').
Headers (keys) are converted to snake-case and newlines between multi-line
headers are joined with an underscore. All values are returned as strings,
except empty strings, which are converted to None/null.
> Note: To preserve the case of the keys use the `-r` cli option or
> `raw=True` argument in `parse()`.
> 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()`.
Usage (cli):
$ cat table.txt | jc --asciitable-m
Usage (module):
import jc
result = jc.parse('asciitable_m', asciitable-string)
Schema:
[
{
"column_name1": string, # empty string is null
"column_name2": string # empty string is null
}
]
Examples:
$ echo '
> +----------+---------+--------+
> | foo | bar | baz |
> | | | buz |
> +==========+=========+========+
> | good day | 12345 | |
> | mate | | |
> +----------+---------+--------+
> | hi there | abc def | 3.14 |
> | | | |
> +==========+=========+========+' | jc --asciitable-m -p
[
{
"foo": "good day\\nmate",
"bar": "12345",
"baz_buz": null
},
{
"foo": "hi there",
"bar": "abc def",
"baz_buz": "3.14"
}
]
$ echo '
> ╒══════════╤═════════╤════════╕
> │ foo │ bar │ baz │
> │ │ │ buz │
> ╞══════════╪═════════╪════════╡
> │ good day │ 12345 │ │
> │ mate │ │ │
> ├──────────┼─────────┼────────┤
> │ hi there │ abc def │ 3.14 │
> │ │ │ │
> ╘══════════╧═════════╧════════╛' | jc --asciitable-m -p
[
{
"foo": "good day\\nmate",
"bar": "12345",
"baz_buz": null
},
{
"foo": "hi there",
"bar": "abc def",
"baz_buz": "3.14"
}
]
<a id="jc.parsers.asciitable_m.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output 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 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,13 +1,15 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.blkid"></a>
# jc.parsers.blkid
jc - JSON CLI output utility `blkid` command output parser
jc - JSON Convert `blkid` command output parser
Usage (cli):
$ blkid | jc --blkid
or
or
$ jc blkid
@@ -16,11 +18,6 @@ Usage (module):
import jc
result = jc.parse('blkid', blkid_command_output)
or
import jc.parsers.blkid
result = jc.parsers.blkid.parse(blkid_command_output)
Schema:
[
@@ -88,7 +85,7 @@ Examples:
{
"id_fs_uuid": "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM",
"id_fs_uuid_enc": "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM",
"id_fs_version": "LVM2\x20001",
"id_fs_version": "LVM2\\x20001",
"id_fs_type": "LVM2_member",
"id_fs_usage": "raid",
"id_iolimit_minimum_io_size": 512,
@@ -123,16 +120,12 @@ Examples:
}
]
<a id="jc.parsers.blkid.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -147,7 +140,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

125
docs/parsers/cbt.md Normal file
View File

@@ -0,0 +1,125 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.cbt"></a>
# jc.parsers.cbt
jc - JSON Convert `cbt` command output parser (Google Bigtable)
Parses the human-, but not machine-, friendly output of the cbt command (for
Google's Bigtable).
No effort is made to convert the data types of the values in the cells.
The `timestamp_epoch` calculated timestamp field is naive. (i.e. based on
the local time of the system the parser is run on)
The `timestamp_epoch_utc` calculated timestamp field is timezone-aware and
is only available if the timestamp has a UTC timezone.
The `timestamp_iso` calculated timestamp field will only include UTC
timezone information if the timestamp has a UTC timezone.
Raw output contains all cells for each column (including timestamps), while
the normal output contains only the latest value for each column.
Usage (cli):
$ cbt | jc --cbt
or
$ jc cbt
Usage (module):
import jc
result = jc.parse('cbt', cbt_command_output)
Schema:
[
{
"key": string,
"cells": {
<string>: { # column family
<string>: string # column: value
}
}
}
]
Schema (raw):
[
{
"key": string,
"cells": [
{
"column_family": string,
"column": string,
"value": string,
"timestamp_iso": string,
"timestamp_epoch": integer,
"timestamp_epoch_utc": integer
}
]
}
]
Examples:
$ cbt -project=$PROJECT -instance=$INSTANCE lookup $TABLE foo | jc --cbt -p
[
{
"key": "foo",
"cells": {
"foo": {
"bar": "baz"
}
}
}
]
$ cbt -project=$PROJECT -instance=$INSTANCE lookup $TABLE foo | jc --cbt -p -r
[
{
"key": "foo",
"cells": [
{
"column_family": "foo",
"column": "bar",
"value": "baz1",
"timestamp_iso": "1970-01-01T01:00:00",
"timestamp_epoch": 32400,
"timestamp_epoch_utc": null
}
]
}
]
<a id="jc.parsers.cbt.parse"></a>
### parse
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output 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 1.0 by Andreas Weiden (andreas.weiden@gmail.com)

146
docs/parsers/cef.md Normal file
View File

@@ -0,0 +1,146 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.cef"></a>
# jc.parsers.cef
jc - JSON Convert CEF string parser
This parser conforms to the Microfocus Arcsight CEF specification.
This parser will accept a single CEF string or multiple CEF string lines.
Any text before "CEF" will be ignored. Syslog and CEF escaped characters
(`\\`, `\\"`, `\\]`, `\\|`, `\\=`, `\\%`, `\\#`, `\\n`, and `\\r`) are
unescaped.
Extended fields, as defined in the CEF specification, are relabeled
and the values are converted to their respective types. Extra naive and
UTC epoch timestamps are added where appropriate per the CEF specification.
A warning message to `STDERR` will be printed if an unparsable line is found
unless `--quiet` or `quiet=True` is used.
To preserve escaping and original keynames and to prevent type conversions
use the `--raw` CLI option or `raw=True` param in the `parse()` function.
Usage (cli):
$ echo 'CEF:0|Vendor|Product|3.2.0|1|SYSTEM|1|... | jc --cef
Usage (module):
import jc
result = jc.parse('cef', cef_string_output)
Schema:
See: https://www.microfocus.com/documentation/arcsight/arcsight-smartconnectors-8.3/cef-implementation-standard/Content/CEF/Chapter%201%20What%20is%20CEF.htm
> Note: Special characters in key names will be converted to underscores.
[
{
"deviceVendor": string,
"deviceProduct": string,
"deviceVersion": string,
"deviceEventClassId": string,
"deviceEventClassIdNum": integer/null,
"name": string,
"agentSeverity": string/integer,
"agentSeverityString": string,
"agentSeverityNum": integer/null,
"CEFVersion": integer,
<extended fields> string/integer/float, # [0]
<extended fields>"_epoch": integer/null, # [1]
<extended fields>"_epoch_utc": integer/null, # [2]
<custom fields> string,
"unparsable": string # [3]
}
]
[0] Will attempt to convert extended fields to the type specified in the
CEF specification. If conversion fails, then the field will remain
a string.
[1] Naive calculated epoch timestamp
[2] Timezone-aware calculated epoch timestamp. (UTC only) This value
will be null if a UTC timezone cannot be extracted from the original
timestamp string value.
[3] This field exists if the CEF line is not parsable. The value
is the original syslog line.
Examples:
$ cat cef.log | jc --cef -p
[
{
"deviceVendor": "Trend Micro",
"deviceProduct": "Deep Security Agent",
"deviceVersion": "<DSA version>",
"deviceEventClassId": "4000000",
"name": "Eicar_test_file",
"agentSeverity": 6,
"CEFVersion": 0,
"dvchost": "hostname",
"string": "hello \"world\"!",
"start": "Nov 08 2020 12:30:00.111 UTC",
"start_epoch": 1604867400,
"start_epoch_utc": 1604838600,
"Host_ID": 1,
"Quarantine": 205,
"myDate": "Nov 08 2022 12:30:00.111",
"myDate_epoch": 1667939400,
"myDate_epoch_utc": null,
"myFloat": 3.14,
"deviceEventClassIdNum": 4000000,
"agentSeverityString": "Medium",
"agentSeverityNum": 6
}
]
$ cat cef.log | jc --cef -p -r
[
{
"deviceVendor": "Trend Micro",
"deviceProduct": "Deep Security Agent",
"deviceVersion": "<DSA version>",
"deviceEventClassId": "4000000",
"name": "Eicar_test_file",
"agentSeverity": "6",
"CEFVersion": "0",
"cn1": "1",
"cn1Label": "Host ID",
"dvchost": "hostname",
"cn2": "205",
"cn2Label": "Quarantine",
"string": "hello \\\"world\\\"!",
"start": "Nov 08 2020 12:30:00.111 UTC",
"deviceCustomDate1": "Nov 08 2022 12:30:00.111",
"deviceCustomDate1Label": "myDate",
"cfp1": "3.14",
"cfp1Label": "myFloat"
}
]
<a id="jc.parsers.cef.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output 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 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

124
docs/parsers/cef_s.md Normal file
View File

@@ -0,0 +1,124 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.cef_s"></a>
# jc.parsers.cef\_s
jc - JSON Convert CEF string output streaming parser
> This streaming parser outputs JSON Lines (cli) or returns an Iterable of
> Dictionaries (module)
This parser conforms to the Microfocus Arcsight CEF specification.
This parser will accept a single CEF string or multiple CEF string lines.
Any text before "CEF" will be ignored. Syslog and CEF escaped characters
(`\\`, `\\"`, `\\]`, `\\|`, `\\=`, `\\%`, `\\#`, `\\n`, and `\\r`) are
unescaped.
Extended fields, as defined in the CEF specification, are relabeled
and the values are converted to their respective types. Extra naive and
UTC epoch timestamps are added where appropriate per the CEF specification.
A warning message to `STDERR` will be printed if an unparsable line is found
unless `--quiet` or `quiet=True` is used.
To preserve escaping and original keynames and to prevent type conversions
use the `--raw` CLI option or `raw=True` param in the `parse()` function.
Usage (cli):
$ echo 'CEF:0|Vendor|Product|3.2.0|1|SYSTEM|1|... | jc --cef-s
Usage (module):
import jc
result = jc.parse('cef_s', cef_command_output.splitlines())
for item in result:
# do something
Schema:
See: https://www.microfocus.com/documentation/arcsight/arcsight-smartconnectors-8.3/cef-implementation-standard/Content/CEF/Chapter%201%20What%20is%20CEF.htm
> Note: Special characters in key names will be converted to underscores.
{
"deviceVendor": string,
"deviceProduct": string,
"deviceVersion": string,
"deviceEventClassId": string,
"deviceEventClassIdNum": integer/null,
"name": string,
"agentSeverity": string/integer,
"agentSeverityString": string,
"agentSeverityNum": integer/null,
"CEFVersion": integer,
<extended fields> string/integer/float, # [0]
<extended fields>"_epoch": integer/null, # [1]
<extended fields>"_epoch_utc": integer/null, # [2]
<custom fields> string,
"unparsable": string # [3]
# below object only exists if using -qq or ignore_exceptions=True
"_jc_meta": {
"success": boolean, # false if error parsing
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
}
[0] Will attempt to convert extended fields to the type specified in the
CEF specification. If conversion fails, then the field will remain
a string.
[1] Naive calculated epoch timestamp
[2] Timezone-aware calculated epoch timestamp. (UTC only) This value
will be null if a UTC timezone cannot be extracted from the original
timestamp string value.
[3] This field exists if the CEF line is not parsable. The value
is the original syslog line.
Examples:
$ cat cef.log | jc --cef-s
{"deviceVendor":"Fortinet","deviceProduct":"FortiDeceptor","deviceV...}
{"deviceVendor":"Trend Micro","deviceProduct":"Deep Security Agent"...}
...
$ cat cef.log | jc --cef-s -r
{"deviceVendor":"Fortinet","deviceProduct":"FortiDeceptor","deviceV...}
{"deviceVendor":"Trend Micro","deviceProduct":"Deep Security Agent"...}
...
<a id="jc.parsers.cef_s.parse"></a>
### parse
```python
@add_jc_meta
def parse(data: Iterable[str],
raw: bool = False,
quiet: bool = False,
ignore_exceptions: bool = False) -> Union[Iterable[Dict], tuple]
```
Main text parsing generator function. Returns an iterable object.
Parameters:
data: (iterable) line-based text data to parse
(e.g. sys.stdin or str.splitlines())
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
ignore_exceptions: (boolean) ignore parsing exceptions if True
Returns:
Iterable of Dictionaries
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

82
docs/parsers/chage.md Normal file
View File

@@ -0,0 +1,82 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.chage"></a>
# jc.parsers.chage
jc - JSON Convert `chage --list` command output parser
Supports `chage -l <username>` or `chage --list <username>`
Usage (cli):
$ chage -l johndoe | jc --chage
or
$ jc chage -l johndoe
Usage (module):
import jc
result = jc.parse('chage', chage_command_output)
Schema:
{
"password_last_changed": string,
"password_expires": string,
"password_inactive": string,
"account_expires": string,
"min_days_between_password_change": integer,
"max_days_between_password_change": integer,
"warning_days_before_password_expires": integer
}
Examples:
$ chage --list joeuser | jc --chage -p
{
"password_last_changed": "never",
"password_expires": "never",
"password_inactive": "never",
"account_expires": "never",
"min_days_between_password_change": 0,
"max_days_between_password_change": 99999,
"warning_days_before_password_expires": 7
}
$ chage --list joeuser | jc --chage -p -r
{
"password_last_changed": "never",
"password_expires": "never",
"password_inactive": "never",
"account_expires": "never",
"min_days_between_password_change": "0",
"max_days_between_password_change": "99999",
"warning_days_before_password_expires": "7"
}
<a id="jc.parsers.chage.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.cksum"></a>
# jc.parsers.cksum
jc - JSON CLI output utility `cksum` command output parser
jc - JSON Convert `cksum` command output parser
This parser works with the following checksum calculation utilities:
- `sum`
@@ -11,7 +13,7 @@ Usage (cli):
$ cksum file.txt | jc --cksum
or
or
$ jc cksum file.txt
@@ -20,11 +22,6 @@ Usage (module):
import jc
result = jc.parse('cksum', cksum_command_output)
or
import jc.parsers.cksum
result = jc.parsers.cksum.parse(cksum_command_output)
Schema:
[
@@ -57,16 +54,12 @@ Examples:
...
]
<a id="jc.parsers.cksum.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -81,7 +74,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

199
docs/parsers/clf.md Normal file
View File

@@ -0,0 +1,199 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.clf"></a>
# jc.parsers.clf
jc - JSON Convert Common Log Format file parser
This parser will handle the Common Log Format standard as specified at
https://www.w3.org/Daemon/User/Config/Logging.html#common-logfile-format.
Combined Log Format is also supported. (Referer and User Agent fields added)
Extra fields may be present and will be enclosed in the `extra` field as
a single string.
If a log line cannot be parsed, an object with an `unparsable` field will
be present with a value of the original line.
The `epoch` calculated timestamp field is naive. (i.e. based on the
local time of the system the parser is run on)
The `epoch_utc` calculated timestamp field is timezone-aware and is
only available if the timezone field is UTC.
Usage (cli):
$ cat file.log | jc --clf
Usage (module):
import jc
result = jc.parse('clf', common_log_file_output)
Schema:
Empty strings and `-` values are converted to `null`/`None`.
[
{
"host": string,
"ident": string,
"authuser": string,
"date": string,
"day": integer,
"month": string,
"year": integer,
"hour": integer,
"minute": integer,
"second": integer,
"tz": string,
"request": string,
"request_method": string,
"request_url": string,
"request_version": string,
"status": integer,
"bytes": integer,
"referer": string,
"user_agent": string,
"extra": string,
"epoch": integer, # [0]
"epoch_utc": integer, # [1]
"unparsable": string # [2]
}
]
[0] naive timestamp
[1] timezone-aware timestamp. Only available if timezone field is UTC
[2] exists if the line was not able to be parsed
Examples:
$ cat file.log | jc --clf -p
[
{
"host": "127.0.0.1",
"ident": "user-identifier",
"authuser": "frank",
"date": "10/Oct/2000:13:55:36 -0700",
"day": 10,
"month": "Oct",
"year": 2000,
"hour": 13,
"minute": 55,
"second": 36,
"tz": "-0700",
"request": "GET /apache_pb.gif HTTPS/1.0",
"status": 200,
"bytes": 2326,
"referer": null,
"user_agent": null,
"extra": null,
"request_method": "GET",
"request_url": "/apache_pb.gif",
"request_version": "HTTPS/1.0",
"epoch": 971211336,
"epoch_utc": null
},
{
"host": "1.1.1.2",
"ident": null,
"authuser": null,
"date": "11/Nov/2016:03:04:55 +0100",
"day": 11,
"month": "Nov",
"year": 2016,
"hour": 3,
"minute": 4,
"second": 55,
"tz": "+0100",
"request": "GET /",
"status": 200,
"bytes": 83,
"referer": null,
"user_agent": null,
"extra": "- 9221 1.1.1.1",
"request_method": "GET",
"request_url": "/",
"request_version": null,
"epoch": 1478862295,
"epoch_utc": null
},
...
]
$ cat file.log | jc --clf -p -r
[
{
"host": "127.0.0.1",
"ident": "user-identifier",
"authuser": "frank",
"date": "10/Oct/2000:13:55:36 -0700",
"day": "10",
"month": "Oct",
"year": "2000",
"hour": "13",
"minute": "55",
"second": "36",
"tz": "-0700",
"request": "GET /apache_pb.gif HTTPS/1.0",
"status": "200",
"bytes": "2326",
"referer": null,
"user_agent": null,
"extra": "",
"request_method": "GET",
"request_url": "/apache_pb.gif",
"request_version": "HTTPS/1.0"
},
{
"host": "1.1.1.2",
"ident": "-",
"authuser": "-",
"date": "11/Nov/2016:03:04:55 +0100",
"day": "11",
"month": "Nov",
"year": "2016",
"hour": "03",
"minute": "04",
"second": "55",
"tz": "+0100",
"request": "GET /",
"status": "200",
"bytes": "83",
"referer": "-",
"user_agent": "-",
"extra": "- 9221 1.1.1.1",
"request_method": "GET",
"request_url": "/",
"request_version": null
},
...
]
<a id="jc.parsers.clf.parse"></a>
### parse
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output 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 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

117
docs/parsers/clf_s.md Normal file
View File

@@ -0,0 +1,117 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.clf_s"></a>
# jc.parsers.clf\_s
jc - JSON Convert Common Log Format file streaming parser
> This streaming parser outputs JSON Lines (cli) or returns an Iterable of
> Dictionaries (module)
This parser will handle the Common Log Format standard as specified at
https://www.w3.org/Daemon/User/Config/Logging.html#common-logfile-format.
Combined Log Format is also supported. (Referer and User Agent fields added)
Extra fields may be present and will be enclosed in the `extra` field as
a single string.
If a log line cannot be parsed, an object with an `unparsable` field will
be present with a value of the original line.
The `epoch` calculated timestamp field is naive. (i.e. based on the
local time of the system the parser is run on)
The `epoch_utc` calculated timestamp field is timezone-aware and is
only available if the timezone field is UTC.
Usage (cli):
$ cat file.log | jc --clf-s
Usage (module):
import jc
result = jc.parse('clf_s', common_log_file_output.splitlines())
for item in result:
# do something
Schema:
Empty strings and `-` values are converted to `null`/`None`.
{
"host": string,
"ident": string,
"authuser": string,
"date": string,
"day": integer,
"month": string,
"year": integer,
"hour": integer,
"minute": integer,
"second": integer,
"tz": string,
"request": string,
"request_method": string,
"request_url": string,
"request_version": string,
"status": integer,
"bytes": integer,
"referer": string,
"user_agent": string,
"extra": string,
"epoch": integer, # [0]
"epoch_utc": integer, # [1]
"unparsable": string # [2]
}
[0] naive timestamp
[1] timezone-aware timestamp. Only available if timezone field is UTC
[2] exists if the line was not able to be parsed
Examples:
$ cat file.log | jc --clf-s
{"host":"127.0.0.1","ident":"user-identifier","authuser":"frank","...}
{"host":"1.1.1.2","ident":null,"authuser":null,"date":"11/Nov/2016...}
...
$ cat file.log | jc --clf-s -r
{"host":"127.0.0.1","ident":"user-identifier","authuser":"frank","...}
{"host":"1.1.1.2","ident":"-","authuser":"-","date":"11/Nov/2016:0...}
...
<a id="jc.parsers.clf_s.parse"></a>
### parse
```python
@add_jc_meta
def parse(data: Iterable[str],
raw: bool = False,
quiet: bool = False,
ignore_exceptions: bool = False) -> StreamingOutputType
```
Main text parsing generator function. Returns an iterable object.
Parameters:
data: (iterable) line-based text data to parse
(e.g. sys.stdin or str.splitlines())
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
ignore_exceptions: (boolean) ignore parsing exceptions if True
Returns:
Iterable of Dictionaries
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.crontab"></a>
# jc.parsers.crontab
jc - JSON CLI output utility `crontab -l` command output and crontab
jc - JSON Convert `crontab -l` command output and crontab
file parser
Supports `crontab -l` command output and crontab files.
@@ -10,7 +12,7 @@ Usage (cli):
$ crontab -l | jc --crontab
or
or
$ jc crontab -l
@@ -19,11 +21,6 @@ Usage (module):
import jc
result = jc.parse('crontab', crontab_output)
or
import jc.parsers.crontab
result = jc.parsers.crontab.parse(crontab_output)
Schema:
{
@@ -176,16 +173,12 @@ Examples:
]
}
<a id="jc.parsers.crontab.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -200,7 +193,7 @@ Returns:
Dictionary. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, darwin, aix, freebsd
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.crontab_u"></a>
# jc.parsers.crontab_u
jc - JSON CLI output utility `crontab -l` command output and crontab
# jc.parsers.crontab\_u
jc - JSON Convert `crontab -l` command output and crontab
file parser
This version of the `crontab -l` parser supports output that contains user
@@ -16,11 +18,6 @@ Usage (module):
import jc
result = jc.parse('crontab_u', crontab_u_output)
or
import jc.parsers.crontab_u
result = jc.parsers.crontab_u.parse(crontab_u_output)
Schema:
{
@@ -173,16 +170,12 @@ Examples:
]
}
<a id="jc.parsers.crontab_u.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -197,7 +190,7 @@ Returns:
Dictionary. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, darwin, aix, freebsd
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.csv"></a>
# jc.parsers.csv
jc - JSON CLI output utility `csv` file parser
jc - JSON Convert `csv` file parser
The `csv` parser will attempt to automatically detect the delimiter
character. If the delimiter cannot be detected it will default to comma.
@@ -16,15 +18,10 @@ Usage (module):
import jc
result = jc.parse('csv', csv_output)
or
import jc.parsers.csv
result = jc.parsers.csv.parse(csv_output)
Schema:
csv file converted to a Dictionary:
https://docs.python.org/3/library/csv.html
CSV file converted to a Dictionary:
https://docs.python.org/3/library/csv.html
[
{
@@ -80,16 +77,14 @@ Examples:
...
]
<a id="jc.parsers.csv.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data: Union[str, bytes],
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
```
Main text parsing function
@@ -104,7 +99,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### 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

@@ -1,16 +1,19 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.csv_s"></a>
# jc.parsers.csv_s
jc - JSON CLI output utility `csv` file streaming parser
# jc.parsers.csv\_s
> This streaming parser outputs JSON Lines
jc - JSON Convert `csv` file streaming parser
> This streaming parser outputs JSON Lines (cli) or returns an Iterable of
> Dictionaries (module)
The `csv` streaming parser will attempt to automatically detect the
delimiter character. If the delimiter cannot be detected it will default
to comma. The first row of the file must be a header row.
Note: The first 100 rows are read into memory to enable delimiter detection,
then the rest of the rows are loaded lazily.
> Note: The first 100 rows are read into memory to enable delimiter
> detection, then the rest of the rows are loaded lazily.
Usage (cli):
@@ -19,36 +22,26 @@ Usage (cli):
Usage (module):
import jc
# result is an iterable object (generator)
result = jc.parse('csv_s', csv_output.splitlines())
for item in result:
# do something
or
import jc.parsers.csv_s
# result is an iterable object (generator)
result = jc.parsers.csv_s.parse(csv_output.splitlines())
for item in result:
# do something
Schema:
csv file converted to a Dictionary:
https://docs.python.org/3/library/csv.html
CSV file converted to a Dictionary:
https://docs.python.org/3/library/csv.html
{
"column_name1": string,
"column_name2": string,
# below object only exists if using -qq or ignore_exceptions=True
"_jc_meta":
{
"success": boolean, # false if error parsing
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
"_jc_meta": {
"success": boolean, # false if error parsing
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
}
Examples:
@@ -66,19 +59,16 @@ Examples:
{"Sell":"129","List":"132","Living":"13","Rooms":"6","Beds":"3"...}
...
<a id="jc.parsers.csv_s.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False, ignore_exceptions=False)
@add_jc_meta
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
```
Main text parsing generator function. Returns an iterator object.
Main text parsing generator function. Returns an iterable object.
Parameters:
@@ -89,15 +79,11 @@ Parameters:
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
Iterable of Dictionaries
## Parser Information
### 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

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.date"></a>
# jc.parsers.date
jc - JSON CLI output utility `date` command output parser
jc - JSON Convert `date` command output parser
The `epoch` calculated timestamp field is naive. (i.e. based on the local
time of the system the parser is run on)
@@ -13,7 +15,7 @@ Usage (cli):
$ date | jc --date
or
or
$ jc date
@@ -22,11 +24,6 @@ Usage (module):
import jc
result = jc.parse('date', date_command_output)
or
import jc.parsers.date
result = jc.parsers.date.parse(date_command_output)
Schema:
{
@@ -80,16 +77,12 @@ Examples:
"timezone_aware": true
}
<a id="jc.parsers.date.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -104,7 +97,7 @@ Returns:
Dictionary. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, darwin, freebsd
Version 2.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 2.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -0,0 +1,91 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.datetime_iso"></a>
# jc.parsers.datetime\_iso
jc - JSON Convert ISO 8601 Datetime string parser
This parser supports standard ISO 8601 strings that include both date and
time. If no timezone or offset information is available in the string, then
UTC timezone is used.
Usage (cli):
$ echo "2022-07-20T14:52:45Z" | jc --iso-datetime
Usage (module):
import jc
result = jc.parse('iso_datetime', iso_8601_string)
Schema:
{
"year": integer,
"month": string,
"month_num": integer,
"day": integer,
"weekday": string,
"weekday_num": integer,
"hour": integer,
"hour_24": integer,
"minute": integer,
"second": integer,
"microsecond": integer,
"period": string,
"utc_offset": string,
"day_of_year": integer,
"week_of_year": integer,
"iso": string,
"timestamp": integer # [0]
}
[0] timezone aware UNIX timestamp expressed in UTC
Examples:
$ echo "2022-07-20T14:52:45Z" | jc --iso-datetime -p
{
"year": 2022,
"month": "Jul",
"month_num": 7,
"day": 20,
"weekday": "Wed",
"weekday_num": 3,
"hour": 2,
"hour_24": 14,
"minute": 52,
"second": 45,
"microsecond": 0,
"period": "PM",
"utc_offset": "+0000",
"day_of_year": 201,
"week_of_year": 29,
"iso": "2022-07-20T14:52:45+00:00",
"timestamp": 1658328765
}
<a id="jc.parsers.datetime_iso.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux, aix, freebsd, darwin, win32, cygwin
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,13 +1,15 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.df"></a>
# jc.parsers.df
jc - JSON CLI output utility `df` command output parser
jc - JSON Convert `df` command output parser
Usage (cli):
$ df | jc --df
or
or
$ jc df
@@ -16,11 +18,6 @@ Usage (module):
import jc
result = jc.parse('df', df_command_output)
or
import jc.parsers.df
result = jc.parsers.df.parse(df_command_output)
Schema:
[
@@ -100,16 +97,12 @@ Examples:
...
]
<a id="jc.parsers.df.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -124,7 +117,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, darwin, freebsd
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.11 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.dig"></a>
# jc.parsers.dig
jc - JSON CLI output utility `dig` command output parser
jc - JSON Convert `dig` command output parser
Options supported:
- `+noall +answer` options are supported in cases where only the answer
@@ -18,7 +20,7 @@ Usage (cli):
$ dig example.com | jc --dig
or
or
$ jc dig example.com
@@ -27,11 +29,6 @@ Usage (module):
import jc
result = jc.parse('dig', dig_command_output)
or
import jc.parsers.dig
result = jc.parsers.dig.parse(dig_command_output)
Schema:
[
@@ -109,7 +106,7 @@ Schema:
]
[0] naive timestamp if "when" field is parsable, else null
[1] timezone aware timestamp availabe for UTC, else null
[1] timezone aware timestamp available for UTC, else null
Examples:
@@ -325,16 +322,12 @@ Examples:
}
]
<a id="jc.parsers.dig.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -349,7 +342,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, aix, freebsd, darwin, win32, cygwin
Version 2.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 2.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.dir"></a>
# jc.parsers.dir
jc - JSON CLI output utility `dir` command output parser
jc - JSON Convert `dir` command output parser
Options supported:
- `/T timefield`
@@ -17,18 +19,13 @@ time of the system the parser is run on)
Usage (cli):
C:> dir | jc --dir
C:\> dir | jc --dir
Usage (module):
import jc
result = jc.parse('dir', dir_command_output)
or
import jc.parsers.dir
result = jc.parsers.dir.parse(dir_command_output)
Schema:
[
@@ -45,7 +42,7 @@ Schema:
Examples:
C:> dir | jc --dir -p
C:\> dir | jc --dir -p
[
{
"date": "03/24/2021",
@@ -53,7 +50,7 @@ Examples:
"dir": true,
"size": null,
"filename": ".",
"parent": "C:\Program Files\Internet Explorer",
"parent": "C:\\Program Files\\Internet Explorer",
"epoch": 1616624100
},
{
@@ -62,7 +59,7 @@ Examples:
"dir": true,
"size": null,
"filename": "..",
"parent": "C:\Program Files\Internet Explorer",
"parent": "C:\\Program Files\\Internet Explorer",
"epoch": 1616624100
},
{
@@ -71,7 +68,7 @@ Examples:
"dir": true,
"size": null,
"filename": "en-US",
"parent": "C:\Program Files\Internet Explorer",
"parent": "C:\\Program Files\\Internet Explorer",
"epoch": 1575715740
},
{
@@ -80,13 +77,13 @@ Examples:
"dir": false,
"size": 54784,
"filename": "ExtExport.exe",
"parent": "C:\Program Files\Internet Explorer",
"parent": "C:\\Program Files\\Internet Explorer",
"epoch": 1575713340
},
...
]
C:> dir | jc --dir -p -r
C:\> dir | jc --dir -p -r
[
{
"date": "03/24/2021",
@@ -94,7 +91,7 @@ Examples:
"dir": true,
"size": null,
"filename": ".",
"parent": "C:\Program Files\Internet Explorer"
"parent": "C:\\Program Files\\Internet Explorer"
},
{
"date": "03/24/2021",
@@ -102,7 +99,7 @@ Examples:
"dir": true,
"size": null,
"filename": "..",
"parent": "C:\Program Files\Internet Explorer"
"parent": "C:\\Program Files\\Internet Explorer"
},
{
"date": "12/07/2019",
@@ -110,7 +107,7 @@ Examples:
"dir": true,
"size": null,
"filename": "en-US",
"parent": "C:\Program Files\Internet Explorer"
"parent": "C:\\Program Files\\Internet Explorer"
},
{
"date": "12/07/2019",
@@ -118,21 +115,17 @@ Examples:
"dir": false,
"size": "54,784",
"filename": "ExtExport.exe",
"parent": "C:\Program Files\Internet Explorer"
"parent": "C:\\Program Files\\Internet Explorer"
},
...
]
<a id="jc.parsers.dir.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -147,7 +140,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: win32
Version 1.4 by Rasheed Elsaleh (rasheed@rebelliondefense.com)
Version 1.6 by Rasheed Elsaleh (rasheed@rebelliondefense.com)

View File

@@ -1,13 +1,15 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.dmidecode"></a>
# jc.parsers.dmidecode
jc - JSON CLI output utility `dmidecode` command output parser
jc - JSON Convert `dmidecode` command output parser
Usage (cli):
$ dmidecode | jc --dmidecode
or
or
$ jc dmidecode
@@ -16,11 +18,6 @@ Usage (module):
import jc
result = jc.parse('dmidecode', dmidecode_command_output)
or
import jc.parsers.dmidecode
result = jc.parsers.dmidecode.parse(dmidecode_command_output)
Schema:
[
@@ -128,16 +125,12 @@ Examples:
...
]
<a id="jc.parsers.dmidecode.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -152,7 +145,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.dpkg_l"></a>
# jc.parsers.dpkg_l
jc - JSON CLI output utility `dpkg -l` command output parser
# jc.parsers.dpkg\_l
jc - JSON Convert `dpkg -l` command output parser
Set the `COLUMNS` environment variable to a large value to avoid field
truncation. For example:
@@ -12,7 +14,7 @@ Usage (cli):
$ dpkg -l | jc --dpkg-l
or
or
$ jc dpkg -l
@@ -21,11 +23,6 @@ Usage (module):
import jc
result = jc.parse('dpkg_l', dpkg_command_output)
or
import jc.parsers.dpkg_l
result = jc.parsers.dpkg_l.parse(dpkg_command_output)
Schema:
[
@@ -134,16 +131,12 @@ Examples:
...
]
<a id="jc.parsers.dpkg_l.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -158,7 +151,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,13 +1,19 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.du"></a>
# jc.parsers.du
jc - JSON CLI output utility `du` command output parser
jc - JSON Convert `du` command output parser
The `du -h` option is not supported with the default output. If you
would like to use `du -h` or other options that change the output, be sure
to use `jc --raw` (cli) or `raw=True` (module).
Usage (cli):
$ du | jc --du
or
or
$ jc du
@@ -16,11 +22,6 @@ Usage (module):
import jc
result = jc.parse('du', du_command_output)
or
import jc.parsers.du
result = jc.parsers.du.parse(du_command_output)
Schema:
[
@@ -90,16 +91,12 @@ Examples:
...
]
<a id="jc.parsers.du.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -114,7 +111,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### 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

@@ -0,0 +1,67 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.email_address"></a>
# jc.parsers.email\_address
jc - JSON Convert Email Address string parser
Usage (cli):
$ echo "username@example.com" | jc --email-address
Usage (module):
import jc
result = jc.parse('email_address', email_address_string)
Schema:
{
"username": string,
"domain": string,
"local": string,
"local_plus_suffix": string or null
}
Examples:
$ echo 'joe.user@gmail.com' | jc --email-address -p
{
"username": "joe.user",
"domain": "gmail.com",
"local": "joe.user",
"local_plus_suffix": null
}
$ echo 'joe.user+spam@gmail.com' | jc --email-address -p
{
"username": "joe.user",
"domain": "gmail.com",
"local": "joe.user+spam",
"local_plus_suffix": "spam"
}
<a id="jc.parsers.email_address.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.env"></a>
# jc.parsers.env
jc - JSON CLI output utility `env` and `printenv` command output parser
jc - JSON Convert `env` and `printenv` command output parser
This parser will output a list of dictionaries each containing `name` and
`value` keys. If you would like a simple dictionary output, then use the
@@ -12,7 +14,7 @@ Usage (cli):
$ env | jc --env
or
or
$ jc env
@@ -21,11 +23,6 @@ Usage (module):
import jc
result = jc.parse('env', env_command_output)
or
import jc.parsers.env
result = jc.parsers.env.parse(env_command_output)
Schema:
[
@@ -75,16 +72,12 @@ Examples:
"_": "/usr/bin/env"
}
<a id="jc.parsers.env.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -100,7 +93,7 @@ Returns:
Dictionary of raw structured data or
List of Dictionaries of processed structured data
## Parser Information
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,13 +1,15 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.file"></a>
# jc.parsers.file
jc - JSON CLI output utility `file` command output parser
jc - JSON Convert `file` command output parser
Usage (cli):
$ file * | jc --file
or
or
$ jc file *
@@ -16,11 +18,6 @@ Usage (module):
import jc
result = jc.parse('file', file_command_output)
or
import jc.parsers.file
result = jc.parsers.file.parse(file_command_output)
Schema:
[
@@ -65,16 +62,12 @@ Examples:
...
]
<a id="jc.parsers.file.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -89,7 +82,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, aix, freebsd, darwin
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

117
docs/parsers/findmnt.md Normal file
View File

@@ -0,0 +1,117 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.findmnt"></a>
# jc.parsers.findmnt
jc - JSON Convert `findmnt` command output parser
Supports `-a`, `-l`, or no `findmnt` options.
> Note: Newer versions of `findmnt` have a JSON output option.
Usage (cli):
$ findmnt | jc --findmnt
or
$ jc findmnt
Usage (module):
import jc
result = jc.parse('findmnt', findmnt_command_output)
Schema:
[
{
"target": string,
"source": string,
"fstype": string,
"options": [
string
],
"kv_options": {
"<key_name>": string
}
]
Examples:
$ findmnt | jc --findmnt -p
[
{
"target": "/",
"source": "/dev/mapper/centos-root",
"fstype": "xfs",
"options": [
"rw",
"relatime",
"seclabel",
"attr2",
"inode64",
"noquota"
]
},
{
"target": "/sys/fs/cgroup",
"source": "tmpfs",
"fstype": "tmpfs",
"options": [
"ro",
"nosuid",
"nodev",
"noexec",
"seclabel"
],
"kv_options": {
"mode": "755"
}
},
...
]
$ findmnt | jc --findmnt -p -r
[
{
"target": "/",
"source": "/dev/mapper/centos-root",
"fstype": "xfs",
"options": "rw,relatime,seclabel,attr2,inode64,noquota"
},
{
"target": "/sys/fs/cgroup",
"source": "tmpfs",
"fstype": "tmpfs",
"options": "ro,nosuid,nodev,noexec,seclabel,mode=755"
},
...
]
<a id="jc.parsers.findmnt.parse"></a>
### parse
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.finger"></a>
# jc.parsers.finger
jc - JSON CLI output utility `finger` command output parser
jc - JSON Convert `finger` command output parser
Supports `-s` output option. Does not support the `-l` detail option.
@@ -9,7 +11,7 @@ Usage (cli):
$ finger | jc --finger
or
or
$ jc finger
@@ -18,11 +20,6 @@ Usage (module):
import jc
result = jc.parse('finger', finger_command_output)
or
import jc.parsers.finger
result = jc.parsers.finger.parse(finger_command_output)
Schema:
[
@@ -93,16 +90,12 @@ Examples:
...
]
<a id="jc.parsers.finger.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -117,7 +110,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, darwin, cygwin, freebsd
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,13 +1,15 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.free"></a>
# jc.parsers.free
jc - JSON CLI output utility `free` command output parser
jc - JSON Convert `free` command output parser
Usage (cli):
$ free | jc --free
or
or
$ jc free
@@ -16,11 +18,6 @@ Usage (module):
import jc
result = jc.parse('free', free_command_output)
or
import jc.parsers.free
result = jc.parsers.free.parse(free_command_output)
Schema:
[
@@ -75,16 +72,12 @@ Examples:
}
]
<a id="jc.parsers.free.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -99,7 +92,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.fstab"></a>
# jc.parsers.fstab
jc - JSON CLI output utility `fstab` file parser
jc - JSON Convert `fstab` file parser
Usage (cli):
@@ -12,11 +14,6 @@ Usage (module):
import jc
result = jc.parse('fstab', fstab_command_output)
or
import jc.parsers.fstab
result = jc.parsers.fstab.parse(fstab_command_output)
Schema:
[
@@ -88,16 +85,12 @@ Examples:
}
]
<a id="jc.parsers.fstab.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -112,7 +105,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, freebsd
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

175
docs/parsers/git_log.md Normal file
View File

@@ -0,0 +1,175 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.git_log"></a>
# jc.parsers.git\_log
jc - JSON Convert `git log` command output parser
Can be used with the following format options:
- `oneline`
- `short`
- `medium`
- `full`
- `fuller`
Additional options supported:
- `--stat`
- `--shortstat`
The `epoch` calculated timestamp field is naive. (i.e. based on the
local time of the system the parser is run on)
The `epoch_utc` calculated timestamp field is timezone-aware and is
only available if the timezone field is UTC.
Usage (cli):
$ git log | jc --git-log
or
$ jc git log
Usage (module):
import jc
result = jc.parse('git_log', git_log_command_output)
Schema:
[
{
"commit": string,
"author": string/null,
"author_email": string/null,
"date": string,
"epoch": integer, # [0]
"epoch_utc": integer, # [1]
"commit_by": string/null,
"commit_by_email": string/null,
"commit_by_date": string,
"message": string,
"stats" : {
"files_changed": integer,
"insertions": integer,
"deletions": integer,
"files": [
string
]
}
}
]
[0] naive timestamp if "date" field is parsable, else null
[1] timezone aware timestamp available for UTC, else null
Examples:
$ git log --stat | jc --git-log -p
[
{
"commit": "728d882ed007b3c8b785018874a0eb06e1143b66",
"author": "Kelly Brazil",
"author_email": "kellyjonbrazil@gmail.com",
"date": "Wed Apr 20 09:50:19 2022 -0400",
"stats": {
"files_changed": 2,
"insertions": 90,
"deletions": 12,
"files": [
"docs/parsers/git_log.md",
"jc/parsers/git_log.py"
]
},
"message": "add timestamp docs and examples",
"epoch": 1650462619,
"epoch_utc": null
},
{
"commit": "b53e42aca623181aa9bc72194e6eeef1e9a3a237",
"author": "Kelly Brazil",
"author_email": "kellyjonbrazil@gmail.com",
"date": "Wed Apr 20 09:44:42 2022 -0400",
"stats": {
"files_changed": 5,
"insertions": 29,
"deletions": 6,
"files": [
"docs/parsers/git_log.md",
"docs/utils.md",
"jc/parsers/git_log.py",
"jc/utils.py",
"man/jc.1"
]
},
"message": "add calculated timestamp",
"epoch": 1650462282,
"epoch_utc": null
},
...
]
$ git log --stat | jc --git-log -p -r
[
{
"commit": "728d882ed007b3c8b785018874a0eb06e1143b66",
"author": "Kelly Brazil",
"author_email": "kellyjonbrazil@gmail.com",
"date": "Wed Apr 20 09:50:19 2022 -0400",
"stats": {
"files_changed": "2",
"insertions": "90",
"deletions": "12",
"files": [
"docs/parsers/git_log.md",
"jc/parsers/git_log.py"
]
},
"message": "add timestamp docs and examples"
},
{
"commit": "b53e42aca623181aa9bc72194e6eeef1e9a3a237",
"author": "Kelly Brazil",
"author_email": "kellyjonbrazil@gmail.com",
"date": "Wed Apr 20 09:44:42 2022 -0400",
"stats": {
"files_changed": "5",
"insertions": "29",
"deletions": "6",
"files": [
"docs/parsers/git_log.md",
"docs/utils.md",
"jc/parsers/git_log.py",
"jc/utils.py",
"man/jc.1"
]
},
"message": "add calculated timestamp"
},
...
]
<a id="jc.parsers.git_log.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output 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 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

111
docs/parsers/git_log_s.md Normal file
View File

@@ -0,0 +1,111 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.git_log_s"></a>
# jc.parsers.git\_log\_s
jc - JSON Convert `git log` command output streaming parser
> This streaming parser outputs JSON Lines (cli) or returns an Iterable of
> Dictionaries (module)
Can be used with the following format options:
- `oneline`
- `short`
- `medium`
- `full`
- `fuller`
Additional options supported:
- `--stat`
- `--shortstat`
The `epoch` calculated timestamp field is naive. (i.e. based on the
local time of the system the parser is run on)
The `epoch_utc` calculated timestamp field is timezone-aware and is
only available if the timezone field is UTC.
Usage (cli):
$ git log | jc --git-log-s
Usage (module):
import jc
result = jc.parse('git_log_s', git_log_command_output.splitlines())
for item in result:
# do something
Schema:
{
"commit": string,
"author": string/null,
"author_email": string/null,
"date": string,
"epoch": integer, # [0]
"epoch_utc": integer, # [1]
"commit_by": string/null,
"commit_by_email": string/null,
"commit_by_date": string,
"message": string,
"stats" : {
"files_changed": integer,
"insertions": integer,
"deletions": integer,
"files": [
string
]
}
# below object only exists if using -qq or ignore_exceptions=True
"_jc_meta": {
"success": boolean, # false if error parsing
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
}
[0] naive timestamp if "date" field is parsable, else null
[1] timezone aware timestamp available for UTC, else null
Examples:
$ git log | jc --git-log-s
{"commit":"a730ae18c8e81c5261db132df73cd74f272a0a26","author":"Kelly...}
{"commit":"930bf439c06c48a952baec05a9896c8d92b7693e","author":"Kelly...}
...
<a id="jc.parsers.git_log_s.parse"></a>
### parse
```python
@add_jc_meta
def parse(data: Iterable[str],
raw: bool = False,
quiet: bool = False,
ignore_exceptions: bool = False) -> Union[Iterable[Dict], tuple]
```
Main text parsing generator function. Returns an iterable object.
Parameters:
data: (iterable) line-based text data to parse
(e.g. sys.stdin or str.splitlines())
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
ignore_exceptions: (boolean) ignore parsing exceptions if True
Returns:
Iterable of Dictionaries
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -0,0 +1,92 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.git_ls_remote"></a>
# jc.parsers.git\_ls\_remote
jc - JSON Convert `git ls-remote` command output parser
This parser outputs two schemas:
- Default: A single object with key/value pairs
- Raw: An array of objects (`--raw` (cli) or `raw=True (module))
See the Schema section for more details
Usage (cli):
$ git ls-remote | jc --git-ls-remote
or
$ jc git ls-remote
Usage (module):
import jc
result = jc.parse('git_ls_remote', git_ls_remote_command_output)
Schema:
Default:
{
<reference>: string
}
Raw:
[
{
"reference": string,
"commit": string
}
]
Examples:
$ git ls-remote | jc --git-ls-remote -p
{
"HEAD": "214cd6b9e09603b3c4fa02203b24fb2bc3d4e338",
"refs/heads/dev": "b884f6aacca39e05994596d8fdfa7e7c4f1e0389",
"refs/heads/master": "214cd6b9e09603b3c4fa02203b24fb2bc3d4e338",
"refs/pull/1/head": "e416c77bed1267254da972b0f95b7ff1d43fccef",
...
}
$ git ls-remote | jc --git-ls-remote -p -r
[
{
"reference": "HEAD",
"commit": "214cd6b9e09603b3c4fa02203b24fb2bc3d4e338"
},
{
"reference": "refs/heads/dev",
"commit": "b884f6aacca39e05994596d8fdfa7e7c4f1e0389"
},
...
]
<a id="jc.parsers.git_ls_remote.parse"></a>
### parse
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> Union[JSONDictType, List[JSONDictType]]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary (default) or List of Dictionaries (raw)
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

145
docs/parsers/gpg.md Normal file
View File

@@ -0,0 +1,145 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.gpg"></a>
# jc.parsers.gpg
jc - JSON Convert `gpg --with-colons` command output parser
Usage (cli):
$ gpg --with-colons --show-keys file.gpg | jc --gpg
or
$ jc gpg --with-colons --show-keys file.gpg
Usage (module):
import jc
result = jc.parse('gpg', gpg_command_output)
Schema:
Field definitions from https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob_plain;f=doc/DETAILS
> Note: Number values are not converted to integers because many field
> specifications are overloaded and future augmentations are implied in the
> documentation.
[
{
"type": string,
"validity": string,
"key_length": string,
"pub_key_alg": string,
"key_id": string,
"creation_date": string,
"expiration_date": string,
"certsn_uidhash_trustinfo": string,
"owner_trust": string,
"user_id": string,
"signature_class": string,
"key_capabilities": string,
"cert_fingerprint_other": string,
"flag": string,
"token_sn": string,
"hash_alg": string,
"curve_name": string,
"compliance_flags": string,
"last_update_date": string,
"origin": string,
"comment": string,
"index": string, # [0]
"bits": string, # [0]
"value": string, # [0]
"version": string, # [1], [4]
"signature_count": string, # [1]
"encryption_count": string, # [1]
"policy": string, # [1]
"signature_first_seen": string, # [1]
"signature_most_recent_seen": string, # [1]
"encryption_first_done": string, # [1]
"encryption_most_recent_done": string, # [1]
"staleness_reason": string, # [2]
"trust_model": string, # [2]
"trust_db_created": string, # [2]
"trust_db_expires": string, # [2]
"marginally_trusted_users": string, # [2]
"completely_trusted_users": string, # [2]
"cert_chain_max_depth": string, # [2]
"subpacket_number": string, # [3]
"hex_flags": string, # [3]
"subpacket_length": string, # [3]
"subpacket_data": string, # [3]
"pubkey": string, # [4]
"cipher": string, # [4]
"digest": string, # [4]
"compress": string, # [4]
"group": string, # [4]
"members": string, # [4]
"curve_names": string, # [4]
}
]
All blank values are converted to null/None.
[0] for 'pkd' type
[1] for 'tfs' type
[2] for 'tru' type
[3] for 'skp' type
[4] for 'cfg' type
Examples:
$ gpg --with-colons --show-keys file.gpg | jc --gpg -p
[
{
"type": "pub",
"validity": "f",
"key_length": "1024",
"pub_key_alg": "17",
"key_id": "6C7EE1B8621CC013",
"creation_date": "899817715",
"expiration_date": "1055898235",
"certsn_uidhash_trustinfo": null,
"owner_trust": "m",
"user_id": null,
"signature_class": null,
"key_capabilities": "scESC",
"cert_fingerprint_other": null,
"flag": null,
"token_sn": null,
"hash_alg": null,
"curve_name": null,
"compliance_flags": null,
"last_update_date": null,
"origin": null,
"comment": null
},
...
]
<a id="jc.parsers.gpg.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output 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)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.group"></a>
# jc.parsers.group
jc - JSON CLI output utility `/etc/group` file parser
jc - JSON Convert `/etc/group` file parser
Usage (cli):
@@ -12,11 +14,6 @@ Usage (module):
import jc
result = jc.parse('group', group_file_output)
or
import jc.parsers.group
result = jc.parsers.group.parse(group_file_output)
Schema:
[
@@ -112,16 +109,12 @@ Examples:
...
]
<a id="jc.parsers.group.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -136,7 +129,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### 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

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.gshadow"></a>
# jc.parsers.gshadow
jc - JSON CLI output utility `/etc/gshadow` file parser
jc - JSON Convert `/etc/gshadow` file parser
Usage (cli):
@@ -12,11 +14,6 @@ Usage (module):
import jc
result = jc.parse('gshadow', gshadow_file_output)
or
import jc.parsers.gshadow
result = jc.parsers.gshadow.parse(gshadow_file_output)
Schema:
[
@@ -80,16 +77,12 @@ Examples:
...
]
<a id="jc.parsers.gshadow.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -104,7 +97,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, aix, freebsd
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.hash"></a>
# jc.parsers.hash
jc - JSON CLI output utility `hash` command output parser
jc - JSON Convert `hash` command output parser
Usage (cli):
@@ -12,11 +14,6 @@ Usage (module):
import jc
result = jc.parse('hash', hash_command_output)
or
import jc.parsers.hash
result = jc.parsers.hash.parse(hash_command_output)
Schema:
[
@@ -40,16 +37,12 @@ Examples:
}
]
<a id="jc.parsers.hash.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -64,7 +57,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.hashsum"></a>
# jc.parsers.hashsum
jc - JSON CLI output utility `hash sum` command output parser
jc - JSON Convert `hash sum` command output parser
This parser works with the following hash calculation utilities:
- `md5`
@@ -17,7 +19,7 @@ Usage (cli):
$ md5sum file.txt | jc --hashsum
or
or
$ jc md5sum file.txt
@@ -26,11 +28,6 @@ Usage (module):
import jc
result = jc.parse('hashsum', md5sum_command_output)
or
import jc.parsers.hashsum
result = jc.parsers.hashsum.parse(md5sum_command_output)
Schema:
[
@@ -71,16 +68,12 @@ Examples:
...
]
<a id="jc.parsers.hashsum.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -95,7 +88,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,13 +1,15 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.hciconfig"></a>
# jc.parsers.hciconfig
jc - JSON CLI output utility `hciconfig` command output parser
jc - JSON Convert `hciconfig` command output parser
Usage (cli):
$ hciconfig | jc --hciconfig
or
or
$ jc hciconfig
@@ -16,11 +18,6 @@ Usage (module):
import jc
result = jc.parse('hciconfig', hciconfig_command_output)
or
import jc.parsers.hciconfig
result = jc.parsers.hciconfig.parse(hciconfig_command_output)
Schema:
[
@@ -320,16 +317,12 @@ Examples:
}
]
<a id="jc.parsers.hciconfig.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -344,7 +337,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.history"></a>
# jc.parsers.history
jc - JSON CLI output utility `history` command output parser
jc - JSON Convert `history` command output parser
This parser will output a list of dictionaries each containing `line` and
`command` keys. If you would like a simple dictionary output, then use the
@@ -20,11 +22,6 @@ Usage (module):
import jc
result = jc.parse('history', history_command_output)
or
import jc.parsers.history
result = jc.parsers.history.parse(history_command_output)
Schema:
[
@@ -48,7 +45,7 @@ Examples:
},
{
"line": 120,
"command": "echo "hello""
"command": "echo \"hello\""
},
{
"line": 121,
@@ -61,21 +58,17 @@ Examples:
{
"118": "sleep 100",
"119": "ls /bin",
"120": "echo "hello"",
"120": "echo \"hello\"",
"121": "docker images",
...
}
<a id="jc.parsers.history.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -91,7 +84,7 @@ Returns:
Dictionary of raw structured data or
List of Dictionaries of processed structured data
## Parser Information
### Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.hosts"></a>
# jc.parsers.hosts
jc - JSON CLI output utility `/etc/hosts` file parser
jc - JSON Convert `/etc/hosts` file parser
Usage (cli):
@@ -12,11 +14,6 @@ Usage (module):
import jc
result = jc.parse('hosts', hosts_file_output)
or
import jc.parsers.hosts
result = jc.parsers.hosts.parse(hosts_file_output)
Schema:
[
@@ -77,16 +74,12 @@ Examples:
}
]
<a id="jc.parsers.hosts.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -101,7 +94,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,13 +1,15 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.id"></a>
# jc.parsers.id
jc - JSON CLI output utility `id` command output parser
jc - JSON Convert `id` command output parser
Usage (cli):
$ id | jc --id
or
or
$ jc id
@@ -16,11 +18,6 @@ Usage (module):
import jc
result = jc.parse('id', id_command_output)
or
import jc.parsers.id
result = jc.parsers.id.parse(id_command_output)
Schema:
{
@@ -108,16 +105,12 @@ Examples:
}
}
<a id="jc.parsers.id.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -132,7 +125,7 @@ Returns:
Dictionary. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, darwin, aix, freebsd
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,15 +1,20 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ifconfig"></a>
# jc.parsers.ifconfig
jc - JSON CLI output utility `ifconfig` command output parser
Note: No `ifconfig` options are supported.
jc - JSON Convert `ifconfig` command output parser
No `ifconfig` options are supported.
Consider using the `ip` command instead of `ifconfig` as it supports native
JSON output.
Usage (cli):
$ ifconfig | jc --ifconfig
or
or
$ jc ifconfig
@@ -18,49 +23,96 @@ Usage (module):
import jc
result = jc.parse('ifconfig', ifconfig_command_output)
or
import jc.parsers.ifconfig
result = jc.parsers.ifconfig.parse(ifconfig_command_output)
Schema:
[
{
"name": string,
"flags": integer,
"name": string,
"type": string,
"metric": integer
"flags": integer,
"state": [
string
string
],
"mtu": integer,
"ipv4_addr": string,
"ipv4_mask": string,
"ipv4_bcast": string,
"ipv6_addr": string,
"ipv6_mask": integer,
"ipv6_scope": string,
"mac_addr": string,
"type": string,
"rx_packets": integer,
"rx_bytes": integer,
"rx_errors": integer,
"rx_dropped": integer,
"rx_overruns": integer,
"rx_frame": integer,
"tx_packets": integer,
"tx_bytes": integer,
"tx_errors": integer,
"tx_dropped": integer,
"tx_overruns": integer,
"tx_carrier": integer,
"tx_collisions": integer,
"metric": integer
"mtu": integer,
"mac_addr": string,
"ipv4_addr": string, # [0]
"ipv4_mask": string, # [0]
"ipv4_bcast": string, # [0]
"ipv6_addr": string, # [0]
"ipv6_mask": integer, # [0]
"ipv6_scope": string, # [0]
"ipv6_scope_id": string, # [0]
"ipv6_type": string, # [0]
"rx_packets": integer,
"rx_bytes": integer,
"rx_errors": integer,
"rx_dropped": integer,
"rx_overruns": integer,
"rx_frame": integer,
"tx_packets": integer,
"tx_bytes": integer,
"tx_errors": integer,
"tx_dropped": integer,
"tx_overruns": integer,
"tx_carrier": integer,
"tx_collisions": integer,
"options": string,
"options_flags": [
string
],
"status": string,
"hw_address": string,
"media": string,
"media_flags": [
string
],
"nd6_options": integer,
"nd6_flags": [
string
],
"plugged": string,
"vendor": string,
"vendor_pn": string,
"vendor_sn": string,
"vendor_date": string,
"module_temperature": string,
"module_voltage": string
"ipv4": [
{
"address": string,
"mask": string,
"broadcast": string
}
],
"ipv6: [
{
"address": string,
"scope_id": string,
"mask": integer,
"scope": string,
"type": string
}
],
"lanes": [
{
"lane": integer,
"rx_power_mw": float,
"rx_power_dbm": float,
"tx_bias_ma": float
}
]
}
]
[0] these fields only pick up the last IP address in the interface
output and are here for backwards compatibility. For information on
all IP addresses, use the `ipv4` and `ipv6` objects which contain an
array of IP address objects.
Examples:
$ ifconfig | jc --ifconfig -p
$ ifconfig ens33 | jc --ifconfig -p
[
{
"name": "ens33",
@@ -72,133 +124,105 @@ Examples:
"MULTICAST"
],
"mtu": 1500,
"type": "Ethernet",
"mac_addr": "00:0c:29:3b:58:0e",
"ipv4_addr": "192.168.71.137",
"ipv4_mask": "255.255.255.0",
"ipv4_bcast": "192.168.71.255",
"ipv6_addr": "fe80::c1cb:715d:bc3e:b8a0",
"ipv6_mask": 64,
"ipv6_scope": "0x20",
"mac_addr": "00:0c:29:3b:58:0e",
"type": "Ethernet",
"ipv6_type": "link",
"metric": null,
"rx_packets": 8061,
"rx_bytes": 1514413,
"rx_errors": 0,
"rx_dropped": 0,
"rx_overruns": 0,
"rx_frame": 0,
"tx_packets": 4502,
"tx_errors": 0,
"tx_dropped": 0,
"tx_overruns": 0,
"tx_carrier": 0,
"tx_collisions": 0,
"rx_bytes": 1514413,
"tx_bytes": 866622,
"tx_errors": 0,
"tx_dropped": 0,
"tx_overruns": 0,
"tx_carrier": 0,
"tx_collisions": 0,
"metric": null
},
{
"name": "lo",
"flags": 73,
"state": [
"UP",
"LOOPBACK",
"RUNNING"
"ipv4": [
{
"address": "192.168.71.137",
"mask": "255.255.255.0",
"broadcast": "192.168.71.255"
}
],
"mtu": 65536,
"ipv4_addr": "127.0.0.1",
"ipv4_mask": "255.0.0.0",
"ipv4_bcast": null,
"ipv6_addr": "::1",
"ipv6_mask": 128,
"ipv6_scope": "0x10",
"mac_addr": null,
"type": "Local Loopback",
"rx_packets": 73,
"rx_bytes": 6009,
"rx_errors": 0,
"rx_dropped": 0,
"rx_overruns": 0,
"rx_frame": 0,
"tx_packets": 73,
"tx_bytes": 6009,
"tx_errors": 0,
"tx_dropped": 0,
"tx_overruns": 0,
"tx_carrier": 0,
"tx_collisions": 0,
"metric": null
"ipv6": [
{
"address": "fe80::c1cb:715d:bc3e:b8a0",
"scope_id": null,
"mask": 64,
"scope": "0x20",
"type": "link"
}
]
}
]
$ ifconfig | jc --ifconfig -p -r
$ ifconfig ens33 | jc --ifconfig -p -r
[
{
"name": "ens33",
"flags": "4163",
"state": "UP,BROADCAST,RUNNING,MULTICAST",
"mtu": "1500",
"type": "Ethernet",
"mac_addr": "00:0c:29:3b:58:0e",
"ipv4_addr": "192.168.71.137",
"ipv4_mask": "255.255.255.0",
"ipv4_bcast": "192.168.71.255",
"ipv6_addr": "fe80::c1cb:715d:bc3e:b8a0",
"ipv6_mask": "64",
"ipv6_scope": "0x20",
"mac_addr": "00:0c:29:3b:58:0e",
"type": "Ethernet",
"ipv6_type": "link",
"metric": null,
"rx_packets": "8061",
"rx_bytes": "1514413",
"rx_errors": "0",
"rx_dropped": "0",
"rx_overruns": "0",
"rx_frame": "0",
"tx_packets": "4502",
"tx_errors": "0",
"tx_dropped": "0",
"tx_overruns": "0",
"tx_carrier": "0",
"tx_collisions": "0",
"rx_bytes": "1514413",
"tx_bytes": "866622",
"tx_errors": "0",
"tx_dropped": "0",
"tx_overruns": "0",
"tx_carrier": "0",
"tx_collisions": "0",
"metric": null
},
{
"name": "lo",
"flags": "73",
"state": "UP,LOOPBACK,RUNNING",
"mtu": "65536",
"ipv4_addr": "127.0.0.1",
"ipv4_mask": "255.0.0.0",
"ipv4_bcast": null,
"ipv6_addr": "::1",
"ipv6_mask": "128",
"ipv6_scope": "0x10",
"mac_addr": null,
"type": "Local Loopback",
"rx_packets": "73",
"rx_bytes": "6009",
"rx_errors": "0",
"rx_dropped": "0",
"rx_overruns": "0",
"rx_frame": "0",
"tx_packets": "73",
"tx_bytes": "6009",
"tx_errors": "0",
"tx_dropped": "0",
"tx_overruns": "0",
"tx_carrier": "0",
"tx_collisions": "0",
"metric": null
"ipv4": [
{
"address": "192.168.71.137",
"mask": "255.255.255.0",
"broadcast": "192.168.71.255"
}
],
"ipv6": [
{
"address": "fe80::c1cb:715d:bc3e:b8a0",
"scope_id": null,
"mask": "64",
"scope": "0x20",
"type": "link"
}
]
}
]
<a id="jc.parsers.ifconfig.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
```
Main text parsing function
@@ -213,7 +237,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, aix, freebsd, darwin
Version 1.11 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 2.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,15 +1,20 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ini"></a>
# jc.parsers.ini
jc - JSON CLI output utility `INI` file parser
jc - JSON Convert `INI` file parser
Parses standard `INI` files and files containing simple key/value pairs.
Delimiter can be `=` or `:`. Missing values are supported. Comment prefix
can be `#` or `;`. Comments must be on their own line.
Note: Values starting and ending with quotation marks will have the marks
removed. If you would like to keep the quotation marks, use the `-r`
command-line argument or the `raw=True` argument in `parse()`.
- Delimiter can be `=` or `:`. Missing values are supported.
- Comment prefix can be `#` or `;`. Comments must be on their own line.
- If duplicate keys are found, only the last value will be used.
> Note: Values starting and ending with double or single quotation marks
> will have the marks removed. If you would like to keep the quotation
> marks, use the `-r` command-line argument or the `raw=True` argument in
> `parse()`.
Usage (cli):
@@ -20,15 +25,10 @@ Usage (module):
import jc
result = jc.parse('ini', ini_file_output)
or
import jc.parsers.ini
result = jc.parsers.ini.parse(ini_file_output)
Schema:
ini or key/value document converted to a dictionary - see the
configparser standard library documentation for more details.
ini or key/value document converted to a dictionary - see the configparser
standard library documentation for more details.
{
"key1": string,
@@ -54,31 +54,27 @@ Examples:
$ cat example.ini | jc --ini -p
{
"bitbucket.org": {
"serveraliveinterval": "45",
"compression": "yes",
"compressionlevel": "9",
"forwardx11": "yes",
"user": "hg"
"ServerAliveInterval": "45",
"Compression": "yes",
"CompressionLevel": "9",
"ForwardX11": "yes",
"User": "hg"
},
"topsecret.server.com": {
"serveraliveinterval": "45",
"compression": "yes",
"compressionlevel": "9",
"forwardx11": "no",
"port": "50022"
"ServerAliveInterval": "45",
"Compression": "yes",
"CompressionLevel": "9",
"ForwardX11": "no",
"Port": "50022"
}
}
<a id="jc.parsers.ini.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -93,7 +89,7 @@ Returns:
Dictionary representing the ini file
## Parser Information
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,15 +1,17 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.iostat"></a>
# jc.parsers.iostat
jc - JSON CLI output utility `iostat` command output parser
Note: `iostat` version 11 and higher include a JSON output option
jc - JSON Convert `iostat` command output parser
> Note: `iostat` version 11 and higher include a JSON output option
Usage (cli):
$ iostat | jc --iostat
or
or
$ jc iostat
@@ -18,11 +20,6 @@ Usage (module):
import jc
result = jc.parse('iostat', iostat_command_output)
or
import jc.parsers.iostat
result = jc.parsers.iostat.parse(iostat_command_output)
Schema:
[
@@ -162,16 +159,12 @@ Examples:
}
]
<a id="jc.parsers.iostat.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -186,7 +179,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,32 +1,34 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.iostat_s"></a>
# jc.parsers.iostat_s
jc - JSON CLI output utility `iostat` command output streaming parser
# jc.parsers.iostat\_s
> This streaming parser outputs JSON Lines
jc - JSON Convert `iostat` command output streaming parser
Note: `iostat` version 11 and higher include a JSON output option
> This streaming parser outputs JSON Lines (cli) or returns an Iterable of
> Dictionaries (module)
> Note: `iostat` version 11 and higher include a JSON output option
Usage (cli):
$ iostat | jc --iostat-s
> Note: When piping `jc` converted `iostat` output to other processes it may
> appear the output is hanging due to the OS pipe buffers. This is because
> `iostat` output is too small to quickly fill up the buffer. Use the `-u`
> option to unbuffer the `jc` output if you would like immediate output. See
> the [readme](https://github.com/kellyjonbrazil/jc/tree/master#unbuffering-output)
> for more information.
Usage (module):
import jc
# result is an iterable object (generator)
result = jc.parse('iostat_s', iostat_command_output.splitlines())
for item in result:
# do something
or
import jc.parsers.iostat_s
# result is an iterable object (generator)
result = jc.parsers.iostat_s.parse(iostat_command_output.splitlines())
for item in result:
# do something
Schema:
{
@@ -81,14 +83,12 @@ Schema:
"percent_rrqm": float,
"percent_wrqm": float,
# Below object only exists if using -qq or ignore_exceptions=True
"_jc_meta":
{
"success": boolean, # false if error parsing
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
# below object only exists if using -qq or ignore_exceptions=True
"_jc_meta": {
"success": boolean, # false if error parsing
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
}
Examples:
@@ -103,19 +103,16 @@ Examples:
{"device":"sda","tps":"0.24","kb_read_s":"5.28","kb_wrtn_s":"1.10"...}
...
<a id="jc.parsers.iostat_s.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False, ignore_exceptions=False)
@add_jc_meta
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
```
Main text parsing generator function. Returns an iterator object.
Main text parsing generator function. Returns an iterable object.
Parameters:
@@ -126,15 +123,11 @@ Parameters:
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
Iterable of Dictionaries
## Parser Information
### Parser Information
Compatibility: linux
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

555
docs/parsers/ip_address.md Normal file
View File

@@ -0,0 +1,555 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ip_address"></a>
# jc.parsers.ip\_address
jc - JSON Convert IP Address string parser
Accepts standard and integer IP address notation for both IPv4 and IPv6
addresses. CIDR subnet mask and Scope ID is also allowed for standard
notation. See examples below.
Usage (cli):
$ echo '192.168.1.1' | jc --ip-address
Usage (module):
import jc
result = jc.parse('ip_address', ip_address_string)
Schema:
{
"version": integer,
"max_prefix_length": integer,
"ip": string,
"ip_compressed": string,
"ip_exploded": string,
"ip_split": [
string
],
"scope_id": string/null,
"ipv4_mapped": string/null,
"six_to_four": string/null,
"teredo_client": string/null,
"teredo_server": string/null,
"dns_ptr": string,
"network": string,
"broadcast": string,
"hostmask": string,
"netmask": string,
"cidr_netmask": integer,
"hosts": integer,
"first_host": string,
"last_host": string,
"is_multicast": boolean,
"is_private": boolean,
"is_global": boolean,
"is_link_local": boolean,
"is_loopback": boolean,
"is_reserved": boolean,
"is_unspecified": boolean,
"int": {
"ip": integer,
"network": integer,
"broadcast": integer,
"first_host": integer,
"last_host": integer
},
"hex": {
"ip": string,
"network": string,
"broadcast": string,
"hostmask": string,
"netmask": string,
"first_host": string,
"last_host": string
},
"bin": {
"ip": string,
"network": string,
"broadcast": string,
"hostmask": string,
"netmask": string,
"first_host": string,
"last_host": string
}
}
Examples:
$ echo 192.168.2.10/24 | jc --ip-address -p
{
"version": 4,
"max_prefix_length": 32,
"ip": "192.168.2.10",
"ip_compressed": "192.168.2.10",
"ip_exploded": "192.168.2.10",
"ip_split": [
"192",
"168",
"2",
"10"
],
"scope_id": null,
"ipv4_mapped": null,
"six_to_four": null,
"teredo_client": null,
"teredo_server": null,
"dns_ptr": "10.2.168.192.in-addr.arpa",
"network": "192.168.2.0",
"broadcast": "192.168.2.255",
"hostmask": "0.0.0.255",
"netmask": "255.255.255.0",
"cidr_netmask": 24,
"hosts": 254,
"first_host": "192.168.2.1",
"last_host": "192.168.2.254",
"is_multicast": false,
"is_private": true,
"is_global": false,
"is_link_local": false,
"is_loopback": false,
"is_reserved": false,
"is_unspecified": false,
"int": {
"ip": 3232236042,
"network": 3232236032,
"broadcast": 3232236287,
"first_host": 3232236033,
"last_host": 3232236286
},
"hex": {
"ip": "c0:a8:02:0a",
"network": "c0:a8:02:00",
"broadcast": "c0:a8:02:ff",
"hostmask": "00:00:00:ff",
"netmask": "ff:ff:ff:00",
"first_host": "c0:a8:02:01",
"last_host": "c0:a8:02:fe"
},
"bin": {
"ip": "11000000101010000000001000001010",
"network": "11000000101010000000001000000000",
"broadcast": "11000000101010000000001011111111",
"hostmask": "00000000000000000000000011111111",
"netmask": "11111111111111111111111100000000",
"first_host": "11000000101010000000001000000001",
"last_host": "11000000101010000000001011111110"
}
}
$ echo 3232236042 | jc --ip-address -p
{
"version": 4,
"max_prefix_length": 32,
"ip": "192.168.2.10",
"ip_compressed": "192.168.2.10",
"ip_exploded": "192.168.2.10",
"ip_split": [
"192",
"168",
"2",
"10"
],
"scope_id": null,
"ipv4_mapped": null,
"six_to_four": null,
"teredo_client": null,
"teredo_server": null,
"dns_ptr": "10.2.168.192.in-addr.arpa",
"network": "192.168.2.10",
"broadcast": "192.168.2.10",
"hostmask": "0.0.0.0",
"netmask": "255.255.255.255",
"cidr_netmask": 32,
"hosts": 1,
"first_host": "192.168.2.10",
"last_host": "192.168.2.10",
"is_multicast": false,
"is_private": true,
"is_global": false,
"is_link_local": false,
"is_loopback": false,
"is_reserved": false,
"is_unspecified": false,
"int": {
"ip": 3232236042,
"network": 3232236042,
"broadcast": 3232236042,
"first_host": 3232236042,
"last_host": 3232236042
},
"hex": {
"ip": "c0:a8:02:0a",
"network": "c0:a8:02:0a",
"broadcast": "c0:a8:02:0a",
"hostmask": "00:00:00:00",
"netmask": "ff:ff:ff:ff",
"first_host": "c0:a8:02:0a",
"last_host": "c0:a8:02:0a"
},
"bin": {
"ip": "11000000101010000000001000001010",
"network": "11000000101010000000001000001010",
"broadcast": "11000000101010000000001000001010",
"hostmask": "00000000000000000000000000000000",
"netmask": "11111111111111111111111111111111",
"first_host": "11000000101010000000001000001010",
"last_host": "11000000101010000000001000001010"
}
}
$ echo 127:0:de::1%128/96 | jc --ip-address -p
{
"version": 6,
"max_prefix_length": 128,
"ip": "127:0:de::1",
"ip_compressed": "127:0:de::1",
"ip_exploded": "0127:0000:00de:0000:0000:0000:0000:0001",
"ip_split": [
"0127",
"0000",
"00de",
"0000",
"0000",
"0000",
"0000",
"0001"
],
"scope_id": "128",
"ipv4_mapped": null,
"six_to_four": null,
"teredo_client": null,
"teredo_server": null,
"dns_ptr": "1.0.0.0.0.0...0.0.0.e.d.0.0.0.0.0.0.7.2.1.0.ip6.arpa",
"network": "127:0:de::",
"broadcast": "127:0:de::ffff:ffff",
"hostmask": "::ffff:ffff",
"netmask": "ffff:ffff:ffff:ffff:ffff:ffff::",
"cidr_netmask": 96,
"hosts": 4294967294,
"first_host": "127:0:de::1",
"last_host": "127:0:de::ffff:fffe",
"is_multicast": false,
"is_private": false,
"is_global": true,
"is_link_local": false,
"is_loopback": false,
"is_reserved": true,
"is_unspecified": false,
"int": {
"ip": 1531727573536155682370944093904699393,
"network": 1531727573536155682370944093904699392,
"broadcast": 1531727573536155682370944098199666687,
"first_host": 1531727573536155682370944093904699393,
"last_host": 1531727573536155682370944098199666686
},
"hex": {
"ip": "01:27:00:00:00:de:00:00:00:00:00:00:00:00:00:01",
"network": "01:27:00:00:00:de:00:00:00:00:00:00:00:00:00:00",
"broadcast": "01:27:00:00:00:de:00:00:00:00:00:00:ff:ff:ff:ff",
"hostmask": "00:00:00:00:00:00:00:00:00:00:00:00:ff:ff:ff:ff",
"netmask": "ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:00:00:00:00",
"first_host": "01:27:00:00:00:de:00:00:00:00:00:00:00:00:00:01",
"last_host": "01:27:00:00:00:de:00:00:00:00:00:00:ff:ff:ff:fe"
},
"bin": {
"ip": "0000000100100111000000000000000000000000110...000000000001",
"network": "00000001001001110000000000000000000000...000000000000",
"broadcast": "000000010010011100000000000000000000...111111111111",
"hostmask": "0000000000000000000000000000000000000...111111111111",
"netmask": "11111111111111111111111111111111111111...000000000000",
"first_host": "00000001001001110000000000000000000...000000000001",
"last_host": "000000010010011100000000000000000000...1111111111110"
}
}
$ echo 1531727573536155682370944093904699393 | jc --ip-address -p
{
"version": 6,
"max_prefix_length": 128,
"ip": "127:0:de::1",
"ip_compressed": "127:0:de::1",
"ip_exploded": "0127:0000:00de:0000:0000:0000:0000:0001",
"ip_split": [
"0127",
"0000",
"00de",
"0000",
"0000",
"0000",
"0000",
"0001"
],
"scope_id": null,
"ipv4_mapped": null,
"six_to_four": null,
"teredo_client": null,
"teredo_server": null,
"dns_ptr": "1.0.0.0.0.0....0.0.0.0.e.d.0.0.0.0.0.0.7.2.1.0.ip6.arpa",
"network": "127:0:de::1",
"broadcast": "127:0:de::1",
"hostmask": "::",
"netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
"cidr_netmask": 128,
"hosts": 1,
"first_host": "127:0:de::1",
"last_host": "127:0:de::1",
"is_multicast": false,
"is_private": false,
"is_global": true,
"is_link_local": false,
"is_loopback": false,
"is_reserved": true,
"is_unspecified": false,
"int": {
"ip": 1531727573536155682370944093904699393,
"network": 1531727573536155682370944093904699393,
"broadcast": 1531727573536155682370944093904699393,
"first_host": 1531727573536155682370944093904699393,
"last_host": 1531727573536155682370944093904699393
},
"hex": {
"ip": "01:27:00:00:00:de:00:00:00:00:00:00:00:00:00:01",
"network": "01:27:00:00:00:de:00:00:00:00:00:00:00:00:00:01",
"broadcast": "01:27:00:00:00:de:00:00:00:00:00:00:00:00:00:01",
"hostmask": "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00",
"netmask": "ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff",
"first_host": "01:27:00:00:00:de:00:00:00:00:00:00:00:00:00:01",
"last_host": "01:27:00:00:00:de:00:00:00:00:00:00:00:00:00:01"
},
"bin": {
"ip": "0000000100100111000000000000000000000000110111100...000001",
"network": "00000001001001110000000000000000000000001101...000001",
"broadcast": "000000010010011100000000000000000000000011...000001",
"hostmask": "0000000000000000000000000000000000000000000...000000",
"netmask": "11111111111111111111111111111111111111111111...111111",
"first_host": "00000001001001110000000000000000000000001...000001",
"last_host": "000000010010011100000000000000000000000011...0000001"
}
}
# IPv4 Mapped Address
$ echo ::FFFF:192.168.1.35 | jc --ip-address -p
{
"version": 6,
"max_prefix_length": 128,
"ip": "::ffff:c0a8:123",
"ip_compressed": "::ffff:c0a8:123",
"ip_exploded": "0000:0000:0000:0000:0000:ffff:c0a8:0123",
"ip_split": [
"0000",
"0000",
"0000",
"0000",
"0000",
"ffff",
"c0a8",
"0123"
],
"scope_id": null,
"ipv4_mapped": "192.168.1.35",
"six_to_four": null,
"teredo_client": null,
"teredo_server": null,
"dns_ptr": "3.2.1.0.8.a.0.c.f.f.f.f.0.0....0.0.0.0.0.0.ip6.arpa",
"network": "::ffff:c0a8:123",
"broadcast": "::ffff:c0a8:123",
"hostmask": "::",
"netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
"cidr_netmask": 128,
"hosts": 1,
"first_host": "::ffff:c0a8:123",
"last_host": "::ffff:c0a8:123",
"is_multicast": false,
"is_private": true,
"is_global": false,
"is_link_local": false,
"is_loopback": false,
"is_reserved": true,
"is_unspecified": false,
"int": {
"ip": 281473913979171,
"network": 281473913979171,
"broadcast": 281473913979171,
"first_host": 281473913979171,
"last_host": 281473913979171
},
"hex": {
"ip": "00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23",
"network": "00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23",
"broadcast": "00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23",
"hostmask": "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00",
"netmask": "ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff",
"first_host": "00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23",
"last_host": "00:00:00:00:00:00:00:00:00:00:ff:ff:c0:a8:01:23"
},
"bin": {
"ip": "000000000000000000000000000000000000000000000...100100011",
"network": "0000000000000000000000000000000000000000...000100011",
"broadcast": "00000000000000000000000000000000000000...000100011",
"hostmask": "000000000000000000000000000000000000000...000000000",
"netmask": "1111111111111111111111111111111111111111...111111111",
"first_host": "0000000000000000000000000000000000000...100100011",
"last_host": "00000000000000000000000000000000000000...0100100011"
}
}
# 6to4 Address
$ echo 2002:c000:204::/48 | jc --ip-address -p
{
"version": 6,
"max_prefix_length": 128,
"ip": "2002:c000:204::",
"ip_compressed": "2002:c000:204::",
"ip_exploded": "2002:c000:0204:0000:0000:0000:0000:0000",
"ip_split": [
"2002",
"c000",
"0204",
"0000",
"0000",
"0000",
"0000",
"0000"
],
"scope_id": null,
"ipv4_mapped": null,
"six_to_four": "192.0.2.4",
"teredo_client": null,
"teredo_server": null,
"dns_ptr": "0.0.0.0.0.0.0...0.0.0.4.0.2.0.0.0.0.c.2.0.0.2.ip6.arpa",
"network": "2002:c000:204::",
"broadcast": "2002:c000:204:ffff:ffff:ffff:ffff:ffff",
"hostmask": "::ffff:ffff:ffff:ffff:ffff",
"netmask": "ffff:ffff:ffff::",
"cidr_netmask": 48,
"hosts": 1208925819614629174706174,
"first_host": "2002:c000:204::1",
"last_host": "2002:c000:204:ffff:ffff:ffff:ffff:fffe",
"is_multicast": false,
"is_private": false,
"is_global": true,
"is_link_local": false,
"is_loopback": false,
"is_reserved": false,
"is_unspecified": false,
"int": {
"ip": 42549574682102084431821433448024768512,
"network": 42549574682102084431821433448024768512,
"broadcast": 42549574682103293357641048077199474687,
"first_host": 42549574682102084431821433448024768513,
"last_host": 42549574682103293357641048077199474686
},
"hex": {
"ip": "20:02:c0:00:02:04:00:00:00:00:00:00:00:00:00:00",
"network": "20:02:c0:00:02:04:00:00:00:00:00:00:00:00:00:00",
"broadcast": "20:02:c0:00:02:04:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff",
"hostmask": "00:00:00:00:00:00:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff",
"netmask": "ff:ff:ff:ff:ff:ff:00:00:00:00:00:00:00:00:00:00",
"first_host": "20:02:c0:00:02:04:00:00:00:00:00:00:00:00:00:01",
"last_host": "20:02:c0:00:02:04:ff:ff:ff:ff:ff:ff:ff:ff:ff:fe"
},
"bin": {
"ip": "00100000000000101100000000000000000000100000010...00000000",
"network": "001000000000001011000000000000000000001000...00000000",
"broadcast": "0010000000000010110000000000000000000010...11111111",
"hostmask": "00000000000000000000000000000000000000000...11111111",
"netmask": "111111111111111111111111111111111111111111...00000000",
"first_host": "001000000000001011000000000000000000001...00000001",
"last_host": "0010000000000010110000000000000000000010...111111110"
}
}
# Teredo Address
$ echo 2001:0000:4136:e378:8000:63bf:3fff:fdd2 | jc --ip-address -p
{
"version": 6,
"max_prefix_length": 128,
"ip": "2001:0:4136:e378:8000:63bf:3fff:fdd2",
"ip_compressed": "2001:0:4136:e378:8000:63bf:3fff:fdd2",
"ip_exploded": "2001:0000:4136:e378:8000:63bf:3fff:fdd2",
"ip_split": [
"2001",
"0000",
"4136",
"e378",
"8000",
"63bf",
"3fff",
"fdd2"
],
"scope_id": null,
"ipv4_mapped": null,
"six_to_four": null,
"teredo_client": "192.0.2.45",
"teredo_server": "65.54.227.120",
"dns_ptr": "2.d.d.f.f.f.f.3.f.b.3.6.0.0.0.8.8....0.1.0.0.2.ip6.arpa",
"network": "2001:0:4136:e378:8000:63bf:3fff:fdd2",
"broadcast": "2001:0:4136:e378:8000:63bf:3fff:fdd2",
"hostmask": "::",
"netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
"cidr_netmask": 128,
"hosts": 1,
"first_host": "2001:0:4136:e378:8000:63bf:3fff:fdd2",
"last_host": "2001:0:4136:e378:8000:63bf:3fff:fdd2",
"is_multicast": false,
"is_private": true,
"is_global": false,
"is_link_local": false,
"is_loopback": false,
"is_reserved": false,
"is_unspecified": false,
"int": {
"ip": 42540488182158724593221357832373272018,
"network": 42540488182158724593221357832373272018,
"broadcast": 42540488182158724593221357832373272018,
"first_host": 42540488182158724593221357832373272018,
"last_host": 42540488182158724593221357832373272018
},
"hex": {
"ip": "20:01:00:00:41:36:e3:78:80:00:63:bf:3f:ff:fd:d2",
"network": "20:01:00:00:41:36:e3:78:80:00:63:bf:3f:ff:fd:d2",
"broadcast": "20:01:00:00:41:36:e3:78:80:00:63:bf:3f:ff:fd:d2",
"hostmask": "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00",
"netmask": "ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff",
"first_host": "20:01:00:00:41:36:e3:78:80:00:63:bf:3f:ff:fd:d2",
"last_host": "20:01:00:00:41:36:e3:78:80:00:63:bf:3f:ff:fd:d2"
},
"bin": {
"ip": "0010000000000001000000000000000001000001001...110111010010",
"network": "00100000000000010000000000000000010000...110111010010",
"broadcast": "001000000000000100000000000000000100...110111010010",
"hostmask": "0000000000000000000000000000000000000...000000000000",
"netmask": "11111111111111111111111111111111111111...111111111111",
"first_host": "00100000000000010000000000000000010...110111010010",
"last_host": "001000000000000100000000000000000100...110111010010"
}
}
<a id="jc.parsers.ip_address.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.iptables"></a>
# jc.parsers.iptables
jc - JSON CLI output utility `iptables` command output parser
jc - JSON Convert `iptables` command output parser
Supports `-vLn` and `--line-numbers` for all tables.
@@ -9,7 +11,7 @@ Usage (cli):
$ sudo iptables -L -t nat | jc --iptables
or
or
$ jc iptables -L -t nat
@@ -18,11 +20,6 @@ Usage (module):
import jc
result = jc.parse('iptables', iptables_command_output)
or
import jc.parsers.iptables
result = jc.parsers.iptables.parse(iptables_command_output)
Schema:
[
@@ -166,16 +163,12 @@ Examples:
...
]
<a id="jc.parsers.iptables.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -190,7 +183,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -0,0 +1,37 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.iso_datetime"></a>
# jc.parsers.iso\_datetime
jc - JSON Convert ISO 8601 Datetime string parser
This parser has been renamed to datetime-iso (cli) or datetime_iso (module).
This parser will be removed in a future version, so please start using
the new parser name.
<a id="jc.parsers.iso_datetime.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
This parser is deprecated and calls datetime_iso. Please use datetime_iso
directly. This parser will be removed in the future.
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux, aix, freebsd, darwin, win32, cygwin
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.iw_scan"></a>
# jc.parsers.iw_scan
jc - JSON CLI output utility `iw dev <device> scan` command output parser
# jc.parsers.iw\_scan
jc - JSON Convert `iw dev <device> scan` command output parser
This parser is considered beta quality. Not all fields are parsed and there
are not enough samples to test.
@@ -10,7 +12,7 @@ Usage (cli):
$ iw dev wlan0 scan | jc --iw-scan
or
or
$ jc iw dev wlan0 scan
@@ -19,11 +21,6 @@ Usage (module):
import jc
result = jc.parse('iw_scan', iw_scan_command_output)
or
import jc.parsers.iw_scan
result = jc.parsers.iw_scan.parse(iw_scan_command_output)
Schema:
[
@@ -124,16 +121,12 @@ Examples:
...
]
<a id="jc.parsers.iw_scan.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -148,7 +141,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 0.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

112
docs/parsers/iwconfig.md Normal file
View File

@@ -0,0 +1,112 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.iwconfig"></a>
# jc.parsers.iwconfig
jc - JSON Convert `iwconfig` command output parser
No `iwconfig` options are supported.
Usage (cli):
$ iwconfig | jc --iwconfig
or
$ jc iwconfig
Usage (module):
import jc
result = jc.parse('iwconfig', iwconfig_command_output)
Schema:
[
{
"name": string,
"protocol": string,
"essid": string,
"mode": string,
"frequency": float,
"frequency_unit": string,
"access_point": string,
"bit_rate": float,
"bit_rate_unit": string,
"tx_power": integer,
"tx_power_unit": string,
"retry_short_limit": integer,
"rts_threshold": boolean,
"fragment_threshold": boolean,
"power_management": boolean,
"link_quality": string,
"signal_level": integer,
"signal_level_unit": string,
"rx_invalid_nwid": integer,
"rx_invalid_crypt": integer,
"rx_invalid_frag": integer,
"tx_excessive_retries": integer,
"invalid_misc": integer,
"missed_beacon": integer
}
]
Examples:
$ iwconfig | jc --iwconfig -p
[
{
"name": "wlp5s0",
"protocol": "IEEE 802.11",
"essid": "BLABLABLA",
"mode": "Managed",
"frequency": 5.18,
"frequency_unit": "GHz",
"access_point": "E6:64:DA:16:51:BF",
"bit_rate": 6.0,
"bit_rate_unit": "Mb/s",
"tx_power": 30,
"tx_power_unit": "dBm",
"retry_short_limit": 7,
"rts_threshold": false,
"fragment_threshold": false,
"power_management": true,
"link_quality": "61/70",
"signal_level": -49,
"signal_level_unit": "dBm",
"rx_invalid_nwid": 0,
"rx_invalid_crypt": 0,
"rx_invalid_frag": 0,
"tx_excessive_retries": 0,
"invalid_misc": 2095,
"missed_beacon": 0
}
]
<a id="jc.parsers.iwconfig.parse"></a>
### parse
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output 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 Thomas Vincent (vrince@gmail.com)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.jar_manifest"></a>
# jc.parsers.jar_manifest
jc - JSON CLI output utility `MANIFEST.MF` file parser
# jc.parsers.jar\_manifest
jc - JSON Convert Java `MANIFEST.MF` file parser
Usage (cli):
@@ -12,11 +14,6 @@ Usage (module):
import jc
result = jc.parse('jar_manifest', jar_manifest_file_output)
or
import jc.parsers.jar_manifest
result = jc.parsers.jar_manifest.parse(jar_manifest_file_output)
Schema:
[
@@ -29,16 +26,16 @@ Schema:
Examples:
$ cat MANIFEST.MF | jc --jar-manifest -p
$ unzip -c log4j-core-2.16.0.jar META-INF/MANIFEST.MF | \
$ unzip -c 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 | \
$ 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;resoluti...",
"Export_Package": "org.apache.logging.log4j.core;uses:="org.ap...",
"Export_Package": "org.apache.logging.log4j.core;uses:=\"org.ap...",
"Manifest_Version": "1.0",
"Bundle_License": "https://www.apache.org/licenses/LICENSE-2.0.txt",
"Bundle_SymbolicName": "org.apache.logging.log4j.core",
@@ -51,7 +48,7 @@ Examples:
}
]
$ unzip -c 'apache-log4j-2.16.0-bin/*.jar' META-INF/MANIFEST.MF | \
$ unzip -c 'apache-log4j-2.16.0-bin/*.jar' META-INF/MANIFEST.MF | \\
jc --jar-manifest -p
[
...
@@ -80,16 +77,12 @@ Examples:
...
]
<a id="jc.parsers.jar_manifest.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -104,7 +97,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 0.01 by Matt J (https://github.com/listuser)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.jobs"></a>
# jc.parsers.jobs
jc - JSON CLI output utility `jobs` command output parser
jc - JSON Convert `jobs` command output parser
Also supports the `-l` option.
@@ -17,11 +19,6 @@ Usage (module):
import jc
result = jc.parse('jobs', jobs_command_output)
or
import jc.parsers.jobs
result = jc.parsers.jobs.parse(jobs_command_output)
Schema:
[
@@ -96,16 +93,12 @@ Example:
}
]
<a id="jc.parsers.jobs.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -120,7 +113,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### 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)

73
docs/parsers/jwt.md Normal file
View File

@@ -0,0 +1,73 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.jwt"></a>
# jc.parsers.jwt
jc - JSON Convert JWT string parser
> Note: `jc` will not check the integrity of the JWT payload.
Usage (cli):
$ echo "eyJhbGciOiJIUzI1N..." | jc --jwt
Usage (module):
import jc
result = jc.parse('jwt', jwt_string)
Schema:
{
"header": {
"alg": string,
"typ": string
},
"payload": {
<key name>: string/integer/float/boolean/null
},
"signature": string # [0]
}
[0] in colon-delimited hex notation
Examples:
% echo 'eyJhbGciOiJIUzI1N...' | jc --jwt -p
{
"header": {
"alg": "HS256",
"typ": "JWT"
},
"payload": {
"sub": "1234567890",
"name": "John Doe",
"iat": 1516239022
},
"signature": "49:f9:4a:c7:04:49:48:c7:8a:28:5d:90:4f:87:f0:a4:c7..."
}
<a id="jc.parsers.jwt.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,15 +1,19 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.kv"></a>
# jc.parsers.kv
jc - JSON CLI output utility `Key/Value` file parser
Supports files containing simple key/value pairs. Delimiter can be `=` or
`:`. Missing values are supported. Comment prefix can be `#` or `;`.
Comments must be on their own line.
jc - JSON Convert `Key/Value` file and string parser
Note: Values starting and ending with quotation marks will have the marks
removed. If you would like to keep the quotation marks, use the `-r`
command-line argument or the `raw=True` argument in `parse()`.
Supports files containing simple key/value pairs.
- Delimiter can be `=` or `:`. Missing values are supported.
- Comment prefix can be `#` or `;`. Comments must be on their own line.
- If duplicate keys are found, only the last value will be used.
> Note: Values starting and ending with quotation marks will have the marks
> removed. If you would like to keep the quotation marks, use the `-r`
> command-line argument or the `raw=True` argument in `parse()`.
Usage (cli):
@@ -20,15 +24,10 @@ Usage (module):
import jc
result = jc.parse('kv', kv_file_output)
or
import jc.parsers.kv
result = jc.parsers.kv.parse(kv_file_output)
Schema:
key/value document converted to a dictionary - see the
configparser standard library documentation for more details.
key/value document converted to a dictionary - see the configparser standard
library documentation for more details.
{
"key1": string,
@@ -56,16 +55,12 @@ Examples:
"occupation": "Engineer"
}
<a id="jc.parsers.kv.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -82,7 +77,7 @@ Returns:
Dictionary representing the key/value file
## Parser Information
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.last"></a>
# jc.parsers.last
jc - JSON CLI output utility `last` and `lastb` command output parser
jc - JSON Convert `last` and `lastb` command output parser
Supports `-w` and `-F` options.
@@ -13,7 +15,7 @@ Usage (cli):
$ last | jc --last
or
or
$ jc last
@@ -22,11 +24,6 @@ Usage (module):
import jc
result = jc.parse('last', last_command_output)
or
import jc.parsers.last
result = jc.parsers.last.parse(last_command_output)
Schema:
[
@@ -107,17 +104,12 @@ Examples:
...
]
<a id="jc.parsers.last.parse"></a>
### parse
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -132,7 +124,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, darwin, aix, freebsd
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,17 +1,20 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ls"></a>
# jc.parsers.ls
jc - JSON CLI output utility `ls` and `vdir` command output parser
jc - JSON Convert `ls` and `vdir` command output parser
Options supported:
- `lbaR1`
- `--time-style=full-iso`
Note: The `-1`, `-l`, or `-b` option of `ls` should be used to correctly
parse filenames that include newline characters. Since `ls` does not encode
newlines in filenames when outputting to a pipe it will cause `jc` to see
multiple files instead of a single file if `-1`, `-l`, or `-b` is not used.
Alternatively, `vdir` can be used, which is the same as running `ls -lb`.
> Note: The `-1`, `-l`, or `-b` option of `ls` should be used to correctly
> parse filenames that include newline characters. Since `ls` does not
> encode newlines in filenames when outputting to a pipe it will cause `jc`
> to see multiple files instead of a single file if `-1`, `-l`, or `-b` is
> not used. Alternatively, `vdir` can be used, which is the same as running
> `ls -lb`.
The `epoch` calculated timestamp field is naive. (i.e. based on the local
time of the system the parser is run on)
@@ -23,7 +26,7 @@ Usage (cli):
$ ls | jc --ls
or
or
$ jc ls
@@ -32,11 +35,6 @@ Usage (module):
import jc
result = jc.parse('ls', ls_command_output)
or
import jc.parsers.ls
result = jc.parsers.ls.parse(ls_command_output)
Schema:
[
@@ -119,16 +117,12 @@ Examples:
...
]
<a id="jc.parsers.ls.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -143,7 +137,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.10 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.12 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,10 +1,12 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ls_s"></a>
# jc.parsers.ls_s
jc - JSON CLI output utility `ls` and `vdir` command output streaming
parser
# jc.parsers.ls\_s
> This streaming parser outputs JSON Lines
jc - JSON Convert `ls` and `vdir` command output streaming parser
> This streaming parser outputs JSON Lines (cli) or returns an Iterable of
> Dictionaries (module)
Requires the `-l` option to be used on `ls`. If there are newline characters
in the filename, then make sure to use the `-b` option on `ls`.
@@ -25,19 +27,11 @@ Usage (cli):
Usage (module):
import jc
# result is an iterable object (generator)
result = jc.parse('ls_s', ls_command_output.splitlines())
for item in result:
# do something
or
import jc.parsers.ls_s
# result is an iterable object (generator)
result = jc.parsers.ls_s.parse(ls_command_output.splitlines())
for item in result:
# do something
Schema:
{
@@ -52,14 +46,12 @@ Schema:
"epoch": integer, # [0]
"epoch_utc": integer, # [1]
# Below object only exists if using -qq or ignore_exceptions=True
"_jc_meta":
{
"success": boolean, # false if error parsing
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
# below object only exists if using -qq or ignore_exceptions=True
"_jc_meta": {
"success": boolean, # false if error parsing
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
}
[0] naive timestamp if date field exists and can be converted.
@@ -80,19 +72,16 @@ Examples:
{"filename":"AssetCacheLocatorUtil","flags":"-rwxr-xr-x","links":"1...}
...
<a id="jc.parsers.ls_s.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False, ignore_exceptions=False)
@add_jc_meta
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
```
Main text parsing generator function. Returns an iterator object.
Main text parsing generator function. Returns an iterable object.
Parameters:
@@ -103,15 +92,11 @@ Parameters:
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
Iterable of Dictionaries
## Parser Information
### Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 0.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,13 +1,15 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.lsblk"></a>
# jc.parsers.lsblk
jc - JSON CLI output utility `lsblk` command output parser
jc - JSON Convert `lsblk` command output parser
Usage (cli):
$ lsblk | jc --lsblk
or
or
$ jc lsblk
@@ -16,11 +18,6 @@ Usage (module):
import jc
result = jc.parse('lsblk', lsblk_command_output)
or
import jc.parsers.lsblk
result = jc.parsers.lsblk.parse(lsblk_command_output)
Schema:
[
@@ -93,9 +90,9 @@ Examples:
...
]
$ lsblk -o +KNAME,FSTYPE,LABEL,UUID,PARTLABEL,PARTUUID,RA,MODEL,SERIAL,\
STATE,OWNER,GROUP,MODE,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,\
SCHED,RQ-SIZE,DISC-ALN,DISC-GRAN,DISC-MAX,DISC-ZERO,WSAME,WWN,RAND,\
$ lsblk -o +KNAME,FSTYPE,LABEL,UUID,PARTLABEL,PARTUUID,RA,MODEL,SERIAL,\\
STATE,OWNER,GROUP,MODE,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,\\
SCHED,RQ-SIZE,DISC-ALN,DISC-GRAN,DISC-MAX,DISC-ZERO,WSAME,WWN,RAND,\\
PKNAME,HCTL,TRAN,REV,VENDOR | jc --lsblk -p
[
{
@@ -185,9 +182,9 @@ Examples:
...
]
$ lsblk -o +KNAME,FSTYPE,LABEL,UUID,PARTLABEL,PARTUUID,RA,MODEL,SERIAL,\
STATE,OWNER,GROUP,MODE,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,\
SCHED,RQ-SIZE,DISC-ALN,DISC-GRAN,DISC-MAX,DISC-ZERO,WSAME,WWN,RAND,\
$ lsblk -o +KNAME,FSTYPE,LABEL,UUID,PARTLABEL,PARTUUID,RA,MODEL,SERIAL,\\
STATE,OWNER,GROUP,MODE,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,\\
SCHED,RQ-SIZE,DISC-ALN,DISC-GRAN,DISC-MAX,DISC-ZERO,WSAME,WWN,RAND,\\
PKNAME,HCTL,TRAN,REV,VENDOR | jc --lsblk -p -r
[
{
@@ -277,16 +274,12 @@ Examples:
...
]
<a id="jc.parsers.lsblk.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -301,7 +294,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,13 +1,15 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.lsmod"></a>
# jc.parsers.lsmod
jc - JSON CLI output utility `lsmod` command output parser
jc - JSON Convert `lsmod` command output parser
Usage (cli):
$ lsmod | jc --lsmod
or
or
$ jc lsmod
@@ -16,11 +18,6 @@ Usage (module):
import jc
result = jc.parse('lsmod', lsmod_command_output)
or
import jc.parsers.lsmod
result = jc.parsers.lsmod.parse(lsmod_command_output)
Schema:
[
@@ -128,16 +125,12 @@ Examples:
...
]
<a id="jc.parsers.lsmod.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -152,7 +145,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,13 +1,15 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.lsof"></a>
# jc.parsers.lsof
jc - JSON CLI output utility `lsof` command output parser
jc - JSON Convert `lsof` command output parser
Usage (cli):
$ lsof | jc --lsof
or
or
$ jc lsof
@@ -16,11 +18,6 @@ Usage (module):
import jc
result = jc.parse('lsof', lsof_command_output)
or
import jc.parsers.lsof
result = jc.parsers.lsof.parse(lsof_command_output)
Schema:
[
@@ -122,16 +119,12 @@ Examples:
...
]
<a id="jc.parsers.lsof.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -146,7 +139,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
Compatibility: linux
### 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)

148
docs/parsers/lspci.md Normal file
View File

@@ -0,0 +1,148 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.lspci"></a>
# jc.parsers.lspci
jc - JSON Convert `lspci -mmv` command output parser
This parser supports the following `lspci` options:
- `-mmv`
- `-nmmv`
- `-nnmmv`
Usage (cli):
$ lspci -nnmmv | jc --lspci
or
$ jc lspci -nnmmv
Usage (module):
import jc
result = jc.parse('lspci', lspci_command_output)
Schema:
[
{
"slot": string,
"domain": string,
"domain_int": integer,
"bus": string,
"bus_int": integer,
"dev": string,
"dev_int": integer,
"function": string,
"function_int": integer,
"class": string,
"class_id": string,
"class_id_int": integer,
"vendor": string,
"vendor_id": string,
"vendor_id_int": integer,
"device": string,
"device_id": string,
"device_id_int": integer,
"svendor": string,
"svendor_id": string,
"svendor_id_int": integer,
"sdevice": string,
"sdevice_id": string,
"sdevice_id_int": integer,
"rev": string,
"physlot": string,
"physlot_int": integer,
"progif": string,
"progif_int": integer
}
]
Examples:
$ lspci -nnmmv | jc --lspci -p
[
{
"slot": "ff:02:05.0",
"domain": "ff",
"domain_int": 255,
"bus": "02",
"bus_int": 2,
"dev": "05",
"dev_int": 5,
"function": "0",
"function_int": 0,
"class": "SATA controller",
"class_id": "0106",
"class_id_int": 262,
"vendor": "VMware",
"vendor_id": "15ad",
"vendor_id_int": 5549,
"device": "SATA AHCI controller",
"device_id": "07e0",
"device_id_int": 2016,
"svendor": "VMware",
"svendor_id": "15ad",
"svendor_id_int": 5549,
"sdevice": "SATA AHCI controller",
"sdevice_id": "07e0",
"sdevice_id_int": 2016,
"physlot": "37",
"physlot_int": 55,
"progif": "01",
"progif_int": 1
},
...
]
$ lspci -nnmmv | jc --lspci -p -r
[
{
"slot": "ff:02:05.0",
"domain": "ff",
"bus": "02",
"dev": "05",
"function": "0",
"class": "SATA controller",
"class_id": "0106",
"vendor": "VMware",
"vendor_id": "15ad",
"device": "SATA AHCI controller",
"device_id": "07e0",
"svendor": "VMware",
"svendor_id": "15ad",
"sdevice": "SATA AHCI controller",
"sdevice_id": "07e0",
"physlot": "37",
"progif": "01"
},
...
]
<a id="jc.parsers.lspci.parse"></a>
### parse
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output 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)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.lsusb"></a>
# jc.parsers.lsusb
jc - JSON CLI output utility `lsusb` command output parser
jc - JSON Convert `lsusb` command output parser
Supports the `-v` option or no options.
@@ -9,7 +11,7 @@ Usage (cli):
$ lsusb -v | jc --lsusb
or
or
$ jc lsusb -v
@@ -18,16 +20,11 @@ Usage (module):
import jc
result = jc.parse('lsusb', lsusb_command_output)
or
import jc.parsers.lsusb
result = jc.parsers.lsusb.parse(lsusb_command_output)
Schema:
Note: <item> object keynames are assigned directly from the lsusb
output. If there are duplicate <item> names in a section, only the
last one is converted.
> Note: <item> object keynames are assigned directly from the lsusb
> output. If there are duplicate <item> names in a section, only the
> last one is converted.
[
{
@@ -137,6 +134,12 @@ Schema:
}
}
},
"device_qualifier": {
"<item>": {
"value": string,
"description": string
}
},
"device_status": {
"value": string,
"description": string
@@ -264,16 +267,12 @@ Examples:
}
]
<a id="jc.parsers.lsusb.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -288,7 +287,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

90
docs/parsers/m3u.md Normal file
View File

@@ -0,0 +1,90 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.m3u"></a>
# jc.parsers.m3u
jc - JSON Convert M3U and M3U8 file parser
This parser will make a best-effort to parse extended field information. If
the extended fields cannot be successfully parsed, then an `unparsed_info`
field will be added to the object. If not using `--quiet`, then a warning
message also will be printed to `STDERR`.
Usage (cli):
$ cat playlist.m3u | jc --m3u
Usage (module):
import jc
result = jc.parse('m3u', m3u_file_output)
Schema:
[
{
"runtime": integer,
"display": string,
"path": string,
<extended fields>: string, # [0]
"unparsed_info": string, # [1]
}
]
[0] Field names are pulled directly from the #EXTINF: line
[1] Only added if the extended information cannot be parsed
Examples:
$ cat playlist.m3u | jc --m3u -p
[
{
"runtime": 105,
"display": "Example artist - Example title",
"path": "C:\\Files\\My Music\\Example.mp3"
},
{
"runtime": 321,
"display": "Example Artist2 - Example title2",
"path": "C:\\Files\\My Music\\Favorites\\Example2.ogg"
}
]
$ cat playlist.m3u | jc --m3u -p -r
[
{
"runtime": "105",
"display": "Example artist - Example title",
"path": "C:\\Files\\My Music\\Example.mp3"
},
{
"runtime": "321",
"display": "Example Artist2 - Example title2",
"path": "C:\\Files\\My Music\\Favorites\\Example2.ogg"
}
]
<a id="jc.parsers.m3u.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output 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 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

252
docs/parsers/mdadm.md Normal file
View File

@@ -0,0 +1,252 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.mdadm"></a>
# jc.parsers.mdadm
jc - JSON Convert `mdadm` command output parser
Supports the `--query` and `--examine` options in `mdadm`.
Usage (cli):
$ mdadm --query --detail /dev/md0 | jc --mdadm
or
$ mdadm --examine -E /dev/sdb1 | jc --mdadm
or
$ jc mdadm --query --detail /dev/md0
or
$ jc mdadm --examine -E /dev/sdb1
Usage (module):
import jc
result = jc.parse('mdadm', mdadm_command_output)
Schema:
{
"device": string,
"magic": string,
"version": string,
"feature_map": string,
"array_uuid": string,
"name": string,
"name_val": string,
"uuid": string,
"uuid_val": string,
"homehost": string,
"container": string,
"container_dev": string,
"container_member": integer,
"controller_guid": string,
"container_guid": string,
"seq": string,
"redundant_hdr": string,
"virtual_disks": integer,
"creation_time": string,
"creation_time_epoch": integer, # naive timestamp
"raid_level": string,
"array_size": string,
"array_size_num": integer,
"used_dev_size": string,
"used_dev_size_num": integer,
"raid_devices": integer,
"avail_dev_size": string,
"avail_dev_size_num": integer,
"data_offset": integer,
"super_offset": integer,
"unused_space": string,
"unused_space_before": integer,
"unused_space_after": integer,
"state": string,
"state_list": [
string
],
"device_uuid": string,
"flags": string,
"flag_list": [
string
],
"update_time": string,
"update_time_epoch": integer, # naive timestamp
"bad_block_log": string,
"checksum": string,
"checksum_val": string,
"checksum_state": string,
"events": string,
"events_num": integer,
"events_maj": integer,
"events_min": integer,
"chunk_size": string,
"chunk_size_num": integer,
"device_role": string,
"array_state": string,
"array_state_list": [
string
],
"member_arrays": string,
"member_arrays_list": [
string
],
"consistency_policy": string,
"rebuild_status": string,
"rebuild_status_percent": integer,
"resync_status": string,
"resync_status_percent": integer,
"check_status": string,
"check_status_percent": integer,
"total_devices": integer,
"preferred_minor": integer,
"persistence": string,
"active_devices": integer,
"working_devices": integer,
"failed_devices": integer,
"spare_devices": integer,
"physical_disks": integer,
"device_table": [
{
"number": integer/null,
"major": integer/null,
"minor": integer/null,
"state": [
string
],
"device": string,
"raid_device": integer/null
}
]
}
Any fields unspecified above will be string type.
Examples:
$ mdadm --query --detail /dev/md0 | jc --mdadm -p
{
"device": "/dev/md0",
"version": "1.1",
"creation_time": "Tue Apr 13 23:22:16 2010",
"raid_level": "raid1",
"array_size": "5860520828 (5.46 TiB 6.00 TB)",
"used_dev_size": "5860520828 (5.46 TiB 6.00 TB)",
"raid_devices": 2,
"total_devices": 2,
"persistence": "Superblock is persistent",
"intent_bitmap": "Internal",
"update_time": "Tue Jul 26 20:16:31 2022",
"state": "clean",
"active_devices": 2,
"working_devices": 2,
"failed_devices": 0,
"spare_devices": 0,
"consistency_policy": "bitmap",
"name": "virttest:0",
"uuid": "85c5b164:d58a5ada:14f5fe07:d642e843",
"events": 2193679,
"device_table": [
{
"number": 3,
"major": 8,
"minor": 17,
"state": [
"active",
"sync"
],
"device": "/dev/sdb1",
"raid_device": 0
},
{
"number": 2,
"major": 8,
"minor": 33,
"state": [
"active",
"sync"
],
"device": "/dev/sdc1",
"raid_device": 1
}
],
"array_size_num": 5860520828,
"used_dev_size_num": 5860520828,
"name_val": "virttest:0",
"uuid_val": "85c5b164:d58a5ada:14f5fe07:d642e843",
"state_list": [
"clean"
],
"creation_time_epoch": 1271226136,
"update_time_epoch": 1658891791
}
$ mdadm --query --detail /dev/md0 | jc --mdadm -p -r
{
"device": "/dev/md0",
"version": "1.1",
"creation_time": "Tue Apr 13 23:22:16 2010",
"raid_level": "raid1",
"array_size": "5860520828 (5.46 TiB 6.00 TB)",
"used_dev_size": "5860520828 (5.46 TiB 6.00 TB)",
"raid_devices": "2",
"total_devices": "2",
"persistence": "Superblock is persistent",
"intent_bitmap": "Internal",
"update_time": "Tue Jul 26 20:16:31 2022",
"state": "clean",
"active_devices": "2",
"working_devices": "2",
"failed_devices": "0",
"spare_devices": "0",
"consistency_policy": "bitmap",
"name": "virttest:0",
"uuid": "85c5b164:d58a5ada:14f5fe07:d642e843",
"events": "2193679",
"device_table": [
{
"number": "3",
"major": "8",
"minor": "17",
"state": "active sync",
"device": "/dev/sdb1",
"raid_device": "0"
},
{
"number": "2",
"major": "8",
"minor": "33",
"state": "active sync",
"device": "/dev/sdc1",
"raid_device": "1"
}
]
}
<a id="jc.parsers.mdadm.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,13 +1,15 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.mount"></a>
# jc.parsers.mount
jc - JSON CLI output utility `mount` command output parser
jc - JSON Convert `mount` command output parser
Usage (cli):
$ mount | jc --mount
or
or
$ jc mount
@@ -16,11 +18,6 @@ Usage (module):
import jc
result = jc.parse('mount', mount_command_output)
or
import jc.parsers.mount
result = jc.parsers.mount.parse(mount_command_output)
Schema:
[
@@ -78,16 +75,12 @@ Example:
...
]
<a id="jc.parsers.mount.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -102,7 +95,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, darwin, freebsd
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

140
docs/parsers/mpstat.md Normal file
View File

@@ -0,0 +1,140 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.mpstat"></a>
# jc.parsers.mpstat
jc - JSON Convert `mpstat` command output parser
> Note: Latest versions of `mpstat` support JSON output (v11.5.1+)
Usage (cli):
$ mpstat | jc --mpstat
or
$ jc mpstat
Usage (module):
import jc
result = jc.parse('mpstat', mpstat_command_output)
Schema:
[
{
"type": string,
"time": string,
"cpu": string,
"node": string,
"average": boolean,
"percent_usr": float,
"percent_nice": float,
"percent_sys": float,
"percent_iowait": float,
"percent_irq": float,
"percent_soft": float,
"percent_steal": float,
"percent_guest": float,
"percent_gnice": float,
"percent_idle": float,
"intr_s": float,
"<x>_s": float, # <x> is an integer
"nmi_s": float,
"loc_s": float,
"spu_s": float,
"pmi_s": float,
"iwi_s": float,
"rtr_s": float,
"res_s": float,
"cal_s": float,
"tlb_s": float,
"trm_s": float,
"thr_s": float,
"dfr_s": float,
"mce_s": float,
"mcp_s": float,
"err_s": float,
"mis_s": float,
"pin_s": float,
"npi_s": float,
"piw_s": float,
"hi_s": float,
"timer_s": float,
"net_tx_s": float,
"net_rx_s": float,
"block_s": float,
"irq_poll_s": float,
"block_iopoll_s": float,
"tasklet_s": float,
"sched_s": float,
"hrtimer_s": float,
"rcu_s": float
}
]
Examples:
$ mpstat | jc --mpstat -p
[
{
"cpu": "all",
"percent_usr": 12.94,
"percent_nice": 0.0,
"percent_sys": 26.42,
"percent_iowait": 0.43,
"percent_irq": 0.0,
"percent_soft": 0.16,
"percent_steal": 0.0,
"percent_guest": 0.0,
"percent_gnice": 0.0,
"percent_idle": 60.05,
"type": "cpu",
"time": "01:58:14 PM"
}
]
$ mpstat | jc --mpstat -p -r
[
{
"cpu": "all",
"percent_usr": "12.94",
"percent_nice": "0.00",
"percent_sys": "26.42",
"percent_iowait": "0.43",
"percent_irq": "0.00",
"percent_soft": "0.16",
"percent_steal": "0.00",
"percent_guest": "0.00",
"percent_gnice": "0.00",
"percent_idle": "60.05",
"type": "cpu",
"time": "01:58:14 PM"
}
]
<a id="jc.parsers.mpstat.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

128
docs/parsers/mpstat_s.md Normal file
View File

@@ -0,0 +1,128 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.mpstat_s"></a>
# jc.parsers.mpstat\_s
jc - JSON Convert `mpstat` command output streaming parser
> This streaming parser outputs JSON Lines (cli) or returns an Iterable of
> Dictionaries (module)
> Note: Latest versions of `mpstat` support JSON output (v11.5.1+)
Usage (cli):
$ mpstat | jc --mpstat-s
Usage (module):
import jc
result = jc.parse('mpstat_s', mpstat_command_output.splitlines())
for item in result:
# do something
Schema:
{
"type": string,
"time": string,
"cpu": string,
"node": string,
"average": boolean,
"percent_usr": float,
"percent_nice": float,
"percent_sys": float,
"percent_iowait": float,
"percent_irq": float,
"percent_soft": float,
"percent_steal": float,
"percent_guest": float,
"percent_gnice": float,
"percent_idle": float,
"intr_s": float,
"<x>_s": float, # <x> is an integer
"nmi_s": float,
"loc_s": float,
"spu_s": float,
"pmi_s": float,
"iwi_s": float,
"rtr_s": float,
"res_s": float,
"cal_s": float,
"tlb_s": float,
"trm_s": float,
"thr_s": float,
"dfr_s": float,
"mce_s": float,
"mcp_s": float,
"err_s": float,
"mis_s": float,
"pin_s": float,
"npi_s": float,
"piw_s": float,
"hi_s": float,
"timer_s": float,
"net_tx_s": float,
"net_rx_s": float,
"block_s": float,
"irq_poll_s": float,
"block_iopoll_s": float,
"tasklet_s": float,
"sched_s": float,
"hrtimer_s": float,
"rcu_s": float,
# below object only exists if using -qq or ignore_exceptions=True
"_jc_meta": {
"success": boolean, # false if error parsing
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
}
Examples:
$ mpstat -A | jc --mpstat-s
{"cpu":"all","percent_usr":0.22,"percent_nice":0.0,"percent_sys":...}
{"cpu":"0","percent_usr":0.22,"percent_nice":0.0,"percent_sys":0....}
{"cpu":"all","intr_s":37.61,"type":"interrupts","time":"03:15:06 PM"}
...
$ mpstat -A | jc --mpstat-s -r
{"cpu":"all","percent_usr":"0.22","percent_nice":"0.00","percent_...}
{"cpu":"0","percent_usr":"0.22","percent_nice":"0.00","percent_sy...}
{"cpu":"all","intr_s":"37.61","type":"interrupts","time":"03:15:06 PM"}
...
<a id="jc.parsers.mpstat_s.parse"></a>
### parse
```python
@add_jc_meta
def parse(data: Iterable[str],
raw: bool = False,
quiet: bool = False,
ignore_exceptions: bool = False) -> Union[Iterable[Dict], tuple]
```
Main text parsing generator function. Returns an iterable object.
Parameters:
data: (iterable) line-based text data to parse
(e.g. sys.stdin or str.splitlines())
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
ignore_exceptions: (boolean) ignore parsing exceptions if True
Returns:
Iterable of Dictionaries
### Parser Information
Compatibility: linux
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.netstat"></a>
# jc.parsers.netstat
jc - JSON CLI output utility `netstat` command output parser
jc - JSON Convert `netstat` command output parser
Caveats:
- Use of multiple `l` options is not supported on OSX (e.g. `netstat -rlll`)
@@ -12,7 +14,7 @@ Usage (cli):
$ netstat | jc --netstat
or
or
$ jc netstat
@@ -21,11 +23,6 @@ Usage (module):
import jc
result = jc.parse('netstat', netstat_command_output)
or
import jc.parsers.netstat
result = jc.parsers.netstat.parse(netstat_command_output)
Schema:
[
@@ -358,16 +355,12 @@ Examples:
}
]
<a id="jc.parsers.netstat.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -382,7 +375,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, darwin, freebsd
Version 1.12 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.13 by Kelly Brazil (kellyjonbrazil@gmail.com)

171
docs/parsers/nmcli.md Normal file
View File

@@ -0,0 +1,171 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.nmcli"></a>
# jc.parsers.nmcli
jc - JSON Convert `nmcli` command output parser
Supports the following `nmcli` subcommands:
- `nmcli general`
- `nmcli general permissions`
- `nmcli connection`
- `nmcli connection show <device_name>`
- `nmcli device`
- `nmcli device show`
- `nmcli device show <device_name>`
Usage (cli):
$ nmcli device show lo | jc --nmcli
or
$ jc nmcli device show lo
Usage (module):
import jc
result = jc.parse('nmcli', nmcli_command_output)
Schema:
Because there are so many options, the schema is not strictly defined.
Integer and Float value conversions are attempted and the original
values are kept if they fail. If you don't want automatic conversion,
then use the `-r` or `raw=True` option to disable it.
The structure is flat, for the most part, but there are a couple of
"well-known" keys that are further parsed into objects for convenience.
These are documented below.
[
{
"<key>": string/integer/float, # [0]
"dhcp4_option_x": {
"name": string,
"value": string/integer/float,
},
"dhcp6_option_x": {
"name": string,
"value": string/integer/float,
},
"ip4_route_x": {
"dst": string,
"nh": string,
"mt": integer
},
"ip6_route_x": {
"dst": string,
"nh": string,
"mt": integer,
"table": integer
}
}
]
[0] all values of `---` are converted to null
Examples:
$ nmcli connection show ens33 | jc --nmcli -p
[
{
"connection_id": "ens33",
"connection_uuid": "d92ece08-9e02-47d5-b2d2-92c80e155744",
"connection_stable_id": null,
"connection_type": "802-3-ethernet",
"connection_interface_name": "ens33",
"connection_autoconnect": "yes",
...
"ip4_address_1": "192.168.71.180/24",
"ip4_gateway": "192.168.71.2",
"ip4_route_1": {
"dst": "0.0.0.0/0",
"nh": "192.168.71.2",
"mt": 100
},
"ip4_route_2": {
"dst": "192.168.71.0/24",
"nh": "0.0.0.0",
"mt": 100
},
"ip4_dns_1": "192.168.71.2",
"ip4_domain_1": "localdomain",
"dhcp4_option_1": {
"name": "broadcast_address",
"value": "192.168.71.255"
},
...
"ip6_address_1": "fe80::c1cb:715d:bc3e:b8a0/64",
"ip6_gateway": null,
"ip6_route_1": {
"dst": "fe80::/64",
"nh": "::",
"mt": 100
}
}
]
$ nmcli connection show ens33 | jc --nmcli -p -r
[
{
"connection_id": "ens33",
"connection_uuid": "d92ece08-9e02-47d5-b2d2-92c80e155744",
"connection_stable_id": null,
"connection_type": "802-3-ethernet",
"connection_interface_name": "ens33",
"connection_autoconnect": "yes",
...
"ip4_address_1": "192.168.71.180/24",
"ip4_gateway": "192.168.71.2",
"ip4_route_1": {
"dst": "0.0.0.0/0",
"nh": "192.168.71.2",
"mt": "100"
},
"ip4_route_2": {
"dst": "192.168.71.0/24",
"nh": "0.0.0.0",
"mt": "100"
},
"ip4_dns_1": "192.168.71.2",
"ip4_domain_1": "localdomain",
"dhcp4_option_1": {
"name": "broadcast_address",
"value": "192.168.71.255"
},
...
"ip6_address_1": "fe80::c1cb:715d:bc3e:b8a0/64",
"ip6_gateway": null,
"ip6_route_1": {
"dst": "fe80::/64",
"nh": "::",
"mt": "100"
}
}
]
<a id="jc.parsers.nmcli.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output 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)

View File

@@ -1,13 +1,15 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ntpq"></a>
# jc.parsers.ntpq
jc - JSON CLI output utility `ntpq -p` command output parser
jc - JSON Convert `ntpq -p` command output parser
Usage (cli):
$ ntpq -p | jc --ntpq
or
or
$ jc ntpq -p
@@ -16,11 +18,6 @@ Usage (module):
import jc
result = jc.parse('ntpq', ntpq_command_output)
or
import jc.parsers.ntpq
result = jc.parsers.ntpq.parse(ntpq_command_output)
Schema:
[
@@ -209,16 +206,12 @@ Examples:
}
]
<a id="jc.parsers.ntpq.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -233,7 +226,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, freebsd
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

178
docs/parsers/openvpn.md Normal file
View File

@@ -0,0 +1,178 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.openvpn"></a>
# jc.parsers.openvpn
jc - JSON Convert openvpn-status.log file parser
The `*_epoch` calculated timestamp fields are naive. (i.e. based on
the local time of the system the parser is run on)
Usage (cli):
$ cat openvpn-status.log | jc --openvpn
Usage (module):
import jc
result = jc.parse('openvpn', openvpn_status_log_file_output)
Schema:
{
"clients": [
{
"common_name": string,
"real_address": string,
"real_address_prefix": integer, # [0]
"real_address_port": integer, # [0]
"bytes_received": integer,
"bytes_sent": integer,
"connected_since": string,
"connected_since_epoch": integer,
"updated": string,
"updated_epoch": integer,
}
],
"routing_table": [
{
"virtual_address": string,
"virtual_address_prefix": integer, # [0]
"virtual_address_port": integer, # [0]
"common_name": string,
"real_address": string,
"real_address_prefix": integer, # [0]
"real_address_port": integer, # [0]
"last_reference": string,
"last_reference_epoch": integer,
}
],
"global_stats": {
"max_bcast_mcast_queue_len": integer
}
}
[0] null/None if not found
Examples:
$ cat openvpn-status.log | jc --openvpn -p
{
"clients": [
{
"common_name": "foo@example.com",
"real_address": "10.10.10.10",
"bytes_received": 334948,
"bytes_sent": 1973012,
"connected_since": "Thu Jun 18 04:23:03 2015",
"updated": "Thu Jun 18 08:12:15 2015",
"real_address_prefix": null,
"real_address_port": 49502,
"connected_since_epoch": 1434626583,
"updated_epoch": 1434640335
},
{
"common_name": "foo@example.com",
"real_address": "10.10.10.10",
"bytes_received": 334948,
"bytes_sent": 1973012,
"connected_since": "Thu Jun 18 04:23:03 2015",
"updated": "Thu Jun 18 08:12:15 2015",
"real_address_prefix": null,
"real_address_port": 49503,
"connected_since_epoch": 1434626583,
"updated_epoch": 1434640335
}
],
"routing_table": [
{
"virtual_address": "192.168.255.118",
"common_name": "baz@example.com",
"real_address": "10.10.10.10",
"last_reference": "Thu Jun 18 08:12:09 2015",
"virtual_address_prefix": null,
"virtual_address_port": null,
"real_address_prefix": null,
"real_address_port": 63414,
"last_reference_epoch": 1434640329
},
{
"virtual_address": "10.200.0.0",
"common_name": "baz@example.com",
"real_address": "10.10.10.10",
"last_reference": "Thu Jun 18 08:12:09 2015",
"virtual_address_prefix": 16,
"virtual_address_port": null,
"real_address_prefix": null,
"real_address_port": 63414,
"last_reference_epoch": 1434640329
}
],
"global_stats": {
"max_bcast_mcast_queue_len": 0
}
}
$ cat openvpn-status.log | jc --openvpn -p -r
{
"clients": [
{
"common_name": "foo@example.com",
"real_address": "10.10.10.10:49502",
"bytes_received": "334948",
"bytes_sent": "1973012",
"connected_since": "Thu Jun 18 04:23:03 2015",
"updated": "Thu Jun 18 08:12:15 2015"
},
{
"common_name": "foo@example.com",
"real_address": "10.10.10.10:49503",
"bytes_received": "334948",
"bytes_sent": "1973012",
"connected_since": "Thu Jun 18 04:23:03 2015",
"updated": "Thu Jun 18 08:12:15 2015"
}
],
"routing_table": [
{
"virtual_address": "192.168.255.118",
"common_name": "baz@example.com",
"real_address": "10.10.10.10:63414",
"last_reference": "Thu Jun 18 08:12:09 2015"
},
{
"virtual_address": "10.200.0.0/16",
"common_name": "baz@example.com",
"real_address": "10.10.10.10:63414",
"last_reference": "Thu Jun 18 08:12:09 2015"
}
],
"global_stats": {
"max_bcast_mcast_queue_len": "0"
}
}
<a id="jc.parsers.openvpn.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> JSONDictType
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

66
docs/parsers/os_prober.md Normal file
View File

@@ -0,0 +1,66 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.os_prober"></a>
# jc.parsers.os\_prober
jc - JSON Convert `os-prober` command output parser
Usage (cli):
$ os-prober | jc --os-prober
or
$ jc os-prober
Usage (module):
import jc
result = jc.parse('os_prober', os_prober_command_output)
Schema:
{
"partition": string,
"efi_bootmgr": string, # [0]
"name": string,
"short_name": string,
"type": string
}
[0] only exists if an EFI boot manager is detected
Examples:
$ os-prober | jc --os-prober -p
{
"partition": "/dev/sda1",
"name": "Windows 10",
"short_name": "Windows",
"type": "chain"
}
<a id="jc.parsers.os_prober.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> JSONDictType
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,9 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.passwd"></a>
# jc.parsers.passwd
jc - JSON CLI output utility `/etc/passwd` file Parser
jc - JSON Convert `/etc/passwd` file Parser
Usage (cli):
@@ -12,11 +14,6 @@ Usage (module):
import jc
result = jc.parse('passwd', passwd_file_output)
or
import jc.parsers.passwd
result = jc.parsers.passwd.parse(passwd_file_output)
Schema:
[
@@ -97,16 +94,12 @@ Examples:
...
]
<a id="jc.parsers.passwd.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -121,7 +114,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, darwin, aix, freebsd
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

99
docs/parsers/pci_ids.md Normal file
View File

@@ -0,0 +1,99 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.pci_ids"></a>
# jc.parsers.pci\_ids
jc - JSON Convert `pci.ids` file parser
This parser converts the pci.ids database file.
https://raw.githubusercontent.com/pciutils/pciids/master/pci.ids
A nested schema allows straightforward queries with tools like `jq`. Hex id
numbers are prefixed with an underscore (`_`) so bracket notation is not
necessary when referencing. For example:
$ cat pci.ids | jc --pci-ids | jq '.vendors._9005._0053._9005._ffff.subsystem_name'
"AIC-7896 SCSI Controller mainboard implementation"
Here are the vendor and class mappings:
jq '.vendors._001c._0001._001c._0005.subsystem_name'
| | | |
| | | subdevice
| | subvendor
| device
vendor
jq '.classes._0c._03._40'
| | |
| | prog_if
| subclass
class
Usage (cli):
$ cat pci.ids | jc --pci-ids
Usage (module):
import jc
result = jc.parse('pci_ids', pci_ids_file_output)
Schema:
{
"vendors": {
"_<vendor_id>": {
"vendor_name": string,
"_<device_id>": {
"device_name": string,
"_<subvendor_id>": {
"_<subdevice_id": string
}
}
}
},
"classes": {
"_<class_id>": {
"class_name": string,
"_<subclass_id>": {
"subclass_name": string,
"_<prog_if>": string
}
}
}
}
Examples:
$ cat pci.ids | jc --pci-ids | jq '.vendors._001c._0001._001c._0005.subsystem_name'
"2 Channel CAN Bus SJC1000 (Optically Isolated)"
$ cat pci.ids | jc --pci-ids | jq '.classes._0c._03._40'
"USB4 Host Interface"
<a id="jc.parsers.pci_ids.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> JSONDictType
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

75
docs/parsers/pgpass.md Normal file
View File

@@ -0,0 +1,75 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.pgpass"></a>
# jc.parsers.pgpass
jc - JSON Convert PostgreSQL password file parser
Usage (cli):
$ cat /var/lib/postgresql/.pgpass | jc --pgpass
Usage (module):
import jc
result = jc.parse('pgpass', postgres_password_file)
Schema:
[
{
"hostname": string,
"port": string,
"database": string,
"username": string,
"password": string
}
]
Examples:
$ cat /var/lib/postgresql/.pgpass | jc --pgpass -p
[
{
"hostname": "dbserver",
"port": "*",
"database": "db1",
"username": "dbuser",
"password": "pwd123"
},
{
"hostname": "dbserver2",
"port": "8888",
"database": "inventory",
"username": "joe:user",
"password": "abc123"
},
...
]
<a id="jc.parsers.pgpass.parse"></a>
### parse
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output 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 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

151
docs/parsers/pidstat.md Normal file
View File

@@ -0,0 +1,151 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.pidstat"></a>
# jc.parsers.pidstat
jc - JSON Convert `pidstat -H` command output parser
Must use the `-H` (or `-h`, if `-H` is not available) option in `pidstat`.
All other `pidstat` options are supported in combination with this option.
Usage (cli):
$ pidstat -H | jc --pidstat
or
$ jc pidstat -H
Usage (module):
import jc
result = jc.parse('pidstat', pidstat_command_output)
Schema:
[
{
"time": integer,
"uid": integer,
"pid": integer,
"percent_usr": float,
"percent_system": float,
"percent_guest": float,
"percent_cpu": float,
"cpu": integer,
"minflt_s": float,
"majflt_s": float,
"vsz": integer,
"rss": integer,
"percent_mem": float,
"stksize": integer,
"stkref": integer,
"kb_rd_s": float,
"kb_wr_s": float,
"kb_ccwr_s": float,
"cswch_s": float,
"nvcswch_s": float,
"command": string
}
]
Examples:
$ pidstat -Hl | jc --pidstat -p
[
{
"time": 1646859134,
"uid": 0,
"pid": 1,
"percent_usr": 0.0,
"percent_system": 0.03,
"percent_guest": 0.0,
"percent_cpu": 0.03,
"cpu": 0,
"command": "/usr/lib/systemd/systemd --switched-root --system..."
},
{
"time": 1646859134,
"uid": 0,
"pid": 6,
"percent_usr": 0.0,
"percent_system": 0.0,
"percent_guest": 0.0,
"percent_cpu": 0.0,
"cpu": 0,
"command": "ksoftirqd/0"
},
{
"time": 1646859134,
"uid": 0,
"pid": 2263,
"percent_usr": 0.0,
"percent_system": 0.0,
"percent_guest": 0.0,
"percent_cpu": 0.0,
"cpu": 0,
"command": "kworker/0:0"
}
]
$ pidstat -Hl | jc --pidstat -p -r
[
{
"time": "1646859134",
"uid": "0",
"pid": "1",
"percent_usr": "0.00",
"percent_system": "0.03",
"percent_guest": "0.00",
"percent_cpu": "0.03",
"cpu": "0",
"command": "/usr/lib/systemd/systemd --switched-root --system..."
},
{
"time": "1646859134",
"uid": "0",
"pid": "6",
"percent_usr": "0.00",
"percent_system": "0.00",
"percent_guest": "0.00",
"percent_cpu": "0.00",
"cpu": "0",
"command": "ksoftirqd/0"
},
{
"time": "1646859134",
"uid": "0",
"pid": "2263",
"percent_usr": "0.00",
"percent_system": "0.00",
"percent_guest": "0.00",
"percent_cpu": "0.00",
"cpu": "0",
"command": "kworker/0:0"
}
]
<a id="jc.parsers.pidstat.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

110
docs/parsers/pidstat_s.md Normal file
View File

@@ -0,0 +1,110 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.pidstat_s"></a>
# jc.parsers.pidstat\_s
jc - JSON Convert `pidstat -H` command output streaming parser
> This streaming parser outputs JSON Lines (cli) or returns an Iterable of
> Dictionaries (module)
Must use the `-H` (or `-h`, if `-H` is not available) option in `pidstat`.
All other `pidstat` options are supported in combination with this option.
Usage (cli):
$ pidstat -H | jc --pidstat-s
> Note: When piping `jc` converted `pidstat` output to other processes it
> may appear the output is hanging due to the OS pipe buffers. This is
> because `pidstat` output is too small to quickly fill up the buffer. Use
> the `-u` option to unbuffer the `jc` output if you would like immediate
> output. See the [readme](https://github.com/kellyjonbrazil/jc/tree/master#unbuffering-output)
> for more information.
Usage (module):
import jc
result = jc.parse('pidstat_s', pidstat_command_output.splitlines())
for item in result:
# do something
Schema:
{
"time": integer,
"uid": integer,
"pid": integer,
"percent_usr": float,
"percent_system": float,
"percent_guest": float,
"percent_cpu": float,
"cpu": integer,
"minflt_s": float,
"majflt_s": float,
"vsz": integer,
"rss": integer,
"percent_mem": float,
"stksize": integer,
"stkref": integer,
"kb_rd_s": float,
"kb_wr_s": float,
"kb_ccwr_s": float,
"cswch_s": float,
"nvcswch_s": float,
"command": string,
# below object only exists if using -qq or ignore_exceptions=True
"_jc_meta": {
"success": boolean, # false if error parsing
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
}
Examples:
$ pidstat -Hl | jc --pidstat-s
{"time":1646859134,"uid":0,"pid":1,"percent_usr":0.0,"percent_syste...}
{"time":1646859134,"uid":0,"pid":6,"percent_usr":0.0,"percent_syste...}
{"time":1646859134,"uid":0,"pid":9,"percent_usr":0.0,"percent_syste...}
...
$ pidstat -Hl | jc --pidstat-s -r
{"time":"1646859134","uid":"0","pid":"1","percent_usr":"0.00","perc...}
{"time":"1646859134","uid":"0","pid":"6","percent_usr":"0.00","perc...}
{"time":"1646859134","uid":"0","pid":"9","percent_usr":"0.00","perc...}
...
<a id="jc.parsers.pidstat_s.parse"></a>
### parse
```python
@add_jc_meta
def parse(data: Iterable[str],
raw: bool = False,
quiet: bool = False,
ignore_exceptions: bool = False) -> Union[Iterable[Dict], tuple]
```
Main text parsing generator function. Returns an iterable object.
Parameters:
data: (iterable) line-based text data to parse
(e.g. sys.stdin or str.splitlines())
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
ignore_exceptions: (boolean) ignore parsing exceptions if True
Returns:
Iterable of Dictionaries
### Parser Information
Compatibility: linux
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,18 +1,20 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ping"></a>
# jc.parsers.ping
jc - JSON CLI output utility `ping` command output parser
jc - JSON Convert `ping` command output parser
Supports `ping` and `ping6` output.
Usage (cli):
Note: Use the ping `-c` (count) option, otherwise data will not be
piped to `jc`.
> Note: Use the ping `-c` (count) option, otherwise data will not be
> piped to `jc`.
$ ping -c 3 1.2.3.4 | jc --ping
or
or
$ jc ping -c 3 1.2.3.4
@@ -21,11 +23,6 @@ Usage (module):
import jc
result = jc.parse('ping', ping_command_output)
or
import jc.parsers.ping
result = jc.parsers.ping.parse(ping_command_output)
Schema:
{
@@ -165,16 +162,12 @@ Examples:
]
}
<a id="jc.parsers.ping.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -189,7 +182,7 @@ Returns:
Dictionary. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, darwin, freebsd
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,39 +1,34 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ping_s"></a>
# jc.parsers.ping_s
jc - JSON CLI output utility `ping` command output streaming parser
# jc.parsers.ping\_s
> This streaming parser outputs JSON Lines
jc - JSON Convert `ping` command output streaming parser
> This streaming parser outputs JSON Lines (cli) or returns an Iterable of
> Dictionaries (module)
Supports `ping` and `ping6` output.
Usage (cli):
$ ping | jc --ping-s
$ ping 1.2.3.4 | jc --ping-s
> Note: When piping `jc` converted `ping` output to other processes it may
appear the output is hanging due to the OS pipe buffers. This is because
`ping` output is too small to quickly fill up the buffer. Use the `-u`
option to unbuffer the `jc` output if you would like immediate output.
See the [readme](https://github.com/kellyjonbrazil/jc/tree/master#unbuffering-output)
for more information.
> appear the output is hanging due to the OS pipe buffers. This is because
> `ping` output is too small to quickly fill up the buffer. Use the `-u`
> option to unbuffer the `jc` output if you would like immediate output.
> See the [readme](https://github.com/kellyjonbrazil/jc/tree/master#unbuffering-output)
> for more information.
Usage (module):
import jc
# result is an iterable object (generator)
result = jc.parse('ping_s', ping_command_output.splitlines())
for item in result:
# do something
or
import jc.parsers.ping_s
# result is an iterable object (generator)
result = jc.parsers.ping_s.parse(ping_command_output.splitlines())
for item in result:
# do something
Schema:
{
@@ -59,14 +54,12 @@ Schema:
"round_trip_ms_max": float,
"round_trip_ms_stddev": float,
# Below object only exists if using -qq or ignore_exceptions=True
"_jc_meta":
{
"success": boolean, # false if error parsing
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
# below object only exists if using -qq or ignore_exceptions=True
"_jc_meta": {
"success": boolean, # false if error parsing
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
}
[0] 'reply', 'timeout', 'summary', etc. See `_error_type.type_map`
@@ -86,19 +79,16 @@ Examples:
{"type":"reply","destination_ip":"1.1.1.1","sent_bytes":"56","patte...}
...
<a id="jc.parsers.ping_s.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False, ignore_exceptions=False)
@add_jc_meta
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
```
Main text parsing generator function. Returns an iterator object.
Main text parsing generator function. Returns an iterable object.
Parameters:
@@ -109,15 +99,11 @@ Parameters:
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
Iterable of Dictionaries
## Parser Information
### Parser Information
Compatibility: linux, darwin, freebsd
Version 0.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,13 +1,15 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.pip_list"></a>
# jc.parsers.pip_list
jc - JSON CLI output utility `pip-list` command output parser
# jc.parsers.pip\_list
jc - JSON Convert `pip-list` command output parser
Usage (cli):
$ pip list | jc --pip-list
or
or
$ jc pip list
@@ -16,11 +18,6 @@ Usage (module):
import jc
result = jc.parse('pip_list', pip_list_command_output)
or
import jc.parsers.pip_list
result = jc.parsers.pip_list.parse(pip_list_command_output)
Schema:
[
@@ -50,16 +47,12 @@ Examples:
...
]
<a id="jc.parsers.pip_list.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data, raw=False, quiet=False)
```
Main text parsing function
@@ -74,7 +67,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,13 +1,15 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.pip_show"></a>
# jc.parsers.pip_show
jc - JSON CLI output utility `pip-show` command output parser
# jc.parsers.pip\_show
jc - JSON Convert `pip-show` command output parser
Usage (cli):
$ pip show | jc --pip-show
or
or
$ jc pip show
@@ -16,11 +18,6 @@ Usage (module):
import jc
result = jc.parse('pip_show', pip_show_command_output)
or
import jc.parsers.pip_show
result = jc.parsers.pip_show.parse(pip_show_command_output)
Schema:
[
@@ -68,16 +65,12 @@ Examples:
}
]
<a id="jc.parsers.pip_show.parse"></a>
## info
```python
info()
```
Provides parser metadata (version, author, etc.)
### parse
## parse
```python
parse(data, raw=False, quiet=False)
def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]
```
Main text parsing function
@@ -92,7 +85,7 @@ Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### 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)

77
docs/parsers/plist.md Normal file
View File

@@ -0,0 +1,77 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.plist"></a>
# jc.parsers.plist
jc - JSON Convert PLIST file parser
Converts binary, XML, and NeXTSTEP PLIST files.
Binary values are converted into an ASCII hex representation.
Datetime objects are converted into Unix epoch timestamps and ISO strings.
The timestamp and ISO string will maintain the same naive or timezone-aware
properties as the object in the original PLIST file.
Usage (cli):
$ cat file.plist | jc --plist
Usage (module):
import jc
result = jc.parse('plist', plist_file_output)
Schema:
{
"<key>": string/integer/float/boolean/object/array/null
}
Examples:
$ cat info.plist | jc --plist -p
{
"NSAppleScriptEnabled": true,
"LSMultipleInstancesProhibited": true,
"CFBundleInfoDictionaryVersion": "6.0",
"DTPlatformVersion": "GM",
"CFBundleIconFile": "GarageBand.icns",
"CFBundleName": "GarageBand",
"DTSDKName": "macosx10.13internal",
"NSSupportsAutomaticGraphicsSwitching": true,
"RevisionDate": "2018-12-03_14:10:56",
"UTImportedTypeDeclarations": [
{
"UTTypeConformsTo": [
"public.data",
"public.content"
...
}
<a id="jc.parsers.plist.parse"></a>
### parse
```python
def parse(data: Union[str, bytes],
raw: bool = False,
quiet: bool = False) -> Dict
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

115
docs/parsers/postconf.md Normal file
View File

@@ -0,0 +1,115 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.postconf"></a>
# jc.parsers.postconf
jc - JSON Convert `postconf -M` command output parser
Usage (cli):
$ postconf -M | jc --postconf
or
$ jc postconf -M
Usage (module):
import jc
result = jc.parse('postconf', postconf_command_output)
Schema:
[
{
"service_name": string,
"service_type": string,
"private": boolean/null, # [0]
"unprivileged": boolean/null, # [0]
"chroot": boolean/null, # [0]
"wake_up_time": integer/null, # [0]
"no_wake_up_before_first_use": boolean/null, # [1]
"process_limit": integer/null, # [0]
"command": string
}
]
[0] '-' converted to null/None
[1] null/None if `wake_up_time` is null/None
Examples:
$ postconf -M | jc --postconf -p
[
{
"service_name": "smtp",
"service_type": "inet",
"private": false,
"unprivileged": null,
"chroot": true,
"wake_up_time": null,
"process_limit": null,
"command": "smtpd",
"no_wake_up_before_first_use": null
},
{
"service_name": "pickup",
"service_type": "unix",
"private": false,
"unprivileged": null,
"chroot": true,
"wake_up_time": 60,
"process_limit": 1,
"command": "pickup",
"no_wake_up_before_first_use": false
}
]
$ postconf -M | jc --postconf -p -r
[
{
"service_name": "smtp",
"service_type": "inet",
"private": "n",
"unprivileged": "-",
"chroot": "y",
"wake_up_time": "-",
"process_limit": "-",
"command": "smtpd"
},
{
"service_name": "pickup",
"service_type": "unix",
"private": "n",
"unprivileged": "-",
"chroot": "y",
"wake_up_time": "60",
"process_limit": "1",
"command": "pickup"
}
]
<a id="jc.parsers.postconf.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output 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)

142
docs/parsers/proc.md Normal file
View File

@@ -0,0 +1,142 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc"></a>
# jc.parsers.proc
jc - JSON Convert Proc file output parser
This parser automatically identifies the Proc file and calls the
corresponding parser to perform the parsing.
Magic syntax for converting `/proc` files is also supported by running
`jc /proc/<path to file>`. Any `jc` options must be specified before the
`/proc` path.
specific Proc file parsers can also be called directly, if desired and have
a naming convention of `proc-<name>` (cli) or `proc_<name>` (module).
Usage (cli):
$ cat /proc/meminfo | jc --proc
or
$ jc /proc/meminfo
or
$ cat /proc/meminfo | jc --proc-memifno
Usage (module):
import jc
result = jc.parse('proc', proc_file)
Schema:
See the specific Proc parser for the schema:
$ jc --help --proc-<name>
For example:
$ jc --help --proc-meminfo
Specific Proc file parser names can be found with `jc -hh` or `jc -a`.
Schemas can also be found online at:
https://kellyjonbrazil.github.io/jc/docs/parsers/proc_<name>
For example:
https://kellyjonbrazil.github.io/jc/docs/parsers/proc_meminfo
Examples:
$ cat /proc/modules | jc --proc -p
[
{
"module": "binfmt_misc",
"size": 24576,
"used": 1,
"used_by": [],
"status": "Live",
"location": "0xffffffffc0ab4000"
},
{
"module": "vsock_loopback",
"size": 16384,
"used": 0,
"used_by": [],
"status": "Live",
"location": "0xffffffffc0a14000"
},
{
"module": "vmw_vsock_virtio_transport_common",
"size": 36864,
"used": 1,
"used_by": [
"vsock_loopback"
],
"status": "Live",
"location": "0xffffffffc0a03000"
},
...
]
$ cat /proc/modules | jc --proc-modules -p -r
[
{
"module": "binfmt_misc",
"size": "24576",
"used": "1",
"used_by": [],
"status": "Live",
"location": "0xffffffffc0ab4000"
},
{
"module": "vsock_loopback",
"size": "16384",
"used": "0",
"used_by": [],
"status": "Live",
"location": "0xffffffffc0a14000"
},
{
"module": "vmw_vsock_virtio_transport_common",
"size": "36864",
"used": "1",
"used_by": [
"vsock_loopback"
],
"status": "Live",
"location": "0xffffffffc0a03000"
},
...
]
<a id="jc.parsers.proc.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -0,0 +1,128 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_buddyinfo"></a>
# jc.parsers.proc\_buddyinfo
jc - JSON Convert `/proc/buddyinfo` file parser
Usage (cli):
$ cat /proc/buddyinfo | jc --proc
or
$ jc /proc/buddyinfo
or
$ cat /proc/buddyinfo | jc --proc-buddyinfo
Usage (module):
import jc
result = jc.parse('proc', proc_buddyinfo_file)
or
import jc
result = jc.parse('proc_buddyinfo', proc_buddyinfo_file)
Schema:
All values are integers.
[
{
"node": integer,
"zone": string,
"free_chunks": [
integer # [0]
]
}
]
[0] array index correlates to the Order number.
E.g. free_chunks[0] is the value for Order 0
Examples:
$ cat /proc/buddyinfo | jc --proc -p
[
{
"node": 0,
"zone": "DMA",
"free_chunks": [
0,
0,
0,
1,
1,
1,
1,
1,
0,
1,
3
]
},
{
"node": 0,
"zone": "DMA32",
"free_chunks": [
78,
114,
82,
52,
38,
25,
13,
9,
3,
4,
629
]
},
{
"node": 0,
"zone": "Normal",
"free_chunks": [
0,
22,
8,
10,
1,
1,
2,
11,
13,
0,
0
]
}
]
<a id="jc.parsers.proc_buddyinfo.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output 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)

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