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

Compare commits

...

1806 Commits

Author SHA1 Message Date
Kelly Brazil
ac8120e1fe Merge pull request #655 from kellyjonbrazil/dev
Dev v1.25.5
2025-05-10 11:38:04 -07:00
Kelly Brazil
a854f1d6b0 doc update 2025-05-10 11:25:41 -07:00
Kelly Brazil
7c9e92e284 add test for team.config with JSON 2025-05-05 14:48:12 -07:00
Kelly Brazil
4c2775970d change team_config to object instead of list 2025-05-05 11:34:30 -07:00
Kelly Brazil
ba0fc5dad9 doc update 2025-05-03 13:42:34 -07:00
Kelly Brazil
222d1b7255 support json value in team.config field 2025-05-03 13:39:32 -07:00
Kelly Brazil
34fda0905f force test run 2025-04-15 08:56:36 -07:00
Kelly Brazil
ccbe36e712 Create very_old, old, and latest python runs
needed due to loss of python 3.6 support on some runners
2025-04-15 08:55:41 -07:00
Kelly Brazil
bb1136c33c Merge branch 'dev' of https://github.com/kellyjonbrazil/jc into dev 2025-04-15 08:51:39 -07:00
Kelly Brazil
c6a13aa4d8 force test run 2025-04-15 08:51:35 -07:00
Kelly Brazil
d04a175d36 Update to ubuntu-22.04 on old version run 2025-04-15 08:50:30 -07:00
Kelly Brazil
966df71566 add default policy stats to iptables parser 2025-04-15 08:41:30 -07:00
Kelly Brazil
c8599253fb formatting 2025-04-14 15:30:35 -07:00
Kelly Brazil
65d9cc718f version bump 2025-04-13 18:14:15 -07:00
Kelly Brazil
9b4190f1e6 fix mount on macOS when filesystem contains parenthesis 2025-04-13 18:13:31 -07:00
Kelly Brazil
c519657d85 allow IDNA2008 encoded email addresses with warning 2025-04-12 10:50:26 -07:00
Kelly Brazil
d5cceb77e9 remove extraneous file 2025-04-04 16:16:47 -07:00
Kelly Brazil
5cde110afb set bytes conversion to posix mode 2025-04-04 16:14:20 -07:00
Kelly Brazil
65aa6c1a9a update copyright date 2025-04-02 12:06:59 -07:00
Kelly Brazil
5394d7f62d doc update 2025-04-02 11:37:24 -07:00
Jake Ob
ebbd4e9320 Fix broken controller parser schema to include power state prop (#652)
This commit fixes issue #627

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2025-04-02 11:32:19 -07:00
Kelly Brazil
834acfb2d6 update lsblk tests 2025-03-31 17:06:41 -07:00
Kelly Brazil
1182c9f263 fix for missing dB value 2025-03-31 16:50:46 -07:00
Kelly Brazil
ed3046bb1b remove type annotations since they are not used 2025-03-31 16:34:38 -07:00
Kelly Brazil
ca73076b56 make empty mountpoints list instead of null 2025-03-31 14:29:27 -07:00
Kelly Brazil
9efc014dce doc update 2025-03-31 14:17:51 -07:00
Kelly Brazil
dbe1757a48 add mountpoints array field and convert sizes to bytes 2025-03-31 14:16:17 -07:00
Kelly Brazil
1c09289d95 fix time parser for missing centiseconds 2025-03-31 12:16:45 -07:00
Kelly Brazil
e9ccedf0d7 doc update 2025-03-30 12:38:41 -07:00
Michel Lind
fb4b4eeb58 Adjust for removal of typing.ByteString in Python 3.14 (#639)
`typing.ByteString` has been removed:

https://docs.python.org/3.14/whatsnew/3.14.html

The modernizing guide suggests `collections.abc.ByteString` which has
also been removed; the recommendation is to use either:

- just `bytes`
- `collections.abc.Buffer`
- a union of `bytes`, `bytesarray`, etc.

https://typing.readthedocs.io/en/latest/guides/modernizing.html#modernizing-byte-string

Per discussion, using `bytes` should suffice

Signed-off-by: Michel Lind <salimma@fedoraproject.org>
2025-03-30 12:34:54 -07:00
pettai
896891ad9e Switch TZ to a generic name (#635)
Switch TZ to a more generic name that works under minimal chrooted builds. (America/Los_Angeles, Pacific, PST, PST8PDT)
This fixes pbuilder builds on Ubuntu

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2025-03-30 12:33:45 -07:00
Kelly Brazil
7fda79d841 allow parser to deal with null input 2024-12-20 16:31:38 -08:00
Kelly Brazil
8995ac686a doc update 2024-12-20 15:30:41 -08:00
Kelly Brazil
006047553d version bump to v1.25.5 2024-12-20 15:29:07 -08:00
Kelly Brazil
c56e38c66c Merge pull request #625 from kellyjonbrazil/master
Merge pull request #618 sync dev
2024-12-20 23:26:25 +00:00
Kelly Brazil
ee3b873ef4 Merge branch 'dev' into master 2024-12-20 23:24:53 +00:00
Eden Refael
a39cb05228 created the amixer sget command parser - READY FOR REVIEW (#616)
* created the amixer first skeleton

* push testing and integrate this commit and branch with issue: #591

* #591 checks the input data with jc utils

* created the data parser of the sget control of the amixer sget <controller> command.

* test commit - just for tests

* another test commit

* another test commit

* created a dedicated pseudo algorithm for the amixer sget and tried various of strings.

* orginized the docstring with general explanation about the tool and the amixer tool output and algorithm of the input parsing and input examples.

* created raw implementation, but it's raw either or either.

* orginized the content inside the amixer parser

* removed endpoint name

* added amixer to the jc parser in lib

* more explanations

* added tests for the amixer sget

* added tests for the amixer sget

* fine versioning fix

* created docstring+another explanations seperated.

* created the amixer parser docu

* added the amixer in alphabet order to the json convert lib

* Fix PEP 8: E302 violation as part of boy scout principle

* deleted not necessary file

* fixed the spaces between sections in the amixer description

* resolved commits such as amixer module docstring and preperations for  parser for raw=False.

* Revert "Fix PEP 8: E302 violation as part of boy scout principle"

This reverts commit 241d1a1c63.

* created the dedicated _process for raw=False

* created the dedicated _process for raw=False

* added tests for the _process raw=False.

* changed keys to be lowercase snake-case - Change 'dB' to 'db'

* added more dB -> db changes and used int convertor of the jc utils

---------

Co-authored-by: EdenRafael <eden.refael@kazuar.com>
Co-authored-by: Eden Refael <edeenraf@hotmail.com>
Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2024-12-20 15:06:38 -08:00
Kelly Brazil
f54ceaa793 Merge pull request #619 from Luigi31415/add-tz-to-tests
Timezone Testing with TZ Env Variable
2024-11-29 01:02:31 +00:00
Hamza Saht
99cce72244 fix: Add TZ for runtests.sh 2024-11-27 20:31:47 +03:00
Kelly Brazil
0c40e3a3c9 Merge pull request #618 from kellyjonbrazil/dev
Dev v1.25.4
2024-11-25 20:39:34 -08:00
Kelly Brazil
025d00ecd2 Merge branch 'master' into dev 2024-11-25 20:33:20 -08:00
Kelly Brazil
a2b5d41308 minor fix to iw-scan to parse more fields 2024-11-25 20:19:40 -08:00
Kelly Brazil
366589268e update calculated fields 2024-11-25 17:16:30 -08:00
Kelly Brazil
53dd28b65e doc update 2024-11-24 18:59:30 -08:00
Kelly Brazil
0be6528aff convert size fields and fix issue for optional_deps without a description 2024-11-24 18:13:08 -08:00
Kelly Brazil
6ceaa7749e doc update 2024-11-24 17:30:49 -08:00
Kelly Brazil
6ae2e17ea1 add examples and tests 2024-11-24 17:30:03 -08:00
Kelly Brazil
ef9ca9322e Some processing completed 2024-11-24 16:02:59 -08:00
Kelly Brazil
95cba21d73 initial pacman parser 2024-11-24 14:57:55 -08:00
Kelly Brazil
be1dd031f1 doc update 2024-11-24 13:38:10 -08:00
Hamza Saht
7fbe1e9f21 Add WireGuard (wg) Command Output Parser (#606)
* feat: add parser to parse the output of wg

* fixup! feat: add parser to parse the output of wg

* feat: Add tests for windows 10

---------

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2024-11-24 13:34:58 -08:00
Hamza Saht
7d33850d43 fix: Edit pythonapp.yml workflow to run on non-draft PRs (#617) 2024-11-24 13:24:04 -08:00
Kelly Brazil
7887789d0d coerce non-json-serializable objects to strings 2024-11-20 13:49:27 -08:00
Kelly Brazil
7ddd2a4ce2 fix yaml parser to support values starting with an equal sign 2024-11-19 14:12:21 -08:00
Kelly Brazil
34ab34cc66 doc update 2024-11-19 12:15:18 -08:00
pettai
a8b231da81 nsd-control parser update, zone transfer status (#607)
* add more parsing functionality for transfering state

* add additional/conditional fields into the schema

---------

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2024-11-19 12:12:43 -08:00
Kelly Brazil
2278c7ecab doc update 2024-11-19 10:51:16 -08:00
Kelly Brazil
4cb88977cc add long ipv6 test 2024-11-19 10:51:10 -08:00
Aleksey Lobanov
0af4a3a5d7 fix: New RE_PROBE_IPV6_ONLY with better complexity in worst case (#609)
Example ':'*100

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2024-11-19 10:43:24 -08:00
Kelly Brazil
c0f9b705c6 doc update 2024-11-19 10:33:19 -08:00
Hamza Saht
fa416083f2 Fix/spaces in program name (#608)
* fix: enforce word boundaries while checking state presence

* fix: add tests for the special netstat case with space in process name

---------

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2024-11-19 10:28:32 -08:00
Kelly Brazil
e858faa746 fix for contiguous packages with the same name 2024-11-18 16:21:40 -08:00
Kelly Brazil
a8f769eea3 doc update 2024-10-20 09:50:36 -07:00
Kelly Brazil
26133261f9 use jc.utils.timestamp() for datetime conversions 2024-10-20 09:45:08 -07:00
Kelly Brazil
6072ea0ec7 doc update 2024-10-18 14:34:29 -07:00
Kelly Brazil
95672c23b7 doc update 2024-10-18 14:30:04 -07:00
Jose E. Rodriguez
a2e0e6d549 feat: Add Windows ipconfig parser to jc (#596)
* feat: Introduce ipconfig parser

* fix: add parsing support for "connection_specific_dns_suffix_search_list" and windows XP ipv4 addresses, remove dateutil dependency

* fix: introduce unit tests, correct import of datetime

* fix: changed preferred to status to account for other ip statuses, and parsed link local ipv6 prefix length

* fix: compress _parse_header_line and _parse_adapter_line + fix casing in unit test file

---------

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2024-10-18 14:17:14 -07:00
Kelly Brazil
2df5e79295 doc update 2024-10-18 09:56:32 -07:00
Jake Ob
c5e0642b0b Fix broken controller regexp scheme in the bluetoothctl parser (#599)
This commit fixes the controller parser scheme in order to take care
and extract some extra attributes, the manufacturer and version.
The order of the attributes appearing in the regexp scheme must follow
the order they appear in the `bluetoothctl show` outputs.

A new test has been added to test outputs with these extra attrs.

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2024-10-18 09:50:51 -07:00
Kelly Brazil
78150ded70 doc update 2024-10-17 14:05:06 -07:00
Kelly Brazil
05f3e4ea8a fixup tests 2024-10-17 13:53:20 -07:00
Kelly Brazil
b7cf0ca8d4 flip is_reserved to false for python ipv6 backports 2024-10-17 13:13:31 -07:00
Kelly Brazil
ba6e1e694e fix for python backports for ipv6 output 2024-10-17 13:06:17 -07:00
Kelly Brazil
aec3e3cd13 force github test 2024-10-17 09:15:29 -07:00
Kelly Brazil
d9363ae473 doc update 2024-09-26 09:49:06 -07:00
Kelly Brazil
0f367a435a formatting 2024-09-23 06:58:33 -07:00
Kelly Brazil
0955598b49 formatting 2024-09-23 06:55:17 -07:00
Kelly Brazil
f2a8e0087b add tests and doc update 2024-09-22 20:01:40 -07:00
Kelly Brazil
97e9798cef add posix_mode to utils/convert_size_to_int and use in df 2024-09-22 19:34:23 -07:00
Leonard Crestez
413519e02c #592: Handle df size suffixes as binary (#593)
* df: convert_size_to_int as binary

* tests: Update df -h expected output

---------

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2024-09-22 19:28:45 -07:00
Kelly Brazil
5c855e40c6 fix 6to4 test for python backports 2024-09-17 09:52:38 -07:00
Kelly Brazil
b66c5dbf55 doc update 2024-09-12 19:38:31 -07:00
Kelly Brazil
b054b1b782 doc update 2024-09-07 19:50:08 -07:00
Mabuchin
1593d0bf79 Add error type support for Linux Ping (#575)
* feat: add icmp error handle into linux_parse

* refactor: fixed timestamp offset logic(including error-response-type condition)
2024-09-07 19:46:43 -07:00
Kelly Brazil
8a22f8a468 add support for Link partner advertised link modes to ethtool parser 2024-09-07 18:43:41 -07:00
Kelly Brazil
c26f0641ff enhance ifconfig parser to support utun interfaces with assigned ipv4 addresses on macOS 2024-09-07 18:11:25 -07:00
Kelly Brazil
40eb2b7ef6 fix uptime for "user" instead of "users" 2024-09-07 17:24:21 -07:00
Kelly Brazil
71af0c5555 fix for IPv4 mapped IPv6 address changes in Python 3.13 2024-09-06 10:26:34 -07:00
Kelly Brazil
9f5532d91f formatting 2024-06-18 17:43:16 -07:00
Kelly Brazil
c68c919024 add mount test 2024-06-18 17:34:17 -07:00
Michał Górny
9eb4df34b1 adjust expected test_ip_address_ipv6_6to4 output for Python 3.12.4 (#573)
Adjust the expected output in `test_ip_address_ipv6_6to4` to account
for `is_global`/`is_private` changes for 6to4 addresses in Python 3.12.4
and Python 3.13.0.

Fixes #572

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2024-06-18 08:53:19 -07:00
Kelly Brazil
921133f3ac version bump 2024-06-18 08:47:24 -07:00
Kelly Brazil
0350607359 fix for space if filesystem name 2024-06-18 08:47:02 -07:00
Kelly Brazil
5f8c65cf5b Merge branch 'dev' 2024-06-09 19:00:37 -07:00
Kelly Brazil
ed048c7b2b doc update 2024-06-09 18:48:25 -07:00
Kelly Brazil
18dabd4b9f update var names 2024-06-09 10:35:42 -07:00
Kelly Brazil
0005945383 doc update 2024-06-09 10:31:06 -07:00
Kelly Brazil
e13605a6a9 add ss tests 2024-06-08 09:17:57 -07:00
Kelly Brazil
a92e318319 doc update 2024-06-07 17:42:30 -07:00
Kelly Brazil
7d8166326a fix for when recv-q is too close to state field 2024-06-07 17:06:40 -07:00
Kelly Brazil
d21e5f4f28 doc update 2024-05-14 18:20:14 -07:00
Kelly Brazil
f1bab336ee fix file_stats in git-log parsers 2024-05-14 17:38:39 -07:00
konstantin-shatalov
0faacb6d0d Added support for number of lines changed for git logs (#557)
Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
Co-authored-by: kshatalov <kshatalov@citco.com>
2024-05-14 15:05:22 -07:00
Kelly Brazil
6af82fb9ae doc update 2024-05-10 11:11:31 -07:00
Kelly Brazil
517137889c fix zpool-status parser when there are no columnar values 2024-05-10 11:06:05 -07:00
Kelly Brazil
8a3997cd0e fix for pip-show parser with multi-line fields starting with a blank line 2024-05-02 15:09:06 -07:00
Kelly Brazil
4f66faad0d do not convert physlot to int 2024-04-29 14:20:15 -07:00
Kelly Brazil
846f4fb691 doc update 2024-04-29 14:09:14 -07:00
Kelly Brazil
5bec53b3f8 feat: get correct probe IP when mutliple probe on hop (#562)
Co-authored-by: Pierre-Olivier Côté <pierre-olivier.cote@polymtl.ca>
2024-04-29 13:58:11 -07:00
Kelly Brazil
dfc942776b doc update 2024-04-28 13:10:38 -07:00
Kelly Brazil
18a00bc57a doc update 2024-04-28 13:01:07 -07:00
Sam SIU
e2b2406931 [Fix issue #558] Add a condition check before subvendor dict creation (#559)
- Updated jc/parsers/pci_ids.py adding a check to see if the subvendor dict is already created
- Updated test fixture

Signed-off-by: Sam SIU <23556929+ssiuhk@users.noreply.github.com>
Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2024-04-28 12:58:22 -07:00
Kelly Brazil
a9cfb4b13a force test 2024-04-28 12:49:27 -07:00
Kelly Brazil
3e57ecf6df remove verbose testing 2024-04-28 12:48:03 -07:00
Kelly Brazil
2ddf67ad0c make xrander test quiet 2024-04-28 12:44:40 -07:00
Kelly Brazil
137c59cea1 add quiet=True to uptime parsing 2024-04-28 12:40:52 -07:00
Kelly Brazil
8b2f57e8e7 force test 2024-04-28 12:14:10 -07:00
Kelly Brazil
01f5aa05b3 Update pythonapp.yml
fix unittest command
2024-04-28 12:13:30 -07:00
Kelly Brazil
6ae626ef9f Merge branch 'dev' of https://github.com/kellyjonbrazil/jc into dev 2024-04-28 12:10:27 -07:00
Kelly Brazil
dea7099183 doc update 2024-04-28 12:08:13 -07:00
Kelly Brazil
9c3e4f349c verbose tests
make tests verbose to troubleshoot uptime compatibility messages in tests
2024-04-28 12:07:21 -07:00
Kelly Brazil
d5398c7089 remove timezone updates within tests - should be done by tester before running tests 2024-04-28 12:01:50 -07:00
Kelly Brazil
2dcf0e2d1b test remove timezone setting within test for windows 2024-04-28 11:48:32 -07:00
Kelly Brazil
f45295eee4 doc update 2024-04-28 11:30:33 -07:00
Nicolas Mattelaer
4ef34f7849 feat: Add battery_percentage property to --bluetoothctl output (#564)
* Adds battery_percentage property to bluetoothctl output

* remove ending comma

---------

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2024-04-28 11:27:31 -07:00
Kelly Brazil
a69e55cb1c version bump 2024-04-27 11:17:37 -07:00
Kelly Brazil
6563b9f073 split jobs for old python and latest python 2024-04-27 11:15:44 -07:00
Kelly Brazil
6e17ed6f62 version bump 2024-04-22 10:11:26 -07:00
Kelly Brazil
abda8735be Merge pull request #551 from kellyjonbrazil/dev
Dev v1.25.2
2024-03-23 11:11:00 -07:00
Kelly Brazil
79cb156441 doc update 2024-03-23 10:58:36 -07:00
Kelly Brazil
1da080dc52 fix for unhandled lines in xrandr output 2024-03-23 10:57:46 -07:00
Kelly Brazil
3ca8e1ef11 iptables -x support for larger numbers and doc update 2024-03-19 14:38:20 -07:00
Kelly Brazil
1d31d3570a add -x support to iptables parser 2024-03-18 10:52:26 -07:00
Kelly Brazil
b84123a09b doc update 2024-03-18 10:26:00 -07:00
Kelly Brazil
475eedb142 Merge pull request #547 from lyterk/xrandr_fix_schema
[xrandr] Add props schema
2024-03-18 10:15:34 -07:00
Kelly Brazil
ebd0432b82 Merge branch 'dev' into xrandr_fix_schema 2024-03-18 10:05:29 -07:00
Kelly Brazil
ee1135003b add space after bullets 2024-03-16 18:28:52 -07:00
Kelly Brazil
aaee394e51 formatting 2024-03-16 18:25:45 -07:00
Kelly Brazil
ad91a71488 doc update 2024-03-15 12:19:14 -07:00
Kelly Brazil
c2adc46db4 make all summary docstrings raw 2024-03-15 12:17:39 -07:00
Kelly Brazil
3e9afca803 formatting 2024-03-15 11:39:27 -07:00
Kelly Brazil
ee2a7ddc2e remove python path update since the script will be run from the correct directory 2024-03-15 11:37:56 -07:00
Kelly Brazil
4fc7232d44 update all docs with new script 2024-03-14 22:46:52 -07:00
Kelly Brazil
a0dff721b1 reduce TOC level 2024-03-14 21:58:43 -07:00
Kelly Brazil
37061227d9 New doc generation script 2024-03-14 21:44:37 -07:00
Kelly Brazil
401b7b31b8 remove sys.path print 2024-03-14 17:31:38 -07:00
Kelly Brazil
86a4bd12b5 fix for tests run inside vscode 2024-03-14 17:29:31 -07:00
Kelly Brazil
50638cc11e fix escape warnings 2024-03-14 12:06:34 -07:00
Kelly Brazil
36de08a6f8 change existing_src to existing_pkg_ver 2024-03-13 19:01:09 -07:00
Kelly Brazil
83fa32f615 ethtool - convert units 2024-03-08 16:39:23 -08:00
Kevin Lyter
a3ca2814b3 Add props schema 2024-03-02 17:46:13 -08:00
Kevin Lyter
5c06712fba [xrandr] Fix schema 2024-03-02 17:46:13 -08:00
Kevin Lyter
fdadba226f [xrandr] Update schema 2024-03-02 17:46:13 -08:00
Kelly Brazil
5ac36befe2 add apt-get-sqq parser tests 2024-03-01 14:25:33 -08:00
Kelly Brazil
527b5ab5c5 doc update 2024-03-01 13:57:21 -08:00
Kelly Brazil
495c353c5d clean up template 2024-03-01 13:53:02 -08:00
Kelly Brazil
abbd4820fd add ethtool parser tests 2024-03-01 13:52:45 -08:00
Kelly Brazil
5e88eb0c8b add --module-info support to ethtool parser 2024-03-01 11:43:19 -08:00
Kelly Brazil
b0c98a56ce add operation value updates to _process 2024-02-29 14:32:46 -08:00
Kelly Brazil
07e9b46535 add new parsers 2024-02-29 14:00:33 -08:00
Kelly Brazil
87419750fc add apt-get-sqq command parser 2024-02-29 13:59:32 -08:00
Kelly Brazil
412a772b42 fix for multiple list items on a line 2024-02-29 10:09:24 -08:00
Kelly Brazil
52a816cc45 add ethtool command parser 2024-02-28 18:03:00 -08:00
Kelly Brazil
48deacf875 doc update 2024-02-28 13:33:56 -08:00
Kelly Brazil
7a377f7b8d add needrestart command parser 2024-02-28 13:28:03 -08:00
Kelly Brazil
e2f97d7d8e add simple summary support to rsync and rsync-s parsers 2024-02-27 10:26:07 -08:00
Kelly Brazil
f9bf889654 add apt_cache_show tests and fix parser name in warning messeages for parser aliases 2024-02-26 20:18:57 -08:00
Kelly Brazil
026846650a add apt_cache_show parser. Split list values into an array. fix tests. 2024-02-26 19:56:07 -08:00
Kelly Brazil
850917ada0 remove extra fields from df parser. All size values are now normalized to bytes. Size field is now an integer. 2024-02-26 11:17:42 -08:00
Kelly Brazil
bce4eb536a add human readable output support to the free parser 2024-02-26 10:42:26 -08:00
Kelly Brazil
ef2a2121b5 add human-readable support to the df parser 2024-02-26 10:00:42 -08:00
Kelly Brazil
4bed8392b8 update release notes section 2024-02-20 08:56:53 -08:00
Kelly Brazil
8e2bcba352 use get_parser instead of importlib 2024-02-14 15:45:18 -08:00
Kelly Brazil
588e5c2653 add Idle support to state_map 2024-02-14 15:31:10 -08:00
Kelly Brazil
25085c3412 doc update 2024-02-14 15:25:22 -08:00
Kelly Brazil
bfa99d99af Merge pull request #544 from viktory683/iwconfig-fix
Iwconfig fix
2024-02-14 23:19:31 +00:00
Kelly Brazil
b8f7ddcfc8 Merge branch 'dev' into iwconfig-fix 2024-02-14 22:46:49 +00:00
bzglve
413ea4bc68 added some more symbols following "SSID Naming Conventions"
from https://www.cisco.com/assets/sol/sb/WAP321_Emulators/WAP321_Emulator_v1.0.0.3/help/Wireless05.html
2024-02-14 15:36:04 +06:00
bzglve
13948fff26 #541 fix 2024-02-14 15:19:13 +06:00
Kelly Brazil
6275591ef1 version bump and doc updates 2024-02-12 21:31:10 -08:00
Kelly Brazil
2cdbebb7fd Merge pull request #542 from kellyjonbrazil/dev
Dev v1.25.1
2024-02-13 00:35:00 +00:00
Kelly Brazil
412f11276a fix sys.path update 2024-02-12 16:18:52 -08:00
Kelly Brazil
f3dd51f517 hard-code disabled parser path 2024-02-12 15:53:21 -08:00
Kelly Brazil
f66f1aadaa use shlex to correctly split the /proc files in magic_run_command_str 2024-02-12 15:32:38 -08:00
Kelly Brazil
8ead7e4835 rename List class to _List for documentation purposes 2024-02-12 15:05:44 -08:00
Kelly Brazil
f1177a2606 add more coverage for --quiet cli option 2024-02-12 11:00:27 -08:00
Kelly Brazil
44dc2a74c1 add test for jc -h 2024-02-12 11:00:02 -08:00
Kevin Lyter
d50bd96ce6 [xrandr] Allow props command (#540)
* [xrandr] Allow props command

Responding to issue #525
Somewhat substantial rewriting here to make the parser more resilient
- Change parser to not mutate the incoming data list, instead index
- Create `Line` class and `categorize` classmethod
  - Every line is categorized and regexed, so it gets dispatched to the
  right level of responsibility

* Bump version

---------

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2024-02-12 09:03:25 -08:00
Kelly Brazil
5cde127a04 raise ParseError instead of output empty object for disabled parser 2024-02-10 14:58:15 -08:00
Kelly Brazil
63d1cead90 enhance uptime parser for busybox output with no user info 2024-02-10 11:55:19 -08:00
Kelly Brazil
d3e7f09ca3 fix for more graceful handling of missing optional libraries 2024-02-10 11:16:38 -08:00
Kelly Brazil
e6bdbb42d3 add more ini tests 2024-02-09 19:32:19 -08:00
Kelly Brazil
3cfc5e3e3c fix ini parser for edge cases with non-value keys 2024-02-09 17:13:19 -08:00
Kelly Brazil
082d4a3f80 doc update 2024-02-07 11:53:13 -08:00
Kelly Brazil
158c28455b version bump 2024-02-05 18:30:26 -08:00
Kelly Brazil
efb02493b8 remove extra $ from slicing example 2024-02-05 18:22:05 -08:00
Kelly Brazil
a319ec85ca doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
e754e88f2d doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
cfa7f267fc update schema 2024-02-06 01:54:31 +00:00
Kelly Brazil
c581e959fa formatting 2024-02-06 01:54:31 +00:00
Kelly Brazil
9eb56543be add verbosity check for printing 2024-02-06 01:54:31 +00:00
Kelly Brazil
67643906b1 formatting 2024-02-06 01:54:31 +00:00
Kelly Brazil
14d257225c doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
0411940f75 add full path to error messages 2024-02-06 01:54:31 +00:00
Kelly Brazil
7d60df67f3 check for missing fixtures 2024-02-06 01:54:31 +00:00
Kelly Brazil
70a971a2f1 formatting 2024-02-06 01:54:31 +00:00
Kelly Brazil
3fbdffd028 efibootmgr updates 2024-02-06 01:54:31 +00:00
yaofei zheng
539fe72d16 add "sudo efibootmgr" (without -v) output test case (#534) 2024-02-06 01:54:31 +00:00
Kelly Brazil
bd6611aaba doc updates 2024-02-06 01:54:31 +00:00
Kelly Brazil
cf77ddc396 cleanup 2024-02-06 01:54:31 +00:00
Kelly Brazil
77bcd616cd add tests for curl-head and http-headers parsers 2024-02-06 01:54:31 +00:00
yaofei zheng
5ee2eda83e add efibootmgr parser (#528)
* More nsd fixes (#523)

* Update nsd_control.py

support catz output

* Update nsd_control.py

fix parsing of catz zones

* add testdata

add corresponding catz testdata

* Revert "More nsd fixes" (#526)

* add efibootmgr parser

* add efibootmgr completions

* Multiple fixes on jc/parsers/efibootmgr.py

1. Update schema in comments.
1. Add an example.
1. Use clean and clear sub string finding sytax.
1. Wrap schema in an object.
1. Make variable scope as small as possible.

* add tests for efibootmgr

* Update jc/parsers/efibootmgr.py

Update example using `--pretty` for output.

Co-authored-by: Muescha <184316+muescha@users.noreply.github.com>

* jc/parsers/efibootmgr multiple changes

1. convert all keys to "snake_case"
2. add "mirrored_percentage_above_4g" and "mirror_memory_below_4gb"
3. move conversion (from string to other types) to "_process"

---------

Co-authored-by: pettai <pettai@sunet.se>
Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
Co-authored-by: Muescha <184316+muescha@users.noreply.github.com>
2024-02-06 01:54:31 +00:00
Kelly Brazil
5b849b0275 doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
3e5d206f0c test utils cleanup 2024-02-06 01:54:31 +00:00
Kelly Brazil
f50f96381d doc update 2024-02-06 01:54:31 +00:00
Muescha
962632ac1f Feature: generic fixtures tests (#529)
* add generic test runners

* extract generic test runners

* beautify messages, remove unused return value

* add template and info do CONTRIBUTING

* typo

---------

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2024-02-06 01:54:31 +00:00
Kelly Brazil
d209780a9d only add timestamp field if datetime string is parsable 2024-02-06 01:54:31 +00:00
Kelly Brazil
8e5451a7c1 fix for datetime or integer fields 2024-02-06 01:54:31 +00:00
Kelly Brazil
86a09c17cf remove unused _process function 2024-02-06 01:54:31 +00:00
Kelly Brazil
4bb85195e2 doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
39f43aad63 add http_headers and curl_head parsers 2024-02-06 01:54:31 +00:00
Kelly Brazil
29689f7603 formatting 2024-02-06 01:54:31 +00:00
Muescha
78d7ab1308 add info about documentation and completions (#531) 2024-02-06 01:54:31 +00:00
Kelly Brazil
303cd12de3 version bump to v1.25.0 2024-02-06 01:54:31 +00:00
Kelly Brazil
b65f37e075 add normalize_key() function and tests 2024-02-06 01:54:31 +00:00
Kelly Brazil
c05fa7e9cd add remove_quotes() to utils and use in ini parsers 2024-02-06 01:54:31 +00:00
Kelly Brazil
264272a8b8 doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
7fadb23fea use convert_size_to_int() 2024-02-06 01:54:31 +00:00
Kelly Brazil
c419e460db doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
6434ff61bf add HTTP header datetime format 2024-02-06 01:54:31 +00:00
Kelly Brazil
45a1be11e2 doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
7659fe470a formatting 2024-02-06 01:54:31 +00:00
Muescha
c332c4febf draft for path and path_list (#513)
* draft for path_list

* updaate doc

* add input check

* fix types

* fix schema: add missing properties

* add _process

* fix _process docs

* refactor: extract path.py parser

* swap order of names alphabetically

* documentation and comments

* path parser: add early return for nodata

* path and path-list parser: add test and fixtures

* typo in file name

* add early return for nodata

* add test and fixtures

* typo in file name

* rename fixtures

* rename fixtures

* refactor to pathlib.Path

* failing on windows - use PurePosixPath

* changed the way to strip dot from suffix

* add POSIX to path

* test commit to see results on windows is failing

* test commit to see results on windows is failing

* add windows path detection

* somehow Path not like the newline from input line

* add test with more items

* remove debug print

* wrap test loops into into subTest

* remove print statements

* add path and path-list to CHANGELOG

---------

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2024-02-06 01:54:31 +00:00
Kelly Brazil
2cc212bfab use convert_size_to_int() from utils 2024-02-06 01:54:31 +00:00
Kelly Brazil
b836ffc583 add tests for convert_size_to_int() 2024-02-06 01:54:31 +00:00
Kelly Brazil
29f1a1d425 fix proc doc - output is dict or list of dicts 2024-02-06 01:54:31 +00:00
Kelly Brazil
9f78dc6afa proc parser doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
74c7e11948 doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
6ba6dc0374 version bump 2024-02-06 01:54:31 +00:00
pettai
ec0f2569e5 More nsd fixes (#523)
* Update nsd_control.py

support catz output

* Update nsd_control.py

fix parsing of catz zones

* add testdata

add corresponding catz testdata
2024-02-06 01:54:31 +00:00
Kelly Brazil
65e30c4440 doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
8d9ebf5dfa doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
c3746454ff doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
ea0f6493a2 update contributing guide 2024-02-06 01:54:31 +00:00
Kelly Brazil
afbc46076e add ping tests 2024-02-06 01:54:31 +00:00
Mabuchin
2b9b6550a7 Fix data_bytes is null in ping -I option (#520)
* fixed header parsing when specifying ping interface

* add source_ip parsing test for ping/ping-s

---------

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2024-02-06 01:54:31 +00:00
Kelly Brazil
6fb3c0a409 doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
1b8911ad36 add slurp docs 2024-02-06 01:54:31 +00:00
Kelly Brazil
cc61b57dd1 add blank line tests to slicer 2024-02-06 01:54:31 +00:00
Kelly Brazil
6d679b2895 doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
1e1fc08a47 doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
b5c3a03d56 implement slurp by wrapping in a list, adding "_file" for /proc, and further wrapping in {"result": data} when --meta-out is used. 2024-02-06 01:54:31 +00:00
Kelly Brazil
9e269f070f update slice help doc 2024-02-06 01:54:31 +00:00
Kelly Brazil
f863cfdef4 fix for slicing blank lines 2024-02-06 01:54:31 +00:00
Kelly Brazil
2cd58d75e7 make parser_shortname more robust 2024-02-06 01:54:31 +00:00
Kelly Brazil
03b70eebb7 make /proc slurpable with magic syntax 2024-02-06 01:54:31 +00:00
Kelly Brazil
1e76ce2aea doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
d9fc1b4242 doc update 2024-02-06 01:54:31 +00:00
Muescha
36a3d2e96d crontab remove double entry in doc (#518) 2024-02-06 01:54:31 +00:00
Kelly Brazil
bf05de1d63 doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
cae41df1d8 add get_parser tests 2024-02-06 01:54:31 +00:00
Kelly Brazil
8e9ff7fa9f refactor to use get_parser() 2024-02-06 01:54:31 +00:00
Muescha
973c535c72 extract to public jc.get_parser(parser_name) (#516)
* remove unused imports and RegEx

* extract to public jc.get_parser(parser_name)

* changed order of exports

* add doc

* add doc.md

* remove data_dir from doc.md

---------

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2024-02-06 01:54:31 +00:00
Muescha
8614d3dde9 remove unused imports and RegEx (#515) 2024-02-06 01:54:31 +00:00
Kelly Brazil
a73ee47bcf move slurp error message so it will work for all parser types 2024-02-06 01:54:31 +00:00
Kelly Brazil
d54a81831f update slicer to use utils.line_slice() 2024-02-06 01:54:31 +00:00
Kelly Brazil
73ae1396b9 enhance slurp error message 2024-02-06 01:54:31 +00:00
Kelly Brazil
3399e8551e add slurpable_parser_mod_list test 2024-02-06 01:54:31 +00:00
Kelly Brazil
b9656c2fae add line_slice tests 2024-02-06 01:54:31 +00:00
Kelly Brazil
e08ccb7942 add slurp test. fix cli_json_out_pretty test 2024-02-06 01:54:31 +00:00
Kelly Brazil
9b648e8560 doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
c97a8fb48f add line_slice function 2024-02-06 01:54:31 +00:00
Kelly Brazil
3a95407161 back out slurp array flattening code 2024-02-06 01:54:31 +00:00
Kelly Brazil
7609af28b3 doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
c2b2e81a2b add more slurpable parsers 2024-02-06 01:54:31 +00:00
Kelly Brazil
3b0594a4a6 flatten slurp output if parser outputs a list 2024-02-06 01:54:31 +00:00
Kelly Brazil
2b0b9dd7ba doc update 2024-02-06 01:54:31 +00:00
don Rumata
f159dd6b9d Add plugins support 4 snapcraft (#512)
* Added `snap` support.

* Added plugins support.

* Add README 4 snap.

---------

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2024-02-06 01:54:31 +00:00
Kelly Brazil
2d5d87c73d version bump and doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
a260ceba1c add slurp functionality 2024-02-06 01:54:31 +00:00
Kelly Brazil
6c30b8106c use PurePosixPath to fix tests running on Windows 2024-02-06 01:54:31 +00:00
Kelly Brazil
a23921c879 doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
3999276d17 add parent, filename, stem, and extension to schema 2024-02-06 01:54:31 +00:00
Kelly Brazil
65bd4850f2 doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
d71c2d2b20 add kv_dup tests 2024-02-06 01:54:31 +00:00
Kelly Brazil
6dd5b29998 fix to make None values always a blank string 2024-02-06 01:54:31 +00:00
Kelly Brazil
1868b28f74 doc fix 2024-02-06 01:54:31 +00:00
Kelly Brazil
e8c0bef6ca doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
2c09a06b5a add kv_dup parser 2024-02-06 01:54:31 +00:00
Kelly Brazil
fc75ce90d1 refactor alias parsers 2024-02-06 01:54:31 +00:00
Kelly Brazil
45a6cfc9cf add source info to docs 2024-02-06 01:54:31 +00:00
Kelly Brazil
69a0922410 doc update 2024-02-06 01:54:31 +00:00
Kelly Brazil
2bb201a706 fix parser source path 2024-02-06 01:54:31 +00:00
Kelly Brazil
50d5d3a3ba add opposite endian ipv6 addresses for s390x and other Big Endian architecture support 2024-02-06 01:54:31 +00:00
Kelly Brazil
b14a8980b8 add more info for unit tests 2024-02-06 01:54:31 +00:00
muescha
de6aa1cc92 change \n to echo to create new lines 2024-02-06 01:54:31 +00:00
Muescha
c4dcedb269 Update docgen.sh: add link to source 2024-02-06 01:54:31 +00:00
Kelly Brazil
140a61702b Revert "More nsd fixes" (#526) 2024-01-26 14:22:13 -08:00
pettai
4d3fc07e3b More nsd fixes (#523)
* Update nsd_control.py

support catz output

* Update nsd_control.py

fix parsing of catz zones

* add testdata

add corresponding catz testdata
2024-01-26 14:20:33 -08:00
Kelly Brazil
dcc4d35d55 Merge branch 'dev' into master 2023-12-21 22:02:56 +00:00
Muescha
cfb30b32f3 Update CONTRIBUTING.md (#509)
* Update CONTRIBUTING.md

fix:
- bullet points
- fix link to custom plugins
- add info about appending to `jc/lib.py`

* Update CONTRIBUTING.md

fix numbering

* typo: lowercase
2023-12-21 07:42:04 -08:00
Kelly Brazil
26f2738471 Merge pull request #502 from kellyjonbrazil/master
sync to dev
2023-12-18 20:13:45 +00:00
Kelly Brazil
2bccd14c5d Merge pull request #499 from kellyjonbrazil/dev
v1.24.0
2023-12-17 18:08:02 +00:00
Kelly Brazil
0d4823c9de doc update 2023-12-17 09:44:18 -08:00
Kelly Brazil
2a14f56b72 add proc-cmdline tests 2023-12-16 13:18:14 -08:00
Kelly Brazil
fe49759598 doc update 2023-12-16 12:59:35 -08:00
Kelly Brazil
ee737a59eb doc update 2023-12-16 12:55:29 -08:00
Kelly Brazil
517ab10930 add proc-cmdline parser 2023-12-16 12:09:37 -08:00
Kelly Brazil
604fb574be doc update 2023-12-16 11:44:11 -08:00
Kelly Brazil
a254ee8d88 add test for issue 490 2023-12-16 11:39:40 -08:00
Kelly Brazil
f784a7a76d doc update 2023-12-10 13:13:57 -08:00
Kelly Brazil
2e33afbe18 doc cleanup 2023-12-10 10:53:28 -08:00
Kelly Brazil
103bb174fc rename pkg-index-alpine to pkg-index-apk 2023-12-10 10:49:05 -08:00
Kelly Brazil
2a76a64fa1 schema update 2023-12-10 10:41:20 -08:00
Kelly Brazil
c8fb56c601 formatting 2023-12-10 10:41:09 -08:00
Kelly Brazil
e835227027 doc update 2023-12-10 10:30:05 -08:00
Kelly Brazil
88ffcaee56 update schema. fix no-data output to match other parsers. 2023-12-10 10:29:58 -08:00
Kelly Brazil
a9ba98847c update _device_pattern regex for Freezing with 100% CPU when parsing Xrandr output - 1.23.6 #490 2023-12-09 17:01:03 -08:00
Kelly Brazil
2630049ab7 possible fix for infinite loop issue 2023-12-09 16:14:27 -08:00
Kelly Brazil
47c7e081f3 doc update 2023-12-09 11:45:26 -08:00
Kelly Brazil
ef7f755614 doc update 2023-12-09 11:41:45 -08:00
Kelly Brazil
32bd7ffbf6 formatting updates 2023-12-09 11:41:22 -08:00
Kelly Brazil
347097a294 add convert_size_to_int function 2023-12-09 11:41:06 -08:00
Kelly Brazil
356857f5d6 rename deb-packages-index to pkg-index-deb 2023-12-09 10:17:48 -08:00
Kelly Brazil
ee12c52291 rename apkindex parser to pkg-index-alpine 2023-12-09 10:03:33 -08:00
Ron Green
0e7ebf4dc1 feat(iftop): add iftop-scanning (#484)
* feat(iftop): add iftop-scanning

this is not even an MVP, but I would like it to exist to allow per client json aggregation

also, a future use is a stream response

* fix typos and test first regex

* add more iftop fun

* Update iftop.py

* add tests and json

Signed-off-by: Ron Green <11993626+georgettica@users.noreply.github.com>

* feat: make work and add tests

Signed-off-by: Ron Green <11993626+georgettica@users.noreply.github.com>

* add completion

* change schema for query looping

* fix: tests

* fix review comments

* feat: add byte parsing

* add no-port to options

* remove completion and format dep

Signed-off-by: Ron Green <11993626+georgettica@users.noreply.github.com>

* Update setup.py

* Update iftop.py

---------

Signed-off-by: Ron Green <11993626+georgettica@users.noreply.github.com>
Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2023-12-07 18:22:53 -08:00
Kelly Brazil
f1e0cec9d6 add apkindex parser 2023-12-04 14:01:30 -08:00
Roey Darwish Dror
d96a2a8623 APKINDEX parser (#487) (#491)
* APKINDEX parser (#487)

* Missing space in doc
2023-12-04 13:35:04 -08:00
Hugo van Kemenade
1b1bc46222 Remove redundant Python 2 code (#493)
Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2023-12-04 13:03:15 -08:00
Kelly Brazil
d5a8b4eed2 remove deprecated iso-datetime parser 2023-12-04 11:35:37 -08:00
Kelly Brazil
5ddd4f0e86 version bump to 1.24.0 2023-12-04 11:33:04 -08:00
Kelly Brazil
8b94c326de add no data test 2023-12-04 09:59:28 -08:00
Hugo van Kemenade
29b012e66d Add support for Python 3.12 (#492)
Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2023-12-04 09:55:07 -08:00
Kelly Brazil
572a3207cd doc update 2023-11-28 11:23:47 -08:00
Kelly Brazil
2a88f2be6b fix mypy issues 2023-11-28 11:21:13 -08:00
Roey Darwish Dror
3de6eac1ad swapon parser (#383) (#489)
* swapon parser

* revert lib

* fix lib

* Added tests

* Fix tests

---------

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2023-11-28 11:15:40 -08:00
Kelly Brazil
f44260603e doc update 2023-11-24 10:38:33 -08:00
Kelly Brazil
1c60f5355e convert one more field to integer 2023-11-24 09:45:56 -08:00
Kelly Brazil
40fa78a966 version bump 2023-11-24 09:44:03 -08:00
Himadri Bhattacharjee
71db67ef49 refactor: acpi parser: adhere code to the happy path to avoid nested branches (#488)
* refactor: acpi parser: keep working code in happy path to avoid nested branches

* fix: use elif for branches marked charging and discharging

---------

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2023-11-24 09:38:10 -08:00
Kelly Brazil
1cd723b48f add tests 2023-11-23 15:19:14 -08:00
Kelly Brazil
82ee4d7b30 add debconf-show parser 2023-11-23 14:52:06 -08:00
Kelly Brazil
dfd19f38f3 doc update 2023-11-23 12:12:05 -08:00
Kelly Brazil
2358c883d0 remove unused type annotation import 2023-11-23 12:07:54 -08:00
Kelly Brazil
79e4f3a761 doc update 2023-11-23 12:05:03 -08:00
Kelly Brazil
5be45622cc Merge branch 'dev' of https://github.com/kellyjonbrazil/jc into dev 2023-11-23 12:01:54 -08:00
Kelly Brazil
5f4136b943 run tests 2023-11-23 12:00:58 -08:00
Kelly Brazil
941bfe2724 update szenius/set-timezone to v1.2 2023-11-23 11:59:12 -08:00
Kelly Brazil
3ed44a26d9 doc update 2023-11-23 11:51:04 -08:00
Kelly Brazil
b7270517bd add tune2fs parser 2023-11-23 11:49:04 -08:00
Kelly Brazil
bf63ac93c6 add Photon linux 2023-11-21 15:01:04 -08:00
Kelly Brazil
1cb80f15c2 add tests 2023-11-21 14:51:37 -08:00
Kelly Brazil
b5c22c6e53 add deb-packages-index parser 2023-11-21 14:40:43 -08:00
Kelly Brazil
7951366117 remove old unused line 2023-11-17 12:06:43 -08:00
Kelly Brazil
c78a4bb655 mount fix for spaces in mountpoint name 2023-11-14 15:17:31 -08:00
Kelly Brazil
8aceda18b9 Merge pull request #483 from wolkenarchitekt/master
#482 Quickfix to parse mount output
2023-11-14 23:07:52 +00:00
Ingo Weinmann
e0c75a9b6b #482 Quickfix to parse mount output 2023-11-14 22:47:56 +01:00
Kelly Brazil
fd283f6cf7 doc update 2023-11-04 16:02:02 -07:00
Kelly Brazil
b881ad4ec0 make blank target null 2023-11-04 15:58:12 -07:00
Kelly Brazil
2fcb32e26f add debian/ubuntu package index support 2023-11-04 15:19:12 -07:00
Kelly Brazil
13a802225b add tests 2023-10-25 16:53:24 -07:00
Kelly Brazil
88649a4e8d doc update 2023-10-25 13:42:19 -07:00
Kelly Brazil
5c6fa5bff6 better header row detection 2023-10-25 13:37:59 -07:00
Kelly Brazil
b70025d6d6 fix for blank target in rule 2023-10-24 16:17:53 -07:00
Kelly Brazil
59b89ecbd4 version bump 2023-10-24 15:24:33 -07:00
Kelly Brazil
8f7502ff0f Merge pull request #479 from kellyjonbrazil/master
sync to dev
2023-10-24 22:22:31 +00:00
Kelly Brazil
249d93f15c Merge pull request #477 from kellyjonbrazil/dev
v1.23.6
2023-10-24 00:57:57 +00:00
Kelly Brazil
b0cf2e2d78 clean up final return 2023-10-23 17:37:53 -07:00
Kelly Brazil
264fcd40ad clear linedata if 'from' found 2023-10-23 17:36:25 -07:00
Kelly Brazil
54def8ef49 doc update 2023-10-23 15:41:11 -07:00
Kelly Brazil
63c271b837 add tests 2023-10-23 15:39:13 -07:00
Kelly Brazil
741b2d1c1d version bump 2023-10-23 15:15:07 -07:00
Kelly Brazil
47d4335890 fix for multi-word remote 2023-10-23 15:14:28 -07:00
Kelly Brazil
81f721f1ab doc update 2023-10-23 14:33:40 -07:00
Kelly Brazil
c4e1068895 move print statements 2023-10-23 14:06:04 -07:00
Kelly Brazil
a77bb4165a fix tests for different xmltodict versions 2023-10-23 12:49:06 -07:00
Kelly Brazil
3cd2dce496 formatting 2023-10-23 08:01:50 -07:00
Kelly Brazil
46a8978740 doc update 2023-10-23 07:54:14 -07:00
Kelly Brazil
3161c48939 fix for older xmltodict library versions 2023-10-23 07:53:39 -07:00
Kelly Brazil
a89a9187f8 version bump 2023-10-23 07:53:16 -07:00
Kelly Brazil
d9e0aa5b93 Merge pull request #475 from kellyjonbrazil/master
Merge pull request #473 from kellyjonbrazil/dev
2023-10-23 14:48:55 +00:00
Kelly Brazil
d298e101e9 Merge pull request #473 from kellyjonbrazil/dev
Dev v1.23.5
2023-10-21 12:23:25 -07:00
Kelly Brazil
cea975d7f1 doc update 2023-10-21 12:12:43 -07:00
Kelly Brazil
1ed69f9e6a doc update and fix tests 2023-10-21 12:09:18 -07:00
Kelly Brazil
ab0e05ec82 only set colors if pygments is installed 2023-10-21 12:01:09 -07:00
Kelly Brazil
c16cce4bf0 add tests 2023-10-13 08:52:14 -07:00
Kelly Brazil
d3489536a1 add "7" as a netstat raw state 2023-10-12 17:25:40 -07:00
Sebastian Uhlik
041050ce28 Fix bug in split when program running on UDP contains space in name (#447)
* Add condition before split.

* Safe detection of 'state' presence.

---------

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2023-10-12 17:21:06 -07:00
pettai
7de1a8a5d6 add more tests (#468)
add all test-cases
2023-10-05 17:09:35 -07:00
Kelly Brazil
d4604743d1 add multiline value support to env parser 2023-10-02 16:30:56 -07:00
Kelly Brazil
0b8fb31298 doc update 2023-10-02 08:35:36 -07:00
Kelly Brazil
dcdd79e28c doc update 2023-10-02 08:34:14 -07:00
Kelly Brazil
5291baeb8e fixup variable names 2023-10-02 08:32:41 -07:00
Kelly Brazil
6867102c66 doc update 2023-10-01 18:13:27 -07:00
Kelly Brazil
36ed2c7e2e add lsb_release parser 2023-10-01 18:12:22 -07:00
Kelly Brazil
4ab0aba9d3 doc update 2023-10-01 17:42:42 -07:00
Kelly Brazil
e643badaf7 add os-release parser 2023-10-01 17:42:00 -07:00
Kelly Brazil
d96e96219e add comment support to xml parser 2023-10-01 11:49:50 -07:00
Kelly Brazil
e42af3353e fix pidstat parsers for -T ALL option 2023-10-01 11:25:56 -07:00
Kelly Brazil
4ec2b16f42 doc fix 2023-09-30 16:18:32 -07:00
Kelly Brazil
0a028456bf add nsd-control parser 2023-09-30 15:45:29 -07:00
pettai
a1f10928e1 Add nsd-control (#454)
* Create nsd_control.py

Init nsd_control.py

* cleanup nsd-control + add test data

- Cleanup nsd-control parser
- Add test data

* add test script

add test script + fix test data

* Update test_nsd_control.py

fix a default test

* Update test_nsd_control.py

nit
2023-09-30 15:36:52 -07:00
Kelly Brazil
eae1d4b89a doc update 2023-09-30 15:34:29 -07:00
Kelly Brazil
d3c7cec333 add host parser 2023-09-30 15:32:27 -07:00
pettai
36fa08d711 Add ISC 'host' support (#450)
* Add ISC 'host' support

Add ISC 'host' command support

* Update host.py

remove leading tab from string

* Add integer conversion

Per request, fix integer conversion

* Cleanup

Cleanup strip()'s

* Add tests

Add two tests for the 'host' parser

* Update test_host.py

nit

---------

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2023-09-30 15:26:03 -07:00
Kelly Brazil
a9958841e4 doc update 2023-09-30 15:23:29 -07:00
Kelly Brazil
504ad81a01 version bump 2023-09-30 15:21:29 -07:00
Kevin Lyter
8bf2f4f4d0 [xrandr] Fix 453 devices issue (#455)
* [xrandr] Fix bug 453, clean up data model

* Fix: 'devices' was originally not a list, just assigned each time it
was parsed. Made that a list and appended to it.
* Removed distinction between unassociated/associated devices
* Added test for @marcin-koziol's problem
* Put tests into separate test methods

* Formatting cleanup

* Backwards compatible type syntax

---------

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2023-09-30 15:19:14 -07:00
Kelly Brazil
805397ea18 doc update 2023-09-30 15:15:29 -07:00
Samson Umezulike
1b3985c2d7 Adds graceful handling of superfluous bits in bit strings (#459)
Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2023-09-30 15:12:18 -07:00
Kelly Brazil
f602043642 fix for negative serial numbers 2023-09-30 15:06:28 -07:00
Samson Umezulike
1a1aa8fda3 Adds graceful handling of negative serial numbers in x509 certificates (#445)
Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2023-09-30 15:02:55 -07:00
Kelly Brazil
3249a017ae add dest-unreachable test 2023-09-15 12:09:38 -07:00
Kelly Brazil
84f0246b2d move int/float conversions to _process 2023-09-14 18:15:28 -07:00
Kelly Brazil
1c795982b0 add error and corrupted fields to ping-s 2023-09-14 13:03:45 -07:00
Kelly Brazil
c5164b4108 doc update 2023-09-10 15:20:11 -07:00
Kelly Brazil
dc3716ecb3 add errors and corrupted support 2023-09-10 15:18:32 -07:00
Kelly Brazil
c5165ccc21 version bump 2023-09-10 15:18:23 -07:00
José Miguel Guzmán
5b2035e0e6 Add support for corrupted and errors in linux ping. (#442)
* Add support for corrupted and errors in linux ping.

* Fix regular expressions

* Workaround to keep compatibility with current tests

---------

Co-authored-by: Jose Miguel Guzman <jmguzman@whitestack.com>
Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
2023-08-25 10:31:17 -07:00
Kelly Brazil
5205154aaf add percent_wait to float conversion 2023-08-21 17:18:07 -07:00
Kelly Brazil
f500de3af6 version bump 2023-08-21 17:17:34 -07:00
Kian-Meng Ang
4b028b5080 Fix typos (#440)
Found via `codespell -S ./tests/fixtures -L chage,respons,astroid,unx,ist,technik,ans,buildd`
2023-07-31 08:45:03 -07:00
Kelly Brazil
4cd721be85 Dev v1.23.4 (#439)
* version bump

* fix regex for crlf line endings

* Completed Ip_route parser (#429)

* tests

* Merge pull request #398 from kellyjonbrazil/dev

Dev v1.23.2

* Merge pull request #398 from kellyjonbrazil/dev

Dev v1.23.2

---------

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
Co-authored-by: Jjack3032 <julian.jackson@parsons.us>

* formatting

* doc update

* use splitlines

* formatting

* formatting

* Parser for `find` linux command (#434)

* Added find parser and tests for Centos 7.7 and Ubuntu 18.04

* Added a test file, changed logic, and included a case for permission denied returned by find.

* Added a few more lines to the tests

* Changed logic for setting values to null and updated test cases.

* doc update

* doc update

* Added proc_net_tcp parser (#421)

Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>

* clean up net_tcp parser

* add resolve.conf test files

* doc update

* add resolve.conf parser

* doc update

* add sortlist functionality

* add resolve.conf parser tests

* doc update

---------

Co-authored-by: Julian5555 <58196809+Julian5555@users.noreply.github.com>
Co-authored-by: Jjack3032 <julian.jackson@parsons.us>
Co-authored-by: solomonleang <124934439+solomonleang@users.noreply.github.com>
Co-authored-by: AlvinSolomon <41175627+AlvinSolomon@users.noreply.github.com>
2023-07-30 10:08:39 -07:00
Kelly Brazil
d58ca402a7 Merge pull request #432 from kellyjonbrazil/revert-430-find_parser
Revert "Added find parser and tests for Centos 7.7 and Ubuntu 18.04"
2023-06-23 15:40:06 +00:00
Kelly Brazil
5386879040 Revert "Added find parser and tests for Centos 7.7 and Ubuntu 18.04 (#430)"
This reverts commit f19a1f23a9.
2023-06-23 08:39:12 -07:00
solomonleang
f19a1f23a9 Added find parser and tests for Centos 7.7 and Ubuntu 18.04 (#430)
* Added find parser and tests for Centos 7.7 and Ubuntu 18.04

* Added a test file, changed logic, and included a case for permission denied returned by find.

* Added a few more lines to the tests

* Changed logic for setting values to null and updated test cases.
2023-06-23 08:38:56 -07:00
Kelly Brazil
5023e5be4c Dev v1.23.3 (#426)
* make certificate search more robust to different line endings

* use license_files instead of license_file which is deprecated

* version bump

* parsing extra options -e, -o, -p

* fix for extra opts and different field length at option -[aeop]

* test integration for extra opts -e -o -p

* formatting and use ast.literal_eval instead of eval

* doc update

* doc update

* Add a parser to parse mounted encrypted veracrypt volumes (fixes #403)

* update compatibility warning message

* netstat windows parser

* tests

* Windows route parser

* tests

* id should be a string

* add veracrypt parser and docs

* formatting

* doc update

* lsattr parser

* Update test_lsattr.py

* changed keys to lowercase

* changed info

* support missing data for stat

* doc update

* doc update

* doc update

* ensure compatibility warning prints even with no data

* improve compatibility message

* add support for dig +nsid option

* New parser: srt (#415)

* srt parser

* changed the parser to support more complex cases

* doc updates

* Adding certificate request parser (#416)

* Adding certificate request parser

* Adding the CSR type for Windows-style CSR

---------

Co-authored-by: Stg22 <stephane.for.test@gmail.com>

* doc update

* add csr tests

* Last -x (#422)

* Refactored the parser

* last -x support

* doc update

* fix for ping on linux with missing hostname

* allow less strict email decoding with a warning.

* doc update

* use explicit ascii decode with backslashreplace

* doc update

* use jc warning function instead of print for warning message

* last -x shutdown fix (#423)

* inject quiet setting into asn1crypto library

* Parse appearance and modalias lines for mouse devices (fixes #419) (#425)

The bluetoothctl device parser is implemented so that it aborts the parsing
process immediately returning what it has collected so far. This is because
the parser should work in hydrid way to support outputs comming from bluetoothctl
devices and bluetoothctl info calls.

* doc update

* doc update

---------

Co-authored-by: gerd <gerd.augstein@gmail.com>
Co-authored-by: Jake Ob <iakopap@gmail.com>
Co-authored-by: Mevaser <mevaser.rotner@gmail.com>
Co-authored-by: M.R <69431152+YeahItsMeAgain@users.noreply.github.com>
Co-authored-by: Stg22 <46686290+Stg22@users.noreply.github.com>
Co-authored-by: Stg22 <stephane.for.test@gmail.com>
2023-06-21 15:48:23 -07:00
Kelly Brazil
5527d22459 Merge pull request #398 from kellyjonbrazil/dev
Dev v1.23.2
2023-04-30 10:40:21 -07:00
Kelly Brazil
9d567c2e70 python 3.6 fix 2023-04-30 10:13:00 -07:00
Kelly Brazil
39c03a15d5 doc update 2023-04-30 09:34:22 -07:00
Kelly Brazil
5e6d2562f9 add certbot command parser 2023-04-29 16:34:23 -07:00
Kelly Brazil
7009d5a014 fix for incorrect insertion and deletion parsing 2023-04-22 14:04:00 -07:00
Kelly Brazil
42f9ddabb9 change bluetoothctl compatibility 2023-04-21 14:22:23 -07:00
Kelly Brazil
30efb5afc0 fix for multiline description 2023-04-18 11:23:49 -07:00
Kelly Brazil
786dc76c09 fix for battery not charging message 2023-04-17 18:12:57 -07:00
Kelly Brazil
fc48874a5d pytest warning fixes 2023-04-17 15:15:40 -07:00
Kelly Brazil
67164e7b23 fix mypy issues 2023-04-16 18:50:40 -07:00
Kelly Brazil
3db9774ac6 doc update 2023-04-16 11:46:21 -07:00
Kelly Brazil
03aef93d9a Merge pull request #392 from tzeikob/bluetoothctl-parser
Add parser for the bluetoothctl utility
2023-04-16 11:39:54 -07:00
Jake Ob
9b7e3de3ed Fix broken unit tests for the bluetoothctl parser 2023-04-16 20:52:29 +03:00
Jake Ob
291b6b061a Parse numeric fields to their actual numeric value 2023-04-16 20:42:48 +03:00
Jake Ob
08496533e2 Process data only if data is given 2023-04-16 20:19:15 +03:00
Jake Ob
f8dceb5046 Fix minor typo in documentation 2023-04-16 20:15:24 +03:00
Jake Ob
240ed4047f Add parser for the bluetoothctl utility 2023-04-14 18:23:45 +03:00
Kelly Brazil
0bf6f7cd7c fix incorrect variable parsing when wildcard schedule 2023-04-02 13:18:16 -07:00
Kelly Brazil
313bd86e3e doc update 2023-04-02 12:57:56 -07:00
Kelly Brazil
56259d5605 fix for dashes in name 2023-04-02 12:57:50 -07:00
Kelly Brazil
8a4885c1fe Merge pull request #384 from six3six/patch-1
Fix iwconfig re_interface regex
2023-03-31 08:40:00 -07:00
Louis Desplanche
5b06f84917 Fix iwconfig re_interface regex
Small fix of re_interface in iwconfig.py.
When the network SSID contains a "-" character, the network interface was ignored.
2023-03-31 11:15:31 +02:00
Kelly Brazil
37a1428914 Merge pull request #381 from kellyjonbrazil/dev
Dev v1.23.1
2023-03-23 20:16:11 -04:00
Kelly Brazil
bff065daf3 doc update 2023-03-23 16:41:50 -07:00
Kelly Brazil
c60d899f31 ignore non-parser-plugin python files in plugin directory 2023-03-23 16:40:13 -07:00
Kelly Brazil
fb7c390506 add lsusb tests 2023-03-23 06:43:06 -07:00
Kelly Brazil
22afb69573 doc update 2023-03-22 16:47:45 -07:00
Kelly Brazil
be51304c9c add support for CDC MBIM and CDC MBIM Extended 2023-03-22 16:43:57 -07:00
Kelly Brazil
44f83d800f doc update 2023-03-19 12:49:25 -07:00
Kelly Brazil
bf07973d90 doc update 2023-03-19 12:39:28 -07:00
Kelly Brazil
11e94b686c mypy fix 2023-03-18 15:47:19 -07:00
Kelly Brazil
c68bf674a1 add py.typed file to wheel 2023-03-18 15:43:22 -07:00
Kelly Brazil
dbbc310082 Merge pull request #378 from jwilk-forks/proc-status-umask
Make umask optional in /proc/PID/status
2023-03-18 22:37:13 +00:00
Kelly Brazil
e861f4a597 Merge pull request #379 from jwilk-forks/spelling
Fix typo
2023-03-18 22:25:21 +00:00
Kelly Brazil
049e93707c doc update 2023-03-18 15:16:02 -07:00
Kelly Brazil
164294ecb7 add integer and float conversions 2023-03-18 15:14:59 -07:00
Jakub Wilk
22ef489795 fix typo 2023-03-18 11:07:15 +01:00
Jakub Wilk
8f9d650f6c make umask optional in /proc/PID/status
Zombie processes don't have the umask field available.
2023-03-18 10:28:05 +01:00
Kelly Brazil
7e134a63bd add support for the timesync-status option 2023-03-15 06:58:31 -07:00
Kelly Brazil
9b5c25cb5b fix for rtc configured as UTC 2023-03-13 19:47:38 -07:00
Kelly Brazil
894946b207 doc update 2023-03-05 10:07:23 -08:00
Kelly Brazil
92ad2068db version bump 2023-03-05 10:06:54 -08:00
Kelly Brazil
59662a1500 fix for lines that start with tab 2023-03-05 10:04:00 -08:00
Kelly Brazil
125b88a2ca Merge pull request #371 from kellyjonbrazil/master
sync to dev
2023-03-05 17:59:09 +00:00
Kelly Brazil
79fce8c769 doc update 2023-02-27 17:37:49 -08:00
Kelly Brazil
a4a53f8b3b Merge pull request #368 from kellyjonbrazil/dev
Dev v1.23.0
2023-02-27 15:13:57 -08:00
Kelly Brazil
743e1ae90f doc update 2023-02-27 15:01:00 -08:00
Kelly Brazil
dbcff80907 add zpool tests 2023-02-27 13:44:16 -08:00
Kelly Brazil
6e10965aed doc update 2023-02-21 17:19:17 -08:00
Kelly Brazil
0c8c4a9c53 formatting 2023-02-21 17:18:24 -08:00
Kelly Brazil
7632541a1e Merge pull request #365 from tzeikob/xrandr-edid-364
Modify the xrandr parser to extract display model info from EDID #364
2023-02-21 17:04:46 -08:00
Kelly Brazil
a213ad9a85 doc update 2023-02-21 15:50:09 -08:00
Kelly Brazil
15ac5a9004 fix for crontab files with only shortcut entries 2023-02-21 15:44:55 -08:00
Jake Ob
0658668eb0 Fix broken TypedDict compatibility with older versions of python
By missing to declare the Model as a generic dictionary type we cause
the script to fail because the TypedDict is not supported by older
versions of python (e.g. 3.6, 3.7).
2023-02-21 14:43:10 +02:00
Kelly Brazil
ccef69ac37 add ubuntu16 tests 2023-02-20 12:04:45 -08:00
Kelly Brazil
64676fda2e fix for older linux style output 2023-02-20 11:56:20 -08:00
Jake Ob
6ea2d776ae Add unit tests for xrandr --properties outputs 2023-02-17 16:25:41 +02:00
Jake Ob
98ced9616c Modify xrandr parser to extract model info from EDID (#364)
This change will make the xrandr parser to work also with outputs from
`xrandr --properties`, where the option `--properties` enables xrandr
to return the EDID data of each output device. The parser is expected
to remain backward compatible for regular xrandr outputs. The extra info
that will be added to every device object is:

```json
{
  "model_name": "str",
  "product_id": "str",
  "serial_number": "str"
}
```

Because the EDID data come encoded in a hexadecimal string, we have to
decode them by vendoring the pyedid (https://github.com/jojonas/pyedid) library.

Fixes: #364
2023-02-17 16:09:50 +02:00
Kelly Brazil
ae19183803 add test for is_current fix 2023-02-13 18:17:14 -08:00
Kelly Brazil
8536514baf add test for output with extra spaces that caused infinite loops 2023-02-13 18:09:10 -08:00
Kelly Brazil
81982a9f79 doc updagte 2023-02-12 18:30:31 -08:00
Kelly Brazil
1acbb2f096 Merge pull request #361 from tzeikob/reflect-360
Move the reflect value in its own key (xrandr) #360
2023-02-12 18:28:37 -08:00
Jake Ob
80fb4d40a5 Add unit test to assert devices in reflect mode 2023-02-09 21:22:34 +02:00
Kelly Brazil
c972dd1aac Merge pull request #362 from jpmat296/master
Improve accepted formats in proc_pid_smaps
2023-02-09 09:51:26 -08:00
Jean-Pierre Matsumoto
9dde65c25c Improve accepted formats in proc_pid_smaps 2023-02-07 14:57:15 +01:00
Jake Ob
7486b0c7cd Move the reflect value in its own key (xrandr)
Currently the reflect value of a device is included in the rotation
key as a combination of both rotation and reflection (e.g. normal X axis).
With this modification we move the reflection value to its own key in the
JSON document like so:

```json
{
  ...
  "rotation": "...",
  "reflection": "...,
  ...
}
```

Fixes: issue #360
2023-02-07 13:02:21 +02:00
Kelly Brazil
5c7a520a0b formatting 2023-02-05 13:04:32 -08:00
Kelly Brazil
193ddf71f8 fix typos 2023-02-05 09:52:59 -08:00
Kelly Brazil
c46fe9816c doc update 2023-02-05 09:49:32 -08:00
Kelly Brazil
aada5f0794 add int conversions 2023-02-04 19:04:43 -08:00
Kelly Brazil
5c7bf363a6 add schema and docs 2023-02-04 18:51:31 -08:00
Kelly Brazil
00b74be540 version bump 2023-02-04 17:37:56 -08:00
Kelly Brazil
96cb01f57a fix zpool-status for multi-line fields 2023-02-04 17:37:48 -08:00
Kelly Brazil
adf5f403ae regex fix for infinite loop? 2023-02-04 14:37:03 -08:00
Kelly Brazil
1c09c95c71 doc update 2023-02-04 11:26:41 -08:00
Kelly Brazil
64f442d743 fix for is_current? 2023-02-04 11:20:48 -08:00
Kelly Brazil
cd8d43446b add zpool-status parser 2023-02-02 15:57:15 -08:00
Kelly Brazil
7361eac1a4 formatting 2023-01-31 17:02:04 -08:00
Kelly Brazil
9d41f0a938 doc update 2023-01-31 17:00:42 -08:00
Kelly Brazil
00274c15df add process conversions 2023-01-31 16:52:56 -08:00
Kelly Brazil
d0b8a91f94 add zpool-iostat parser 2023-01-31 11:59:19 -08:00
Kelly Brazil
098e8dbef6 doc update 2023-01-31 11:59:06 -08:00
Kelly Brazil
ec29b8bbc6 add test for acpi fix for never fully discharge state 2023-01-31 09:51:23 -08:00
Kelly Brazil
1d8f83b8c6 add ver parser tests 2023-01-31 09:44:23 -08:00
Kelly Brazil
12c4419c6a doc update 2023-01-31 08:30:37 -08:00
Kelly Brazil
b134c53f33 add ssh_conf tests 2023-01-31 08:29:43 -08:00
Kelly Brazil
23ff19fdb5 add slicer tests 2023-01-31 06:48:37 -08:00
Kelly Brazil
7a43ba631b fix tests for slice info metadata 2023-01-30 08:59:54 -08:00
Kelly Brazil
2beb26f3e3 add slice info to Metadata output 2023-01-30 08:52:22 -08:00
Kelly Brazil
4b55f49e99 formatting 2023-01-30 08:11:21 -08:00
Kelly Brazil
c0239a771c clarify parser argument quote wrapping code 2023-01-27 16:28:55 -08:00
Kelly Brazil
bc4738e900 don't quote spaces in command arguments 2023-01-27 15:58:01 -08:00
Kelly Brazil
1c76caf59b formatting 2023-01-27 15:22:36 -08:00
Kelly Brazil
0679951d4a add <nobr> tag 2023-01-27 15:17:41 -08:00
Kelly Brazil
df7aee9e4b doc update 2023-01-27 14:47:08 -08:00
Kelly Brazil
a8d97a2521 add slice info to help and doc update 2023-01-27 11:41:21 -08:00
Kelly Brazil
9370b336d8 add slice to man page 2023-01-27 11:31:16 -08:00
Kelly Brazil
118f98222a change restapi link 2023-01-27 08:15:53 -08:00
Kelly Brazil
dc997821f4 ad jc-api demo link 2023-01-27 08:12:07 -08:00
Kelly Brazil
aef0fdb435 formatting 2023-01-27 08:02:07 -08:00
Kelly Brazil
21ee3c0e78 clarify slice usage 2023-01-27 08:01:32 -08:00
Kelly Brazil
d6c665f74b add both negative slice description 2023-01-26 17:06:07 -08:00
Kelly Brazil
79305a50d0 formatting 2023-01-26 16:59:15 -08:00
Kelly Brazil
e758aa41ef formatting 2023-01-26 16:49:27 -08:00
Kelly Brazil
910cb34b09 formatting 2023-01-26 16:49:09 -08:00
Kelly Brazil
976fea4eb2 Formatting 2023-01-26 16:46:54 -08:00
Kelly Brazil
81447ec9e6 formatting 2023-01-26 16:44:26 -08:00
Kelly Brazil
61b8e9f7b5 doc update 2023-01-26 16:24:32 -08:00
Kelly Brazil
8e86a04448 add slicing info 2023-01-26 16:18:54 -08:00
Kelly Brazil
f23715a783 formatting 2023-01-26 08:53:50 -08:00
Kelly Brazil
fa693a8bb1 formatting 2023-01-26 08:53:06 -08:00
Kelly Brazil
103168c25b add integer conversions 2023-01-26 08:48:59 -08:00
Kelly Brazil
ae7ed4eec5 doc update 2023-01-26 08:48:46 -08:00
Kelly Brazil
caa516db72 formatting 2023-01-25 16:59:49 -08:00
Kelly Brazil
f05c3d6113 docstring update 2023-01-25 16:57:15 -08:00
Kelly Brazil
5d872b1535 docstring update: add see also section. 2023-01-25 16:30:20 -08:00
Kelly Brazil
1559cd9f5c fixup patch numbers 2023-01-25 16:13:33 -08:00
Kelly Brazil
a5a87c7da1 add ver parser 2023-01-25 15:58:27 -08:00
Kelly Brazil
0e6cec62c1 remove unneeded slicer syntax check 2023-01-23 16:53:06 -08:00
Kelly Brazil
3bb1d89165 fix multiple slicer warnings 2023-01-23 16:50:41 -08:00
Kelly Brazil
f5f5f102fb full functioning slicer feature 2023-01-23 16:13:17 -08:00
Kelly Brazil
0c82fe7e4d add slicer functionality 2023-01-23 13:57:48 -08:00
Kelly Brazil
13ffe8a84d doc update 2023-01-22 12:44:16 -08:00
Kelly Brazil
4c6eebaa33 doc update 2023-01-22 10:37:27 -08:00
Kelly Brazil
f8fbb2dce2 use derivative of sshd_conf parser instead of paramiko 2023-01-22 10:36:29 -08:00
Kelly Brazil
dbfe682674 fix for never fully discharging state 2023-01-22 08:57:50 -08:00
Kelly Brazil
2a148d44a1 add host to objects 2023-01-21 17:00:22 -08:00
Kelly Brazil
0648d2e9e3 don't interpolate local host values 2023-01-21 16:37:27 -08:00
Kelly Brazil
ac9128fa0c add ssh-conf parser 2023-01-21 13:10:45 -08:00
Kelly Brazil
4d7a872670 version bump 2023-01-21 10:56:45 -08:00
Kelly Brazil
07f716b254 Merge pull request #355 from kellyjonbrazil/master
sync to dev
2023-01-21 10:53:03 -08:00
Kelly Brazil
b0d6a7307c Merge pull request #353 from kellyjonbrazil/dev
Dev v1.22.5
2023-01-11 14:39:13 -08:00
Kelly Brazil
53ad793ff8 doc update 2023-01-11 11:17:47 -08:00
Kelly Brazil
ea4332d8e4 add ini-dup tests 2023-01-10 16:06:05 -08:00
Kelly Brazil
5c5ff9324f update multi-line value behavior 2023-01-09 08:31:21 -08:00
Kelly Brazil
2ab6352fdb doc update 2023-01-08 19:54:32 -08:00
Kelly Brazil
56dcbaf40c doc update 2023-01-08 19:53:21 -08:00
Kelly Brazil
029b5abcac add ini-dup parser 2023-01-08 19:46:13 -08:00
Kelly Brazil
32521ac91a doc update 2023-01-08 10:55:48 -08:00
Kelly Brazil
bf88407902 remove special DEFAULT section handling 2023-01-08 10:55:44 -08:00
Kelly Brazil
63cf47db63 doc update 2023-01-06 13:37:34 -08:00
Kelly Brazil
9970866b3b Merge pull request #350 from davemq/arp_aix
AIX ARP support
2023-01-06 13:34:44 -08:00
Dave Marquardt
d61941b276 Merge branch 'dev' into arp_aix 2023-01-06 15:14:39 -06:00
Dave Marquardt
081fdb8026 Updated AIX ARP test comments 2023-01-06 15:13:03 -06:00
Dave Marquardt
f64dfbf79d Update comments about AIX ARP 2023-01-06 15:10:02 -06:00
Dave Marquardt
5fb73f4ad5 Added AIX support for ARP, along with AIX ARP test support 2023-01-06 14:53:50 -06:00
Dave Marquardt
1c16d32420 Added test data for AIX ARP 2023-01-06 14:51:09 -06:00
Kelly Brazil
e367e0d714 doc update 2023-01-06 09:28:13 -08:00
Kelly Brazil
4046649e32 toml tests and doc update 2023-01-06 09:11:00 -08:00
Kelly Brazil
77fcfe439c remove unused list 2023-01-06 08:50:03 -08:00
Kelly Brazil
71d1355419 formatting 2023-01-06 08:36:48 -08:00
Kelly Brazil
d1b270f336 formatting 2023-01-06 08:26:42 -08:00
Dave Marquardt
9190a08332 More AIX permanent ARP entry fixes 2023-01-06 10:25:04 -06:00
Dave Marquardt
3fae50e305 Handle permanent ARP entries on AIX 2023-01-06 10:21:32 -06:00
Dave Marquardt
3582497ed4 Fix interface parsing for incomplete ARP entry on AIX 2023-01-06 10:16:13 -06:00
Dave Marquardt
19a67daabf rewrite check for incomplete ARP entries 2023-01-06 10:12:50 -06:00
Dave Marquardt
02a7e5fd8a Updated ARP incomplete handling for AIX 2023-01-06 10:08:33 -06:00
Dave Marquardt
df72b16022 Start to fix AIX ARP support 2023-01-06 10:00:58 -06:00
Kelly Brazil
61bdc13810 doc update 2023-01-05 17:05:03 -08:00
Kelly Brazil
1350a34316 beautify process function 2023-01-05 16:59:22 -08:00
Kelly Brazil
7cfe68b96a beautify remove_quotes function 2023-01-05 16:55:53 -08:00
Kelly Brazil
7a93a61f54 move unsectioned k/v's to the top level 2023-01-05 15:44:21 -08:00
Kelly Brazil
362977e598 comment unused objects 2023-01-05 14:26:01 -08:00
Kelly Brazil
5cac897beb zipinfo fix for paths with spaces 2023-01-05 12:00:20 -08:00
Kelly Brazil
cad94cc6b3 formatting and doc update 2023-01-05 11:46:14 -08:00
Kelly Brazil
fe4e429e85 Merge pull request #349 from davemq/mount_aix
Add AIX mount support
2023-01-05 11:39:42 -08:00
Kelly Brazil
d83b10e2d5 doc update 2023-01-05 11:27:49 -08:00
Kelly Brazil
bd2a757fcd more refactoring 2023-01-05 11:27:00 -08:00
Dave Marquardt
358b69a4cb Merge branch 'dev' into mount_aix 2023-01-05 11:06:00 -06:00
Dave Marquardt
08821a1454 Removed unneeded imports from mount parser 2023-01-05 10:57:23 -06:00
Kelly Brazil
90277c1d87 formatting 2023-01-05 08:54:40 -08:00
Dave Marquardt
a51e702f77 Added AIX mount test 2023-01-05 10:53:02 -06:00
Dave Marquardt
466e37128b Merge branch 'dev' into mount_aix 2023-01-05 10:32:47 -06:00
Dave Marquardt
f1ea61388f Added AIX mount support 2023-01-05 10:28:01 -06:00
Kelly Brazil
72c11fda3a more refactoring 2023-01-05 08:00:18 -08:00
Kelly Brazil
d6645983ef more refactoring 2023-01-04 20:54:31 -08:00
Kelly Brazil
01e911ecdb remove more type annotations 2023-01-04 19:17:29 -08:00
Kelly Brazil
12c0b3d889 remove more type annotations 2023-01-04 19:13:12 -08:00
Kelly Brazil
c1075e40b7 remove more type hinting for python 3.6 2023-01-04 19:09:41 -08:00
Kelly Brazil
fabe3f01b7 remove type annotations for python 3.6 compatibility 2023-01-04 19:00:49 -08:00
Kelly Brazil
3a2ff61899 fix lsusb for extra hub port info and add videocontrol and videostreaming sections 2023-01-04 18:27:51 -08:00
Kelly Brazil
aeff94d272 add toml parser 2023-01-04 18:26:13 -08:00
Kelly Brazil
c94f5d83fa fix kv and ini parsers to only remove 1 quote from beginning and end 2023-01-03 13:26:52 -08:00
Kelly Brazil
b0756fa0f9 doc update 2023-01-03 13:05:51 -08:00
Kelly Brazil
6c85abd57b doc update 2023-01-03 13:04:13 -08:00
Kelly Brazil
7659ae94bd formatting 2023-01-03 12:59:10 -08:00
Kelly Brazil
e306e81e43 formatting 2023-01-03 12:57:04 -08:00
Kelly Brazil
6d5768b26b simplify code and doc update 2023-01-03 12:55:38 -08:00
Kelly Brazil
cee9f8bf32 remove duplicate code. add tests 2023-01-03 12:44:12 -08:00
Kelly Brazil
b8e2678c01 doc update 2023-01-03 12:30:23 -08:00
Kelly Brazil
b0fe96ed03 doc update 2023-01-03 12:28:26 -08:00
Kelly Brazil
bb65ec380b separate kv and ini parsers. add fake top-level section in ini files that are missing it. 2023-01-03 12:11:05 -08:00
Kelly Brazil
ae6248227b version bump 2023-01-03 11:53:57 -08:00
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
Kelly Brazil
6e7b6afe87 Merge pull request #198 from kellyjonbrazil/dev
Dev v1.18.0
2022-01-21 13:52:16 -08:00
Kelly Brazil
027c231097 formatting 2022-01-21 13:48:38 -08:00
Kelly Brazil
f1cf7d1f95 add helper function info 2022-01-21 12:51:26 -08:00
Kelly Brazil
df611cc263 formatting 2022-01-21 12:41:52 -08:00
Kelly Brazil
0f3143bbbb formatting 2022-01-21 12:39:22 -08:00
Kelly Brazil
c280757b76 formatting 2022-01-21 12:35:48 -08:00
Kelly Brazil
d30b9d84ef formatting 2022-01-21 12:33:23 -08:00
Kelly Brazil
50ded1dbd9 doc update 2022-01-21 12:31:03 -08:00
Kelly Brazil
e319aea5a4 add doc version info 2022-01-21 12:29:36 -08:00
Kelly Brazil
ba86509c1d simplify OSError exception handling 2022-01-21 12:15:34 -08:00
Kelly Brazil
0a9279ae6b doc update 2022-01-21 12:15:16 -08:00
Kelly Brazil
a13dde12af change raw output wording 2022-01-21 07:42:03 -08:00
Kelly Brazil
e2ed358de1 changelog update 2022-01-20 15:31:24 -08:00
Kelly Brazil
a2cd366621 Delete _config.yml 2022-01-20 15:01:49 -08:00
Kelly Brazil
15addd9bfc doc fix 2022-01-20 09:59:23 -08:00
Kelly Brazil
a4e34b0053 add universal parser docs 2022-01-20 09:46:24 -08:00
Kelly Brazil
d09529ac30 changelog update 2022-01-20 09:40:34 -08:00
Kelly Brazil
553097b505 docstring update 2022-01-20 09:40:08 -08:00
Kelly Brazil
49c5568577 module doc update 2022-01-20 07:49:45 -08:00
Kelly Brazil
6962b9ee8a formatting 2022-01-19 22:24:59 -08:00
Kelly Brazil
b4575a3f78 add lib docs 2022-01-19 22:20:36 -08:00
Kelly Brazil
35b54d235d add python package doc info 2022-01-19 21:53:13 -08:00
Kelly Brazil
583a5757e4 formatting 2022-01-19 21:32:21 -08:00
Kelly Brazil
f355333eee formatting 2022-01-19 19:27:46 -08:00
Kelly Brazil
4d7df10960 formatting 2022-01-19 19:24:37 -08:00
Kelly Brazil
66b2c28f4b formatting 2022-01-19 19:22:08 -08:00
Kelly Brazil
299a9c6d88 formatting 2022-01-19 19:19:25 -08:00
Kelly Brazil
bd391d979c add lib function docs 2022-01-19 19:18:03 -08:00
Kelly Brazil
7309bd2282 add get_help 2022-01-19 18:47:44 -08:00
Kelly Brazil
ce84c09d33 add get_help() 2022-01-19 18:44:26 -08:00
Kelly Brazil
b4fffbb647 formatting 2022-01-19 17:30:14 -08:00
Kelly Brazil
3701b4198a formatting 2022-01-19 17:29:22 -08:00
Kelly Brazil
d4c34098fa formatting 2022-01-19 11:31:29 -08:00
Kelly Brazil
b3c531193b formatting 2022-01-19 11:08:59 -08:00
Kelly Brazil
1d0e07c77b formatting 2022-01-19 10:31:46 -08:00
Kelly Brazil
06a322cf9c rename tests and add conversion function tests 2022-01-19 10:31:36 -08:00
Kelly Brazil
623d148712 doc update 2022-01-19 09:30:53 -08:00
Kelly Brazil
647e83d043 add test to ensure there are zero plugin parsers installed during tests 2022-01-19 09:29:09 -08:00
Kelly Brazil
91a5544644 doc update 2022-01-19 09:28:35 -08:00
Kelly Brazil
a1190998ae add jc and jc.lib tests 2022-01-19 09:15:24 -08:00
Kelly Brazil
097d7a1850 simplify __init__ 2022-01-19 09:15:11 -08:00
Kelly Brazil
302bf72e72 Update high-level API docs 2022-01-18 15:38:03 -08:00
Kelly Brazil
2c42baf3a4 add new high-level api info 2022-01-18 14:18:12 -08:00
Kelly Brazil
03feb89c84 add module list info 2022-01-18 13:46:11 -08:00
Kelly Brazil
9dd553192f doc update 2022-01-18 13:40:09 -08:00
Kelly Brazil
fa3f02e9d1 version bump 2022-01-18 13:39:51 -08:00
Kelly Brazil
0a9dde58c5 add jc.parse() high-level API 2022-01-18 13:10:14 -08:00
1702 changed files with 548485 additions and 9328 deletions

View File

@@ -9,23 +9,80 @@ on:
- "**/*.py"
jobs:
build:
very_old_python:
if: github.event.pull_request.draft == false
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-13, windows-2019]
python-version: ["3.6"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: "Set up timezone to America/Los_Angeles"
uses: szenius/set-timezone@v1.0
uses: szenius/set-timezone@v1.2
with:
timezoneLinux: "America/Los_Angeles"
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
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Test with unittest
run: |
python -m unittest discover tests
old_python:
if: github.event.pull_request.draft == false
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-13, ubuntu-22.04, windows-2019]
python-version: ["3.7", "3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- name: "Set up timezone to America/Los_Angeles"
uses: szenius/set-timezone@v1.2
with:
timezoneLinux: "America/Los_Angeles"
timezoneMacos: "America/Los_Angeles"
timezoneWindows: "Pacific Standard Time"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Test with unittest
run: |
python -m unittest discover tests
latest_python:
if: github.event.pull_request.draft == false
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- name: "Set up timezone to America/Los_Angeles"
uses: szenius/set-timezone@v1.2
with:
timezoneLinux: "America/Los_Angeles"
timezoneMacos: "America/Los_Angeles"
timezoneWindows: "Pacific Standard Time"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies

1
.gitignore vendored
View File

@@ -6,3 +6,4 @@ build/
.github/
.vscode/
_config.yml
.venv

513
CHANGELOG
View File

@@ -1,5 +1,466 @@
jc changelog
20250503 v1.25.5
- Add `amixer` command parser
- Enhance `iptables` command parser to add default policy statistics fields
- Fix `bluetoothctl` parser failing to parse controllers with power state prop
- Fix `lsblk` command parser to support multiple mountpoints. Also, added
byte conversions for size fields.
- Fix `nmcli` command parser to support `team.config` JSON field
- Fix `time` command parser for output that does not contain centiseconds
- Fix `x509-cert` parser to handle IDNA2008 encoded email addresses with a warning
- Fix typing for upcoming python v3.14
- Fix timezone setting for tests to support minimal chrooted builds
20241125 v1.25.4
- Add `ipconfig` command parser (`ipconfig` for Windows)
- Add `pacman` command parser
- Add `wg show` command parser
- Enhance `ethtool` parser to support `link_partner_advertised_link_modes`
- Enhance `ifconfig` parser to support `utun` interfaces with assigned IPv4 addresses on macOS
- Enhance `nsd-control` parser with additional state fields
- Enhance `ping-s` streaming parser to support error replies
- Fix `bluetoothctl` parser when extra attributes like `manufacturer` and `version` exist
- Fix `df` parser to correctly output binary vs. decimal size outputs
- Fix `ip-address` parser for Python 3.13 changes to IPv4 mapped IPv6 addresses
- Fix `iw-scan` parser to output more fields (still beta quality)
- Fix `mount` parser for cases where there are spaces in the filesystem name
- Fix `netstat` parser for cases where there are spaces in the program name
- Fix `pkg-index-deb`, `apt-cache-show`, and `rpm-qi` parsers to correctly convert contiguous packages with the same name
- Fix `traceroute` parser to support extreme IPv6 cases
- Fix `uptime` parser for data that contains `user` instead of `users`
- Fix `yaml` parser to support values that start with an equal sign
- Enhance `jc.utils.convert_size_to_int()` to add `posix_mode` and `decimal_bias` parameters
- Enhance cli to coerce any non-JSON-serializable objects to a string
20240609 v1.25.3
- Enhance `bluetoothctl` parser with added `battery_percentage` field
- Enhance `git-log` standard and streaming parsers with added `lines_changed` field under `file_stats`
- Fix `lspci` parser to handle `physlot` fields with a range value
- Fix `pci-ids` parser to correctly handle multiple subdevices
- Fix `pip-show` parser to handle multi-line fields with a beginning blank line
- Fix `ss` parser to correctly handle the `Recv-Q` field being too close to the `Status` field
- Fix `top` parsers to quiet uptime info parsing
- Fix `traceroute` parser to correctly handle hops with multiple IPs
- Fix `zpool-status` parser for config items lacking data values
- Optimize some tests by removing timezone settings and using quiet=True
- Documentation updates
20240323 v1.25.2
- Add `apt-cache-show` command parser
- Add `apt-get-sqq` command parser
- Add `ethtool` command parser
- Add `needrestart` command parser
- Enhance `df` parser to add human readable output support. Note: the `size`
field has been changed to an integer and all size values have been normalized
to bytes.
- Enhance `free` parser to add human readable output support. All size values
have been normalizd to bytes.
- Enhance `iptables` parser to handle -x output
- Enhance `/proc/pid/stat` parser to support "Idle" state
- Enhance `rpm_qi` and `pkg_index_deb` parsers to split list fields into arrays
- Fix `iwconfig` parser to handle more special characters in the SSID name
- Fix `xrandr` parser to ignore extra horizontal and vertical stats lines
- Add aarch64 binaries to Releases for macOS and Linux
- Documentation and doc build updates
20240212 v1.25.1
- Fix for crash when optional libraries are not installed (e.g. xmltodict)
- Fix for `ini` parser crashing with some keys with no values
- Fix `xrandr` parser to extract more EDID data
- Enhance `uptime` parser to support output with no user information
- Enhance `--quiet` CLI option to cover more warning messages
- Add tests for missing optional libraries
- Documentation updates
20240204 v1.25.0
- Add `--slurp` functionality to wrap output from multiple lines into a single array.
Note, this only works with single-line input parsers. (e.g. `date`, `ip-address`, `url`, etc.)
Streaming parsers are not supported. Use `jc -hhh` to find parsers compatible with the slurp option.
- Enhance `/proc` file magic syntax to allow slurping when multiple files are selected
and to include the `_file` metadata field in the data
- Enhance `--meta-out` functionality to include a list of the input data when using `--slurp`
or `/proc` file magic syntax. For slurpable parsers, this is a list of string inputs in order.
For `/proc` file magic syntax, this is a list of `/proc` filenames in order. This can help with
identifying which input matches to which output when using `--slurp` or when converting multiple
files via `/proc` file magic syntax.
- Add `curl-head` command parser for `curl --head` or `curl -I` with verbose support
- Add `efibootmgr` command parser
- Add `http-headers` parser for plain HTTP header output
- Add `kv-dup` parser for Key/Value files with duplicate keys
- Add `path` string parser to parse posix path
- Add `path-list` string parser to parse path list strings found in env variables
- Add source link to online parser documentation
- Add snap package build scripts
- Add `remove_quotes` function to `utils.py`
- Add `normalize_key` function to `utils.py`
- Add `line_slice` function to `utils.py`
- Add `get_parser` function to `lib.py`
- Enhance `nsd-control` parser to support more zone information
- Enhance `ping` and `ping-s` parsers to support the `-I` command option
- Enhance `proc-net-tcp` parser to add opposite endian support for architectures
like the s390x
- Enhance `url` parser to add `parent`, `filename`, `stem`, and `extension` fields
- Fix `ini` and `ini-dup` parsers to consistently handle null values as empty strings
- Fix line slicer to not skip blank lines
- Refactor parser aliases for `kv`, `pkg_index_deb`, `lsb_release`, and `os-release`
- Update copyright date
20231216 v1.24.0
- Add `debconf-show` command parser
- Add `iftop` command parser
- Add `pkg-index-apk` parser for Alpine Linux Package Index files
- Add `pkg-index-deb` parser for Debian/Ubuntu Package Index files
- Add `proc-cmdline` parser for `/proc/cmdline` file
- Add `swapon` command parser
- Add `tune2fs` command parser
- Remove `iso-datetime` parser deprecated since v1.22.1. (use `datetime-iso` instead)
- Update timezone change in Github Actions for node v16 requirement
- Add Python 3.12 tests to Github Actions
- Refactor `acpi` command parser for code cleanup
- Refactor vendored libraries to remove Python 2 support
- Fix `iptables` parser for cases where the `target` field is blank in a rule
- Fix `vmstat` parsers for some cases where wide output is used
- Fix `mount` parser for cases with spaces in the mount point name
- Fix `xrandr` parser for infinite loop issues
20231023 v1.23.6
- Fix XML parser for xmltodict library versions < 0.13.0
- Fix `who` command parser for cases when the from field contains spaces
20231021 v1.23.5
- Add `host` command parser
- Add `nsd-control` command parser
- Add `lsb_release` command parser
- Add `/etc/os-release` file parser
- Enhance `env` command parser to support multi-line values
- Enhance `ping` and `ping-s` parsers to add error and corrupted support
- Enhance `xml` parser to include comments in the JSON output
- Fix `pidstat` command parser when using `-T ALL`
- Fix `x509-cert` parser to allow negative serial numbers
- Fix `x509-cert` parser for cases when bitstrings are larger than standard
- Fix `xrandr` command parser for associated device issues
- Fix error when pygments library is not installed
20230730 v1.23.4
- Add `/etc/resolve.conf` file parser
- Add `/proc/net/tcp` and `/proc/net/tcp6` file parser
- Add `find` command parser
- Add `ip route` command parser
- Fix `certbot` command parser to be more robust with different line endings
20230621 v1.23.3
- Add `lsattr` command parser
- Add `srt` file parser
- Add `veracrypt` command parser
- Add X509 Certificate Request file parser
- Enhance X509 Certificate parser to allow non-compliant email addresses with a warning
- Enhance `dig` command parser to support the `+nsid` option
- Enhance `last` and `lastb` command parser to support the `-x` option
- Enhance `route` command parser to add Windows support
- Enhnace `netstat` command parser to add Windows support
- Enhance `ss` command parser to support extended options
- Enhance the compatibility warning message
- Fix `bluetoothctl` command parser for some mouse devices
- Fix `ping` command parsers for output with missing hostname
- Fix `stat` command parser for older versions that may not contain all fields
- Fix deprecated option in `setup.cfg`
20230429 v1.23.2
- Add `bluetoothctl` command parser
- Add `certbot` command parser for `certificates` and `show_account` options
- Fix `acpi` command parser for "Not charging" battery status lines
- Fix `iwconfig` command parser for SSIDs with dashes in the name
- Fix `crontab` command parsers for incorrect variable parsing in some cases
- Fix `git-log` and `git-log-s` command parsers for incorrect insertion/deletion parsing
- Fix `ufw-appinfo` command parser for parsing errors on multiline description fields
- Fix pytest warnings
20230323 v1.23.1
- Fix `zpool-status` command parser for lines that start with tab
- Fix `timedatectl` command parser when RTC set to local
- Fix to ensure `py.typed` file is included in the package wheel
- Fix `lsusb` command parser to support CDC MBIM and CDC MBIM Extended fields
- Add support for the `timesync-status` for the `timedatectl` command parser
- Fix to ignore non-parser-plugins in the parser plugin directory
20230227 v1.23.0
- Add input slicing as a `jc` command-line option
- Add `ssh` configuration file parser
- Add `ver` Version string parser
- Add `zpool iostat` command parser
- Add `zpool status` command parser
- Fix `acpi` command parser for "will never fully discharge" battery state
- Fix `crontab` and `crontab-u` command and file parsers for cases where only
shortcut schedule items exist
- Fix `ifconfig` command parser for older-style linux output
- Fix `xrandr` command parser for proper `is_current` output
- Fix `xrandr` command parser for infinite loop with some device configurations
- Add `reflection` key to `xrandr` parser schema
- Add display model info from EDID to `xrandr` parser
- Add `MPX-specific VMA` support for VM Flags in `/proc/<pid>/smaps` parser
20230111 v1.22.5
- Add TOML file parser
- Add INI with duplicate key support file parser
- Add AIX support for the `arp` command parser
- Add AIX support for the `mount` command parser
- Fix `lsusb` command parser when extra hub port status information is output
- Refactor `lsusb` command parser for more code reuse
- Fix INI file parser to include top-level values with no section header
- Fix INI file parser to not specially handle the [DEFAULT] section
- Fix INI file and Key/Value parsers to only remove one quotation mark from the
beginning and end of values.
- Update copyright dates
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
- Enhance magic syntax exception messages
- Enhance documentation formatting
20220106 v1.17.7
- Add stat command streaming parser tested on linux and macOS
@@ -319,16 +780,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
@@ -336,27 +797,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
@@ -369,8 +830,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
@@ -383,7 +844,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
@@ -396,11 +857,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

View File

@@ -1,5 +1,6 @@
# Contributing to jc
We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
We love your input! We want to make contributing to this project as easy and
transparent as possible, whether it's:
- Reporting a bug
- Discussing the current state of the code
@@ -8,26 +9,65 @@ We love your input! We want to make contributing to this project as easy and tra
- Proposing a new parser
## We Develop with Github
We use github to host code, to track issues and feature requests, as well as accept pull requests.
We use github to host code, to track issues and feature requests, as well as
accept pull requests.
## We Use Github Flow, So All Code Changes Happen Through Pull Requests
Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://guides.github.com/introduction/flow/index.html)). We actively welcome your pull requests:
Pull requests are the best way to propose changes to the codebase (we use
[Github Flow](https://guides.github.com/introduction/flow/index.html)). We
actively welcome your pull requests:
1. Open an issue to discuss the new feature, bug fix, or parser before opening a pull request. For new parsers, it is important to agree upon a schema before developing the parser.
2. Fork the repo and create your branch from `dev`, if available, otherwise `master`.
3. For new parsers: 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 to get started. You can even place a new parser python module file in the [parser plugin directory](https://github.com/kellyjonbrazil/jc#custom-parsers) to get started right away with just a standard `jc` installation.
4. If you've added code that should be tested, add tests. All new parsers should have several sample outputs and tests.
5. Documentation is auto-generated from docstrings, so ensure they are clear and accurate.
6. Ensure the test suite passes. (Note: "**America/Los_Angeles**" timezone should be configured on the test system)
1. Open an issue to discuss the new feature, bug fix, or parser before opening
a pull request. For new parsers, it is important to agree upon a schema
before developing the parser.
2. Fork the repo and create your branch from `dev`, if available, otherwise
`master`.
3. For new parsers:
- Templates: 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 to get started.
- Local development: You can even place a new parser python module file in
the [parser plugin directory](https://github.com/kellyjonbrazil/jc#parser-plugins)
to get started right away with just a standard `jc` installation.
- Parser registry: Add the parser name to the [jc/lib.py](https://github.com/kellyjonbrazil/jc/blob/master/jc/lib.py)
file.
4. If you've added code that should be tested, add tests. All new parsers should
have several sample outputs and tests.
- Templates:
- **Recommended:** [tests/templates/_test_foo_simple.py](https://github.com/kellyjonbrazil/jc/tree/master/tests/templates/_test_foo_simple.py) as a template if you only have test with fixtures.
Execute these steps for standard tests:
- Save this file as `test_{parser_name}.py` since the helper methods extract parser names from the filename. Use underscores instead of dashes for the parser name.
- Organize fixtures in `tests/fixtures` for optimal structure.
- Format fixtures as follows (using double dashes):
- `{parser_name}--{some_test_description}.out` for command output. (no dots in the filename except for the `.out` suffix)
- `{parser_name}--{some_test_description}.json` for expected JSON after parsing. (no dots in the filename except for the `.json` suffix)
- Custom: [tests/templates/_test_foo.py](https://github.com/kellyjonbrazil/jc/blob/master/tests/templates/_test_foo.py) as a template for tests.
- Custom: [tests/templates/_test_foo_s.py](https://github.com/kellyjonbrazil/jc/tree/master/tests/templates/_test_foo_s.py) as a template for **streaming parser** tests.
- Fixtures: Tests typically consist of an input file and an expected output
JSON file. Add the data files to the appropriate folder under [tests/fixtures](https://github.com/kellyjonbrazil/jc/tree/master/tests/fixtures)
5. Documentation is auto-generated from docstrings, so ensure they are clear and
accurate.
6. Ensure the test suite passes. (Note: "**America/Los_Angeles**" timezone
should be configured on the test system)
7. Make sure your code lints.
8. Issue that pull request!
## Parser Schema Guidelines
- Try to keep the schema as flat as possible - typically a list of flat dictionaries
- Keys should be lowercase, contain no special characters, and spaces should be converted to underscores
- Keys should be static, if possible. If they have to be dynamic, then they should not contain lists or dictionaries
## Documentation And Completions
This will make it easier to use tools like `jq` without requiring escaping of special characters, encapsulating key names in [""], keeps paths predictable, and makes iterating and searching for values easier.
No need to worry about documentation and completions as those are auto generated
via the python doc strings.
## Parser Schema Guidelines
- Try to keep the schema as flat as possible - typically a list of flat
dictionaries
- Keys should be lowercase, contain no special characters, and spaces should be
converted to underscores
- Keys should be static, if possible. If they have to be dynamic, then they
should not contain lists or dictionaries
This will make it easier to use tools like `jq` without requiring escaping of
special characters, encapsulating key names in `[""]`, keeps paths predictable,
and makes iterating and searching for values easier.
**Examples**
@@ -62,18 +102,61 @@ Good:
]
```
## Tests
It is essential to have good command output sample coverage and tests to keep the `jc` parser quality high.
## Development Environment
Use the following steps to set up the development environment.
Many parsers include calculated timestamp fields using the `jc.utils.timestamp` class. Naive timestamps created with this class should be generated on a system configured with the "**America/Los_Angeles**" timezone on linux/macOS/unix and "**Pacific Standard Time**" timezone on Windows for tests to pass on the Github Actions CI tests. This timezone should be configured on your local system before running the tests locally, as well.
### Virtual Environment
Set up a Python virtual environment for `jc` development so you won't have to
worry about library conflicts. This can be done with something like
[pyenv](https://github.com/pyenv/pyenv) and/or
[venv](https://docs.python.org/3/library/venv.html)
### Clone the repo
Once the virtual environment is set up, clone the `jc` repository inside:
```bash
git clone https://github.com/kellyjonbrazil/jc.git
```
### Install In Developer Mode
Next, use the `./install.sh` script to install `jc` and the requirements in
developer mode (code chages take effect immediately). This will install the
console-script entry point to `$HOME/.local/bin` so you may need to add this
to your path.
## Tests
It is essential to have good command output sample coverage and tests to keep
the `jc` parser quality high.
Many parsers include calculated timestamp fields using the `jc.utils.timestamp`
class. Naive timestamps created with this class should be generated on a system
configured with the "**America/Los_Angeles**" timezone on linux/macOS/unix and
"**Pacific Standard Time**" timezone on Windows for tests to pass on the Github
Actions CI tests. This timezone should be configured on your local system before
running the tests locally, as well.
You can run all tests by running the `./runtests.sh` script.
## Debug Messages
Use `--debug` or `-d` to see debug error messages (double to see more):
```shell
echo 'abc' | jc --parser-with-error -dd
```
## Any contributions you make will be under the MIT Software License
In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern.
In short, when you submit code changes, your submissions are understood to be
under the same [MIT License](http://choosealicense.com/licenses/mit/) that
covers the project. Feel free to contact the maintainers if that's a concern.
## Report bugs using Github's Issues
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/kellyjonbrazil/jc/issues); it's that easy!
We use GitHub issues to track public bugs. Report a bug by
[opening a new issue](https://github.com/kellyjonbrazil/jc/issues); it's that
easy!
## Write bug reports with detail, background, and sample code
**Great Bug Reports** tend to have:
- A quick summary and/or background
@@ -82,8 +165,10 @@ We use GitHub issues to track public bugs. Report a bug by [opening a new issue]
- Give sample code if you can.
- What you expected would happen
- What actually happens
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
- Notes (possibly including why you think this might be happening, or stuff you
tried that didn't work)
## Use a Consistent Coding Style
* 4 spaces for indentation rather than tabs
* Use a Python linter that will enforce PEP 8 and other best practices

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

75
README-snap.md Normal file
View File

@@ -0,0 +1,75 @@
# How to use `jc` with `snap`
## How to build `snap` package
- Install `snapd`. [One](https://snapcraft.io/docs/installing-snapd) or [two](https://github.com/don-rumata/ansible-role-install-snap).
- Install `snapcraft`:
```bash
$ sudo snap install snapcraft --classic
```
- Update snapd:
```bash
$ sudo snap refresh snapcraft --edge
```
- Clone the repo:
```bash
$ git clone https://github.com/kellyjonbrazil/jc
```
- Change the directory:
```bash
$ cd ./jc
```
- Select branch:
```bash
$ git checkout snap-support
```
- Initialize LXD:
```bash
$ lxd init --auto
```
- Build `.snap` file:
```bash
$ snapcraft
```
## How to install local snap file
```bash
$ snap install --dangerous ./jc_*_amd64.snap
```
## How to use `jc` with plugins
- Put your plugin in the `"$HOME/.local/share/jc"` directory.
- To connect the directory, run:
```bash
snap connect jc:dot-jc-plugins snapd
```
## Urls
- <https://snapcraft.io/docs/supported-interfaces>
- <https://snapcraft.io/docs/interface-management>
- <https://snapcraft.io/docs/personal-files-interface>
- <https://snapcraft.io/docs/python-apps>
- <https://documentation.ubuntu.com/lxd/en/latest/getting_started/>

798
README.md

File diff suppressed because it is too large Load Diff

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 amixer apt-cache apt-get arp blkid bluetoothctl cbt certbot chage cksum crontab curl date debconf-show df dig dmidecode dpkg du efibootmgr env ethtool file findmnt finger free git gpg hciconfig host id ifconfig iostat ip ipconfig iptables iw iwconfig jobs last lastb ls lsattr lsb_release lsblk lsmod lsof lspci lsusb md5 md5sum mdadm mount mpstat needrestart netstat nmcli nsd-control ntpq os-prober pacman pidstat ping ping6 pip pip3 postconf printenv ps route rpm rsync sfdisk sha1sum sha224sum sha256sum sha384sum sha512sum shasum ss ssh sshd stat sum swapon sysctl systemctl systeminfo timedatectl top tracepath tracepath6 traceroute traceroute6 tune2fs udevadm ufw uname update-alternatives upower uptime vdir veracrypt vmstat w wc wg who xrandr zipinfo zpool)
jc_parsers=(--acpi --airport --airport-s --amixer --apt-cache-show --apt-get-sqq --arp --asciitable --asciitable-m --blkid --bluetoothctl --cbt --cef --cef-s --certbot --chage --cksum --clf --clf-s --crontab --crontab-u --csv --csv-s --curl-head --date --datetime-iso --debconf-show --df --dig --dir --dmidecode --dpkg-l --du --efibootmgr --email-address --env --ethtool --file --find --findmnt --finger --free --fstab --git-log --git-log-s --git-ls-remote --gpg --group --gshadow --hash --hashsum --hciconfig --history --host --hosts --http-headers --id --ifconfig --ini --ini-dup --iostat --iostat-s --ip-address --ipconfig --iptables --ip-route --iw-scan --iwconfig --jar-manifest --jobs --jwt --kv --kv-dup --last --ls --ls-s --lsattr --lsb-release --lsblk --lsmod --lsof --lspci --lsusb --m3u --mdadm --mount --mpstat --mpstat-s --needrestart --netstat --nmcli --nsd-control --ntpq --openvpn --os-prober --os-release --pacman --passwd --path --path-list --pci-ids --pgpass --pidstat --pidstat-s --ping --ping-s --pip-list --pip-show --pkg-index-apk --pkg-index-deb --plist --postconf --proc --proc-buddyinfo --proc-cmdline --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-tcp --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 --resolve-conf --route --rpm-qi --rsync --rsync-s --semver --sfdisk --shadow --srt --ss --ssh-conf --sshd-conf --stat --stat-s --swapon --sysctl --syslog --syslog-s --syslog-bsd --syslog-bsd-s --systemctl --systemctl-lj --systemctl-ls --systemctl-luf --systeminfo --time --timedatectl --timestamp --toml --top --top-s --tracepath --traceroute --tune2fs --udevadm --ufw --ufw-appinfo --uname --update-alt-gs --update-alt-q --upower --uptime --url --ver --veracrypt --vmstat --vmstat-s --w --wc --wg-show --who --x509-cert --x509-csr --xml --xrandr --yaml --zipinfo --zpool-iostat --zpool-status)
jc_options=(--force-color -C --debug -d --monochrome -m --meta-out -M --pretty -p --quiet -q --raw -r --slurp -s --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,486 @@
#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 amixer apt-cache apt-get arp blkid bluetoothctl cbt certbot chage cksum crontab curl date debconf-show df dig dmidecode dpkg du efibootmgr env ethtool file findmnt finger free git gpg hciconfig host id ifconfig iostat ip ipconfig iptables iw iwconfig jobs last lastb ls lsattr lsb_release lsblk lsmod lsof lspci lsusb md5 md5sum mdadm mount mpstat needrestart netstat nmcli nsd-control ntpq os-prober pacman pidstat ping ping6 pip pip3 postconf printenv ps route rpm rsync sfdisk sha1sum sha224sum sha256sum sha384sum sha512sum shasum ss ssh sshd stat sum swapon sysctl systemctl systeminfo timedatectl top tracepath tracepath6 traceroute traceroute6 tune2fs udevadm ufw uname update-alternatives upower uptime vdir veracrypt vmstat w wc wg who xrandr zipinfo zpool)
jc_commands_describe=(
'acpi:run "acpi" command with magic syntax.'
'airport:run "airport" command with magic syntax.'
'amixer:run "amixer" command with magic syntax.'
'apt-cache:run "apt-cache" command with magic syntax.'
'apt-get:run "apt-get" command with magic syntax.'
'arp:run "arp" command with magic syntax.'
'blkid:run "blkid" command with magic syntax.'
'bluetoothctl:run "bluetoothctl" command with magic syntax.'
'cbt:run "cbt" command with magic syntax.'
'certbot:run "certbot" 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.'
'curl:run "curl" command with magic syntax.'
'date:run "date" command with magic syntax.'
'debconf-show:run "debconf-show" 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.'
'efibootmgr:run "efibootmgr" command with magic syntax.'
'env:run "env" command with magic syntax.'
'ethtool:run "ethtool" 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.'
'host:run "host" 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.'
'ip:run "ip" command with magic syntax.'
'ipconfig:run "ipconfig" 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.'
'lsattr:run "lsattr" command with magic syntax.'
'lsb_release:run "lsb_release" 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.'
'needrestart:run "needrestart" command with magic syntax.'
'netstat:run "netstat" command with magic syntax.'
'nmcli:run "nmcli" command with magic syntax.'
'nsd-control:run "nsd-control" command with magic syntax.'
'ntpq:run "ntpq" command with magic syntax.'
'os-prober:run "os-prober" command with magic syntax.'
'pacman:run "pacman" 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.'
'ssh:run "ssh" 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.'
'swapon:run "swapon" 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.'
'tune2fs:run "tune2fs" 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.'
'veracrypt:run "veracrypt" 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.'
'wg:run "wg" 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.'
'zpool:run "zpool" command with magic syntax.'
)
jc_parsers=(--acpi --airport --airport-s --amixer --apt-cache-show --apt-get-sqq --arp --asciitable --asciitable-m --blkid --bluetoothctl --cbt --cef --cef-s --certbot --chage --cksum --clf --clf-s --crontab --crontab-u --csv --csv-s --curl-head --date --datetime-iso --debconf-show --df --dig --dir --dmidecode --dpkg-l --du --efibootmgr --email-address --env --ethtool --file --find --findmnt --finger --free --fstab --git-log --git-log-s --git-ls-remote --gpg --group --gshadow --hash --hashsum --hciconfig --history --host --hosts --http-headers --id --ifconfig --ini --ini-dup --iostat --iostat-s --ip-address --ipconfig --iptables --ip-route --iw-scan --iwconfig --jar-manifest --jobs --jwt --kv --kv-dup --last --ls --ls-s --lsattr --lsb-release --lsblk --lsmod --lsof --lspci --lsusb --m3u --mdadm --mount --mpstat --mpstat-s --needrestart --netstat --nmcli --nsd-control --ntpq --openvpn --os-prober --os-release --pacman --passwd --path --path-list --pci-ids --pgpass --pidstat --pidstat-s --ping --ping-s --pip-list --pip-show --pkg-index-apk --pkg-index-deb --plist --postconf --proc --proc-buddyinfo --proc-cmdline --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-tcp --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 --resolve-conf --route --rpm-qi --rsync --rsync-s --semver --sfdisk --shadow --srt --ss --ssh-conf --sshd-conf --stat --stat-s --swapon --sysctl --syslog --syslog-s --syslog-bsd --syslog-bsd-s --systemctl --systemctl-lj --systemctl-ls --systemctl-luf --systeminfo --time --timedatectl --timestamp --toml --top --top-s --tracepath --traceroute --tune2fs --udevadm --ufw --ufw-appinfo --uname --update-alt-gs --update-alt-q --upower --uptime --url --ver --veracrypt --vmstat --vmstat-s --w --wc --wg-show --who --x509-cert --x509-csr --xml --xrandr --yaml --zipinfo --zpool-iostat --zpool-status)
jc_parsers_describe=(
'--acpi:`acpi` command parser'
'--airport:`airport -I` command parser'
'--airport-s:`airport -s` command parser'
'--amixer:`amixer` command parser'
'--apt-cache-show:`apt-cache show` command parser'
'--apt-get-sqq:`apt-get -sqq` 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'
'--bluetoothctl:`bluetoothctl` command parser'
'--cbt:`cbt` (Google Bigtable) command parser'
'--cef:CEF string parser'
'--cef-s:CEF string streaming parser'
'--certbot:`certbot` command 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'
'--curl-head:`curl --head` command parser'
'--date:`date` command parser'
'--datetime-iso:ISO 8601 Datetime string parser'
'--debconf-show:`debconf-show` command 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'
'--efibootmgr:`efibootmgr` command parser'
'--email-address:Email Address string parser'
'--env:`env` command parser'
'--ethtool:`ethtool` command parser'
'--file:`file` command parser'
'--find:`find` 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'
'--host:`host` command parser'
'--hosts:`/etc/hosts` file parser'
'--http-headers:HTTP headers parser'
'--id:`id` command parser'
'--ifconfig:`ifconfig` command parser'
'--ini:INI file parser'
'--ini-dup:INI with duplicate key file parser'
'--iostat:`iostat` command parser'
'--iostat-s:`iostat` command streaming parser'
'--ip-address:IPv4 and IPv6 Address string parser'
'--ipconfig:`ipconfig` Windows command parser'
'--iptables:`iptables` command parser'
'--ip-route:`ip route` 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'
'--kv-dup:Key/Value with duplicate key file and string parser'
'--last:`last` and `lastb` command parser'
'--ls:`ls` command parser'
'--ls-s:`ls` command streaming parser'
'--lsattr:`lsattr` command parser'
'--lsb-release:`lsb_release` command 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'
'--needrestart:`needrestart -b` command parser'
'--netstat:`netstat` command parser'
'--nmcli:`nmcli` command parser'
'--nsd-control:`nsd-control` command parser'
'--ntpq:`ntpq -p` command parser'
'--openvpn:openvpn-status.log file parser'
'--os-prober:`os-prober` command parser'
'--os-release:`/etc/os-release` file parser'
'--pacman:`pacman` command parser'
'--passwd:`/etc/passwd` file parser'
'--path:POSIX path string parser'
'--path-list:POSIX path list string 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'
'--pkg-index-apk:Alpine Linux Package Index file parser'
'--pkg-index-deb:Debian Package Index file parser'
'--plist:PLIST file parser'
'--postconf:`postconf -M` command parser'
'--proc:`/proc/` file parser'
'--proc-buddyinfo:`/proc/buddyinfo` file parser'
'--proc-cmdline:`/proc/cmdline` 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-tcp:`/proc/net/tcp` and `/proc/net/tcp6` 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'
'--resolve-conf:`/etc/resolve.conf` file 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'
'--srt:SRT file parser'
'--ss:`ss` command parser'
'--ssh-conf:`ssh` config file and `ssh -G` command parser'
'--sshd-conf:`sshd` config file and `sshd -T` command parser'
'--stat:`stat` command parser'
'--stat-s:`stat` command streaming parser'
'--swapon:`swapon` command 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'
'--toml:TOML file 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'
'--tune2fs:`tune2fs -l` 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'
'--ver:Version string parser'
'--veracrypt:`veracrypt` command parser'
'--vmstat:`vmstat` command parser'
'--vmstat-s:`vmstat` command streaming parser'
'--w:`w` command parser'
'--wc:`wc` command parser'
'--wg-show:`wg show` command parser'
'--who:`who` command parser'
'--x509-cert:X.509 PEM and DER certificate file parser'
'--x509-csr:X.509 PEM and DER certificate request file parser'
'--xml:XML file parser'
'--xrandr:`xrandr` command parser'
'--yaml:YAML file parser'
'--zipinfo:`zipinfo` command parser'
'--zpool-iostat:`zpool iostat` command parser'
'--zpool-status:`zpool status` command parser'
)
jc_options=(--force-color -C --debug -d --monochrome -m --meta-out -M --pretty -p --quiet -q --raw -r --slurp -s --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'
'--slurp:slurp multiple lines into an array'
'-s:slurp multiple lines into an array'
'--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

86
doc2md.py Executable file
View File

@@ -0,0 +1,86 @@
#!/usr/bin/env python3
"""
Convert parser doc string to markdown
"""
import sys
import importlib
from inspect import isfunction, signature, cleandoc
import yapf # type: ignore
ignore_lib_functions = [
'cast',
'wraps',
'lru_cache',
'namedtuple'
]
mod_path = sys.argv[1]
mod_name = mod_path.split('.')[-1]
module = importlib.import_module(f'{mod_path}')
######## HEADER ########
header = f'''[Home](https://kellyjonbrazil.github.io/jc/)
<a id="{mod_path}"></a>
# {mod_path}
'''
summary = module.__doc__ or ''
functions = []
for attribute in dir(module):
if isfunction(getattr(module, attribute)) \
and not getattr(module, attribute).__name__.startswith('_'):
if 'jc.parsers.' in mod_path and not 'universal' in mod_path:
if attribute == 'parse':
functions.append(attribute)
else:
if not attribute in ignore_lib_functions:
functions.append(attribute)
######## TABLE OF CONTENTS ########
toc = f'## Table of Contents\n\n* [{mod_path}](#{mod_path})\n'
for api in functions:
toc = f'{toc} * [{api}](#{mod_path}.{api})\n'
######## API DOCS ########
api_docs = ''
for api in functions:
api_function = getattr(module, api)
this_header = f'<a id="{mod_path}.{api}"></a>\n\n### {api}\n'
this_sig = str(signature(api_function))
formatted_sig = yapf.yapf_api.FormatCode(f'def {api_function.__name__}{this_sig}:\n pass' )
formatted_sig = formatted_sig[0].split(':\n pass')[0]
this_name_and_sig = f'{this_header}\n```python\n{formatted_sig}\n```'
this_doc = cleandoc(api_function.__doc__)
api_docs = api_docs + this_name_and_sig + '\n\n' + this_doc + '\n\n'
######## FOOTER ########
footer = ''
if 'jc.parsers.' in mod_path and not 'universal' in mod_path:
footer = '### Parser Information\n'
comp = ', '.join(module.info.compatible)
ver = module.info.version
author = module.info.author
author_email = module.info.author_email
slurpable = 'slurpable' in module.info.tags
footer = footer + f'Compatibility: {comp}\n\n'
footer = footer + f'Source: [`jc/parsers/{mod_name}.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/{mod_name}.py)\n\n'
if slurpable:
footer = footer + 'This parser can be used with the `--slurp` command-line option.\n\n'
footer = footer + f'Version {ver} by {author} ({author_email})'
final_doc = ''
if 'jc.parsers.' in mod_path and not 'universal' in mod_path:
final_doc = header + '\n' + summary + '\n' + api_docs + footer
elif mod_path == 'jc':
final_doc = header + '\n' + summary
else:
final_doc = header + '\n' + toc + '\n' + summary + '\n\n' + api_docs
print(final_doc)

View File

@@ -1,37 +1,53 @@
#!/bin/bash
# Generate docs.md
# requires pydoc-markdown 2.1.0.post1
# Generate markdown document files (*.md)
# Requires the yapf python library
# use ./docgen all to generate all docs
cd jc
echo Building docs for: package
pydocmd simple jc+ > ../docs/readme.md
echo Building docs for: utils
pydocmd simple utils+ > ../docs/utils.md
(
echo Building docs for: package
../doc2md.py jc > ../docs/readme.md && echo "+++ package docs complete" || echo "*** PACKAGE DOCS FAILED ***"
) &
(
echo Building docs for: lib
../doc2md.py jc.lib > ../docs/lib.md && echo "+++ lib docs complete" || echo "*** LIB DOCS FAILED ***"
) &
(
echo Building docs for: utils
../doc2md.py jc.utils > ../docs/utils.md && echo "+++ utils docs complete" || echo "*** UTILS DOCS FAILED ***"
) &
(
echo Building docs for: streaming
../doc2md.py jc.streaming > ../docs/streaming.md && echo "+++ streaming docs complete" || echo "*** STREAMING DOCS FAILED ***"
) &
(
echo Building docs for: universal parser
../doc2md.py jc.parsers.universal > ../docs/parsers/universal.md && echo "+++ universal parser docs complete" || echo "*** UNIVERSAL PARSER DOCS FAILED ***"
) &
# 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")
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
{
if [[ $1 == "all" ]] || ! git diff --quiet --exit-code HEAD~5 -- "parsers/${parser_name}.py"; then
echo "Building docs for: ${parser_name}"
../doc2md.py jc.parsers."${parser_name}" > ../docs/parsers/"${parser_name}".md && echo "+++ ${parser_name} docs complete" || echo "*** ${parser_name} DOCS FAILED ***"
fi
} &
done
wait
echo "Document Generation Complete"

View File

@@ -1 +0,0 @@
theme: jekyll-theme-cayman

274
docs/lib.md Normal file
View File

@@ -0,0 +1,274 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.lib"></a>
# jc.lib
## Table of Contents
* [jc.lib](#jc.lib)
* [all_parser_info](#jc.lib.all_parser_info)
* [get_help](#jc.lib.get_help)
* [get_parser](#jc.lib.get_parser)
* [parse](#jc.lib.parse)
* [parser_info](#jc.lib.parser_info)
* [parser_mod_list](#jc.lib.parser_mod_list)
* [plugin_parser_mod_list](#jc.lib.plugin_parser_mod_list)
* [slurpable_parser_mod_list](#jc.lib.slurpable_parser_mod_list)
* [standard_parser_mod_list](#jc.lib.standard_parser_mod_list)
* [streaming_parser_mod_list](#jc.lib.streaming_parser_mod_list)
jc - JSON Convert lib module
<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[jc.jc_types.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, module]) -> 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.
<a id="jc.lib.get_parser"></a>
### get_parser
```python
def get_parser(parser_mod_name: Union[str, module]) -> module
```
Return the parser module object and check that the module is a valid
parser module.
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.
If a Module is given and the Module
is a valid parser Module, then the
same Module is returned.
Returns:
Module: the parser Module object
Raises:
ModuleNotFoundError: If the Module is not found or is not a valid
parser Module, then a ModuleNotFoundError
exception is raised.
<a id="jc.lib.parse"></a>
### parse
```python
def parse(
parser_mod_name: Union[str, module],
data: Union[str, bytes, Iterable[str]],
quiet: bool = False,
raw: bool = False,
ignore_exceptions: Optional[bool] = None,
**kwargs
) -> Union[Dict[str, Any], List[Dict[str, Any]], Iterator[Dict[str, Any]]]
```
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 (standard parsers):
>>> import jc
>>> 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
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
>>> jc_date = jc.get_parser('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 parser modules directly via `get_parser()`:
>>> import jc
>>> jc_date = jc.get_parser('date')
>>> date_obj = jc_date.parse('Tue Jan 18 10:23:07 PST 2022')
>>> print(f'The year is: {date_obj["year"]}')
The year is: 2022
Finally, you can access the low-level parser modules manually:
>>> import jc.parsers.date
>>> date_obj = jc.parsers.date.parse('Tue Jan 18 10:23:07 PST 2022')
>>> print(f'The year is: {date_obj["year"]}')
The year is: 2022
Though, accessing plugin parsers directly is a bit more cumbersome, so
this higher-level API is recommended. Here is how you can access plugin
parsers without this API:
>>> import os
>>> import sys
>>> import jc.appdirs
>>> data_dir = jc.appdirs.user_data_dir('jc', 'jc')
>>> local_parsers_dir = os.path.join(data_dir, 'jcparsers')
>>> sys.path.append(local_parsers_dir)
>>> import my_custom_parser
>>> my_custom_parser.parse('command_data')
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.
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
quiet: (boolean) suppress warning messages if True
ignore_exceptions: (boolean) ignore parsing exceptions if True
(streaming parsers only)
Returns:
Standard Parsers: Dictionary or List of Dictionaries
Streaming Parsers: Generator Object containing Dictionaries
<a id="jc.lib.parser_info"></a>
### parser_info
```python
def parser_info(parser_mod_name: Union[str, module],
documentation: bool = False) -> jc.jc_types.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.parser_mod_list"></a>
### parser_mod_list
```python
def parser_mod_list(show_hidden: bool = False,
show_deprecated: bool = False) -> List[str]
```
Returns a list of all available parser module names.
<a id="jc.lib.plugin_parser_mod_list"></a>
### plugin_parser_mod_list
```python
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.slurpable_parser_mod_list"></a>
### slurpable_parser_mod_list
```python
def slurpable_parser_mod_list(show_hidden: bool = False,
show_deprecated: bool = False) -> List[str]
```
Returns a list of slurpable 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
```python
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()`.

View File

@@ -1,20 +1,22 @@
[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
Usage (module):
import jc.parsers.acpi
result = jc.parsers.acpi.parse(acpi_command_output)
import jc
result = jc.parse('acpi', acpi_command_output)
Schema:
@@ -225,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
@@ -242,14 +240,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
Source: [`jc/parsers/acpi.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/acpi.py)
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.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,14 +11,14 @@ Usage (cli):
$ airport -I | jc --airport
or
or
$ jc airport -I
Usage (module):
import jc.parsers.airport
result = jc.parsers.airport.parse(airport_command_output)
import jc
result = jc.parse('airport', airport_command_output)
Schema:
@@ -78,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
@@ -95,14 +93,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: darwin
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Source: [`jc/parsers/airport.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/airport.py)
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 - JSON Convert `airport -s` command output parser
The `airport` program can be found at `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport`.
@@ -9,14 +11,14 @@ Usage (cli):
$ airport -s | jc --airport-s
or
or
$ jc airport -s
Usage (module):
import jc.parsers.airport_s
result = jc.parsers.airport_s.parse(airport_s_command_output)
import jc
result = jc.parse('airport_s', airport_s_command_output)
Schema:
@@ -106,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
@@ -123,14 +121,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: darwin
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
Source: [`jc/parsers/airport_s.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/airport_s.py)
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,117 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.amixer"></a>
# jc.parsers.amixer
jc - JSON Convert `amixer sget` command output parser
Usage (cli):
$ amixer sget <control_name> | jc --amixer
$ amixer sget Master | jc --amixer
$ amixer sget Capture | jc --amixer
$ amixer sget Speakers | jc --amixer
Usage (module):
import jc
result = jc.parse('amixer', <amixer_sget_command_output>)
Schema:
{
"control_name": string,
"capabilities": [
string
],
"playback_channels": [
string
],
"limits": {
"playback_min": integer,
"playback_max": integer
},
"mono": {
"playback_value": integer,
"percentage": integer,
"db": float,
"status": boolean
}
}
Examples:
$ amixer sget Master | jc --amixer -p
{
"control_name": "Capture",
"capabilities": [
"cvolume",
"cswitch"
],
"playback_channels": [],
"limits": {
"playback_min": 0,
"playback_max": 63
},
"front_left": {
"playback_value": 63,
"percentage": 100,
"db": 30.0,
"status": true
},
"front_right": {
"playback_value": 63,
"percentage": 100,
"db": 30.0,
"status": true
}
}
$ amixer sget Master | jc --amixer -p -r
{
"control_name": "Master",
"capabilities": [
"pvolume",
"pvolume-joined",
"pswitch",
"pswitch-joined"
],
"playback_channels": [
"Mono"
],
"limits": {
"playback_min": "0",
"playback_max": "87"
},
"mono": {
"playback_value": "87",
"percentage": "100%",
"db": "0.00db",
"status": "on"
}
}
<a id="jc.parsers.amixer.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
Source: [`jc/parsers/amixer.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/amixer.py)
Version 1.0 by Eden Refael (edenraf@hotmail.com)

View File

@@ -0,0 +1,180 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.apt_cache_show"></a>
# jc.parsers.apt_cache_show
jc - JSON Convert `apt-cache show` command parser
Usage (cli):
$ apt-cache show | jc --apt-cache-show
Usage (module):
import jc
result = jc.parse('apt_cache_show', apt_cache_show_output)
Schema:
[
{
"package": string,
"version": string,
"installed_size": integer,
"maintainer": string,
"architecture": string,
"depends": [
string
],
"pre_depends": [
string
],
"recommends": [
string
],
"suggests": [
string
],
"conflicts": [
string
],
"breaks": [
string
],
"description_md5": string,
"multi_arch": string,
"homepage": string,
"section": string,
"priority": string,
"filename": string,
"size": integer,
"sha256": string,
"description": string
}
]
Examples:
$ apt-cache show | jc --apt-cache-show -p
[
{
"package": "systemd",
"version": "247.3-6~bpo10+1",
"installed_size": 16121,
"maintainer": "Debian systemd Maintainers <pkg-systemd-maintaine..",
"architecture": "amd64",
"depends": [
"libacl1 (>= 2.2.23)",
"libapparmor1 (>= 2.13)",
"libaudit1 (>= 1:2.2.1)",
"libcap2 (>= 1:2.10)",
"libcryptsetup12 (>= 2:2.0.1)",
"libgnutls30 (>= 3.6.6)",
"libgpg-error0 (>= 1.14)",
"libip4tc0 (>= 1.6.0+snapshot20161117)",
"libkmod2 (>= 5~)",
"liblz4-1 (>= 0.0~r130)",
"libmount1 (>= 2.30)",
"libpam0g (>= 0.99.7.1)",
"libseccomp2 (>= 2.3.1)",
"libsystemd0 (= 247.3-6~bpo10+1)",
"systemd-timesyncd | time-daemon",
"util-linux (>= 2.27.1)",
"mount (>= 2.26)",
"adduser"
],
"pre_depends": [
"libblkid1 (>= 2.24)",
"libc6 (>= 2.28)",
"libgcrypt20 (>= 1.8.0)",
"liblz4-1 (>= 0.0~r122)",
"liblzma5 (>= 5.1.1alpha+20120614)",
"libselinux1 (>= 2.1.9)",
"libzstd1 (>= 1.4.0)"
],
"recommends": [
"dbus"
],
"suggests": [
"systemd-container",
"policykit-1"
],
"conflicts": [
"consolekit",
"libpam-ck-connector"
],
"breaks": [
"python-dbusmock (<< 0.18)",
"python3-dbusmock (<< 0.18)",
"resolvconf (<< 1.83~)",
"systemd-shim (<< 10-4~)",
"udev (<< 247~)"
],
"description_md5": "19399579cbc0c47a303288bf15eadcd4",
"multi_arch": "foreign",
"homepage": "https://www.freedesktop.org/wiki/Software/systemd",
"section": "admin",
"priority": "important",
"filename": "pool/main/s/systemd/systemd_247.3-6~bpo10+1_amd64.deb",
"size": 4382056,
"sha256": "2035450655ad02faa0f75dc952128b503e51df5795c67273c0f6...",
"description": "system and service manager systemd is a system..."
},
...
]
$ apt-cache show | jc --apt-cache-show -p -r
[
{
"package": "systemd",
"version": "247.3-6~bpo10+1",
"installed_size": "16121",
"maintainer": "Debian systemd Maintainers <pkg-systemd-maintain...",
"architecture": "amd64",
"depends": "libacl1 (>= 2.2.23), libapparmor1 (>= 2.13), libaud...",
"pre_depends": "libblkid1 (>= 2.24), libc6 (>= 2.28), libgcrypt...",
"recommends": "dbus",
"suggests": "systemd-container, policykit-1",
"conflicts": "consolekit, libpam-ck-connector",
"breaks": "python-dbusmock (<< 0.18), python3-dbusmock (<< 0.18...",
"description_md5": "19399579cbc0c47a303288bf15eadcd4",
"multi_arch": "foreign",
"homepage": "https://www.freedesktop.org/wiki/Software/systemd",
"section": "admin",
"priority": "important",
"filename": "pool/main/s/systemd/systemd_247.3-6~bpo10+1_amd64.deb",
"size": "4382056",
"sha256": "2035450655ad02faa0f75dc952128b503e51df5795c67273c0f6...",
"description": "system and service manager systemd is a system..."
},
...
]
<a id="jc.parsers.apt_cache_show.parse"></a>
### parse
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[Dict[str, Any]]
```
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
Source: [`jc/parsers/apt_cache_show.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/apt_cache_show.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

201
docs/parsers/apt_get_sqq.md Normal file
View File

@@ -0,0 +1,201 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.apt_get_sqq"></a>
# jc.parsers.apt_get_sqq
jc - JSON Convert `apt-get -sqq` command output parser
Requires the `-sqq` options in `apt-get`.
Usage (cli):
$ apt-get -sqq upgrade | jc --apt-get-sqq
or
$ jc apt-get -sqq full-upgrade
Usage (module):
import jc
result = jc.parse('apt_get_sqq', apt_get_sqq_command_output)
Schema:
[
{
"operation": string, # configure, remove, or unpack
"package": string,
"broken": string/null,
"proposed_pkg_ver": string,
"existing_pkg_ver": string/null,
"architecture": string
}
]
Examples:
$ apt-get -sqq upgrade | jc --apt-get-sqq -p
[
{
"operation": "unpack",
"package": "dpkg",
"broken": "1.19.7",
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
},
{
"operation": "unpack",
"package": "dpkg",
"broken": null,
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
},
{
"operation": "configure",
"package": "dpkg",
"broken": "1.19.7",
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
},
{
"operation": "remove",
"package": "dpkg",
"broken": "1.19.7",
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
},
{
"operation": "unpack",
"package": "base-files",
"broken": "10.3+deb10u4",
"proposed_pkg_ver": "10.3+deb10u13 Debian:10.13/oldstable",
"existing_pkg_ver": null,
"architecture": "amd64"
},
{
"operation": "configure",
"package": "base-files",
"broken": null,
"proposed_pkg_ver": "10.3+deb10u13 Debian:10.13/oldstable",
"existing_pkg_ver": null,
"architecture": "amd64"
},
{
"operation": "unpack",
"package": "dpkg",
"broken": "1.19.7",
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
},
{
"operation": "configure",
"package": "dpkg",
"broken": null,
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
}
]
$ apt-get -sqq upgrade | jc --apt-get-sqq -p -r
[
{
"operation": "Inst",
"package": "dpkg",
"broken": "1.19.7",
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
},
{
"operation": "Inst",
"package": "dpkg",
"broken": null,
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
},
{
"operation": "Conf",
"package": "dpkg",
"broken": "1.19.7",
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
},
{
"operation": "Remv",
"package": "dpkg",
"broken": "1.19.7",
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
},
{
"operation": "Inst",
"package": "base-files",
"broken": "10.3+deb10u4",
"proposed_pkg_ver": "10.3+deb10u13 Debian:10.13/oldstable",
"existing_pkg_ver": null,
"architecture": "amd64"
},
{
"operation": "Conf",
"package": "base-files",
"broken": null,
"proposed_pkg_ver": "10.3+deb10u13 Debian:10.13/oldstable",
"existing_pkg_ver": null,
"architecture": "amd64"
},
{
"operation": "Inst",
"package": "dpkg",
"broken": "1.19.7",
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
},
{
"operation": "Conf",
"package": "dpkg",
"broken": null,
"proposed_pkg_ver": "1.19.8 Debian:10.13/oldstable",
"existing_pkg_ver": "Debian-Security:10/oldstable",
"architecture": "amd64"
}
]
<a id="jc.parsers.apt_get_sqq.parse"></a>
### parse
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[Dict[str, Any]]
```
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
Source: [`jc/parsers/apt_get_sqq.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/apt_get_sqq.py)
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.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,14 +11,14 @@ Usage (cli):
$ arp | jc --arp
or
or
$ jc arp
Usage (module):
import jc.parsers.arp
result = jc.parsers.arp.parse(arp_command_output)
import jc
result = jc.parse('arp', arp_command_output)
Schema:
@@ -115,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
@@ -132,14 +130,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
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)
Source: [`jc/parsers/arp.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/arp.py)
Version 1.12 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,149 @@
[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
Source: [`jc/parsers/asciitable.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/asciitable.py)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -0,0 +1,134 @@
[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
Source: [`jc/parsers/asciitable_m.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/asciitable_m.py)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,20 +1,22 @@
[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
Usage (module):
import jc.parsers.blkid
result = jc.parsers.blkid.parse(blkid_command_output)
import jc
result = jc.parse('blkid', blkid_command_output)
Schema:
@@ -83,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,
@@ -118,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
@@ -135,14 +133,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
Source: [`jc/parsers/blkid.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/blkid.py)
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -0,0 +1,139 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.bluetoothctl"></a>
# jc.parsers.bluetoothctl
jc - JSON Convert `bluetoothctl` command output parser
Supports the following `bluetoothctl` subcommands:
- `bluetoothctl list`
- `bluetoothctl show`
- `bluetoothctl show <ctrl>`
- `bluetoothctl devices`
- `bluetoothctl info <dev>`
Usage (cli):
$ bluetoothctl info <dev> | jc --bluetoothctl
or
$ jc bluetoothctl info <dev>
Usage (module):
import jc
result = jc.parse('bluetoothctl', bluetoothctl_command_output)
Schema:
Because bluetoothctl is handling two main entities, controllers and devices,
the schema is shared between them. Most of the fields are common between
a controller and a device but there might be fields corresponding to one entity.
Controller:
[
{
"manufacturer": string,
"version": string,
"name": string,
"is_default": boolean,
"is_public": boolean,
"is_random": boolean,
"address": string,
"alias": string,
"class": string,
"powered": string,
"discoverable": string,
"discoverable_timeout": string,
"pairable": string,
"modalias": string,
"discovering": string,
"uuids": array
}
]
Device:
[
{
"name": string,
"is_public": boolean,
"is_random": boolean,
"address": string,
"alias": string,
"appearance": string,
"class": string,
"icon": string,
"paired": string,
"bonded": string,
"trusted": string,
"blocked": string,
"connected": string,
"legacy_pairing": string,
"rssi": int,
"txpower": int,
"uuids": array,
"modalias": string,
"battery_percentage": int
}
]
Examples:
$ bluetoothctl info EB:06:EF:62:B3:19 | jc --bluetoothctl -p
[
{
"address": "22:06:33:62:B3:19",
"is_public": true,
"name": "TaoTronics TT-BH336",
"alias": "TaoTronics TT-BH336",
"class": "0x00240455",
"icon": "audio-headset",
"paired": "no",
"bonded": "no",
"trusted": "no",
"blocked": "no",
"connected": "no",
"legacy_pairing": "no",
"uuids": [
"Advanced Audio Distribu.. (0000120d-0000-1000-8000-00805f9b34fb)",
"Audio Sink (0000130b-0000-1000-8000-00805f9b34fb)",
"A/V Remote Control (0000140e-0000-1000-8000-00805f9b34fb)",
"A/V Remote Control Cont.. (0000150f-0000-1000-8000-00805f9b34fb)",
"Handsfree (0000161e-0000-1000-8000-00805f9b34fb)",
"Headset (00001708-0000-1000-8000-00805f9b34fb)",
"Headset HS (00001831-0000-1000-8000-00805f9b34fb)"
],
"rssi": -52,
"txpower": 4,
"battery_percentage": 70
}
]
<a id="jc.parsers.bluetoothctl.parse"></a>
### parse
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[Dict[str, Any]]
```
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
Source: [`jc/parsers/bluetoothctl.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/bluetoothctl.py)
Version 1.4 by Jake Ob (iakopap at gmail.com)

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

@@ -0,0 +1,127 @@
[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[Dict[str, Any]]
```
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
Source: [`jc/parsers/cbt.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/cbt.py)
Version 1.0 by Andreas Weiden (andreas.weiden@gmail.com)

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

@@ -0,0 +1,148 @@
[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
Source: [`jc/parsers/cef.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/cef.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,125 @@
[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
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
Source: [`jc/parsers/cef_s.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/cef_s.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

163
docs/parsers/certbot.md Normal file
View File

@@ -0,0 +1,163 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.certbot"></a>
# jc.parsers.certbot
jc - JSON Convert `certbot` command output parser
Supports the following `certbot` commands:
- `certbot show_account`
- `certbot certificates`
Verbose options are not supported.
Usage (cli):
$ certbot show_account | jc --certbot
$ certbot certificates | jc --certbot
or
$ jc certbot show_account
$ jc certbot certificates
Usage (module):
import jc
result = jc.parse('certbot', certbot_command_output)
Schema:
{
"certificates": [
{
"name": string,
"serial_number": string,
"key_type": string,
"domains": [
string
],
"expiration_date": string,
"expiration_date_epoch": integer,
"expiration_date_epoch_utc": integer,
"expiration_date_iso": string,
"validity": string,
"certificate_path": string,
"private_key_path": string
}
],
"account": {
"server": string,
"url": string,
"email": string
}
}
Examples:
$ certbot certificates | jc --certbot -p
{
"certificates": [
{
"name": "example.com",
"serial_number": "3f7axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"key_type": "RSA",
"domains": [
"example.com",
"www.example.com"
],
"expiration_date": "2023-05-11 01:33:10+00:00",
"validity": "63 days",
"certificate_path": "/etc/letsencrypt/live/example.com/chain.pem",
"private_key_path": "/etc/letsencrypt/live/example.com/priv.pem",
"expiration_date_epoch": 1683793990,
"expiration_date_epoch_utc": 1683768790,
"expiration_date_iso": "2023-05-11T01:33:10+00:00"
},
{
"name": "example.org",
"serial_number": "3bcyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
"key_type": "RSA",
"domains": [
"example.org",
"www.example.org"
],
"expiration_date": "2023-06-12 01:35:30+00:00",
"validity": "63 days",
"certificate_path": "/etc/letsencrypt/live/example.org/chain.pem",
"private_key_path": "/etc/letsencrypt/live/example.org/key.pem",
"expiration_date_epoch": 1686558930,
"expiration_date_epoch_utc": 1686533730,
"expiration_date_iso": "2023-06-12T01:35:30+00:00"
}
]
}
$ certbot certificates | jc --certbot -p -r
{
"certificates": [
{
"name": "example.com",
"serial_number": "3f7axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"key_type": "RSA",
"domains": [
"example.com",
"www.example.com"
],
"expiration_date": "2023-05-11 01:33:10+00:00",
"validity": "63 days",
"certificate_path": "/etc/letsencrypt/live/example.com/chain.pem",
"private_key_path": "/etc/letsencrypt/live/example.com/priv.pem"
},
{
"name": "example.org",
"serial_number": "3bcyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
"key_type": "RSA",
"domains": [
"example.org",
"www.example.org"
],
"expiration_date": "2023-06-12 01:35:30+00:00",
"validity": "63 days",
"certificate_path": "/etc/letsencrypt/live/example.org/chain.pem",
"private_key_path": "/etc/letsencrypt/live/example.org/key.pem"
}
]
}
$ certbot show_account | jc --certbot -p
{
"account": {
"server": "https://acme-staging-v02.api.letsencrypt.org/directory",
"url": "https://acme-staging-v02.api.letsencrypt.org/acme/acct/123",
"email": "some@example.com"
}
}
<a id="jc.parsers.certbot.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
```
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
Source: [`jc/parsers/certbot.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/certbot.py)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,84 @@
[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
Source: [`jc/parsers/chage.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/chage.py)
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,14 +13,14 @@ Usage (cli):
$ cksum file.txt | jc --cksum
or
or
$ jc cksum file.txt
Usage (module):
import jc.parsers.cksum
result = jc.parsers.cksum.parse(cksum_command_output)
import jc
result = jc.parse('cksum', cksum_command_output)
Schema:
@@ -52,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
@@ -69,14 +67,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
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)
Source: [`jc/parsers/cksum.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/cksum.py)
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,201 @@
[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[Dict[str, Any]]
```
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
Source: [`jc/parsers/clf.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/clf.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,120 @@
[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
def parse(
data: Iterable[str],
raw: bool = False,
quiet: bool = False,
ignore_exceptions: bool = False
) -> Iterator[Union[Dict[str, Any], Tuple[BaseException, str]]]
```
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
Source: [`jc/parsers/clf_s.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/clf_s.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,10 @@
[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 file parser
jc - JSON Convert `crontab -l` command output and crontab
file parser
Supports `crontab -l` command output and crontab files.
@@ -9,14 +12,14 @@ Usage (cli):
$ crontab -l | jc --crontab
or
or
$ jc crontab -l
Usage (module):
import jc.parsers.crontab
result = jc.parsers.crontab.parse(crontab_output)
import jc
result = jc.parse('crontab', crontab_output)
Schema:
@@ -29,7 +32,6 @@ Schema:
],
"schedule": [
{
"occurrence" string,
"minute": [
string
],
@@ -170,16 +172,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
@@ -187,14 +185,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
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)
Source: [`jc/parsers/crontab.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/crontab.py)
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,9 +1,13 @@
[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 file parser
This version of the `crontab -l` parser supports output that contains user information for processes.
jc - JSON Convert `crontab -l` command output and crontab
file parser
This version of the `crontab -l` parser supports output that contains user
information for processes.
Usage (cli):
@@ -11,8 +15,8 @@ Usage (cli):
Usage (module):
import jc.parsers.crontab_u
result = jc.parsers.crontab_u.parse(crontab_u_output)
import jc
result = jc.parse('crontab_u', crontab_u_output)
Schema:
@@ -25,7 +29,6 @@ Schema:
],
"schedule": [
{
"occurrence" string,
"minute": [
string
],
@@ -55,7 +58,7 @@ Examples:
"variables": [
{
"name": "PATH",
"value": "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
"value": "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sb..."
},
{
"name": "SHELL",
@@ -80,7 +83,7 @@ Examples:
"*"
],
"user": "root",
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )"
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
},
{
"minute": [
@@ -99,7 +102,7 @@ Examples:
"7"
],
"user": "root",
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )"
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
},
{
"minute": [
@@ -118,7 +121,7 @@ Examples:
"*"
],
"user": "root",
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )"
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
}
]
}
@@ -128,7 +131,7 @@ Examples:
"variables": [
{
"name": "PATH",
"value": "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
"value": "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/..."
},
{
"name": "SHELL",
@@ -143,7 +146,7 @@ Examples:
"month": "*",
"day_of_week": "*",
"user": "root",
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )"
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
},
{
"minute": "47",
@@ -152,7 +155,7 @@ Examples:
"month": "*",
"day_of_week": "7",
"user": "root",
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )"
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
},
{
"minute": "52",
@@ -161,21 +164,17 @@ Examples:
"month": "*",
"day_of_week": "*",
"user": "root",
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )"
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
}
]
}
<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
@@ -183,14 +182,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
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)
Source: [`jc/parsers/crontab_u.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/crontab_u.py)
Version 1.10 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,9 +1,13 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.csv"></a>
# jc.parsers.csv
jc - JSON CLI output utility `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. The first row of the file must be a header row.
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.
The first row of the file must be a header row.
Usage (cli):
@@ -11,12 +15,13 @@ Usage (cli):
Usage (module):
import jc.parsers.csv
result = jc.parsers.csv.parse(csv_output)
import jc
result = jc.parse('csv', 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
[
{
@@ -28,7 +33,7 @@ Schema:
Examples:
$ cat homes.csv
"Sell", "List", "Living", "Rooms", "Beds", "Baths", "Age", "Acres", "Taxes"
"Sell", "List", "Living", "Rooms", "Beds", "Baths", "Age", "Acres"...
142, 160, 28, 10, 5, 3, 60, 0.28, 3167
175, 180, 18, 8, 4, 1, 12, 0.43, 4033
129, 132, 13, 6, 3, 1, 41, 0.33, 1471
@@ -72,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[Dict[str, Any]]
```
Main text parsing function
@@ -89,14 +92,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
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)
Source: [`jc/parsers/csv.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/csv.py)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,13 +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
> This streaming parser outputs JSON Lines
jc - JSON Convert `csv` file streaming parser
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.
> This streaming parser outputs JSON Lines (cli) or returns an Iterable of
> Dictionaries (module)
Note: The first 100 rows are read into memory to enable delimiter detection, then the rest of the rows are loaded lazily.
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.
Usage (cli):
@@ -15,71 +21,70 @@ Usage (cli):
Usage (module):
import jc.parsers.csv_s
result = jc.parsers.csv_s.parse(csv_output.splitlines()) # result is an iterable object
import jc
result = jc.parse('csv_s', 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,
"_jc_meta": # This object only exists if using -qq or ignore_exceptions=True
{
"success": boolean, # true if successfully parsed, false if error
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
# 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:
$ cat homes.csv
"Sell", "List", "Living", "Rooms", "Beds", "Baths", "Age", "Acres", "Taxes"
"Sell", "List", "Living", "Rooms", "Beds", "Baths", "Age", "Acres"...
142, 160, 28, 10, 5, 3, 60, 0.28, 3167
175, 180, 18, 8, 4, 1, 12, 0.43, 4033
129, 132, 13, 6, 3, 1, 41, 0.33, 1471
...
$ cat homes.csv | jc --csv-s
{"Sell":"142","List":"160","Living":"28","Rooms":"10","Beds":"5","Baths":"3","Age":"60","Acres":"0.28","Taxes":"3167"}
{"Sell":"175","List":"180","Living":"18","Rooms":"8","Beds":"4","Baths":"1","Age":"12","Acres":"0.43","Taxes":"4033"}
{"Sell":"129","List":"132","Living":"13","Rooms":"6","Beds":"3","Baths":"1","Age":"41","Acres":"0.33","Taxes":"1471"}
{"Sell":"142","List":"160","Living":"28","Rooms":"10","Beds":"5"...}
{"Sell":"175","List":"180","Living":"18","Rooms":"8","Beds":"4"...}
{"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)
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:
data: (iterable) line-based text data to parse (e.g. sys.stdin or str.splitlines())
raw: (boolean) output preprocessed JSON if True
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
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)
Source: [`jc/parsers/csv_s.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/csv_s.py)
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

309
docs/parsers/curl_head.md Normal file
View File

@@ -0,0 +1,309 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.curl_head"></a>
# jc.parsers.curl_head
jc - JSON Convert `curl --head` command output parser
This parser converts standard and verbose `curl --head` output.
When converting verbose output from `curl` (to gather request headers, for
example) you will need to redirect STDERR to STDOUT with `2>&1`. The magic
syntax will not work in this case.
Usage (cli):
$ curl --head www.example.com | jc --curl-head
$ curl -Ivs www.example.com 2>&1 | jc --curl-head
or
$ jc curl --head www.example.com
Usage (module):
import jc
result = jc.parse('curl_head', curl_head_command_output)
Schema:
[
{
"_type": string, # request or response
"_request_method": string,
"_request_uri": string,
"_request_version": string,
"_response_version": string,
"_response_status": integer,
"_response_reason": string or null,
"<header>": string,
# well-known headers:
"accept": [
string
],
"accept-ch": [
string
],
"accept-ch-lifetime": integer,
"accept-encoding": [
string
],
"accept-language": [
string
],
"accept-patch": [
string
],
"accept-post": [
string
],
"accept-ranges": [
string
],
"access-control-allow-headers": [
string
],
"access-control-allow-methods": [
string
],
"access-control-expose-headers": [
string
],
"access-control-max-age": integer,
"access-control-request-headers": [
string
],
"age": integer,
"allow": [
string
],
"alt-svc": [
string
],
"cache-control": [
string
],
"clear-site-data": [
string
],
"connection": [
string
],
"content-encoding": [
string
],
"content-dpr": integer,
"content-language": [
string
],
"content-length": integer,
"content-security-policy": [
string
],
"content-security-policy-report-only": [
string
],
"cookie": [
string
],
"critical-ch": [
string
],
"date": string,
"date_epoch_utc": integer,
"expect-ct": [
string
],
"expires": string,
"expires_epoch_utc": integer,
"device-memory": integer,
"downlink": integer,
"dpr": integer,
"forwarded": [
string
],
"if-match": [
string
],
"if-modified-since": string,
"if-modified-since_epoch_utc": integer,
"if-none-match": [
string
],
"if-range": string,
"if-range_epoch_utc": integer,
"if-unmodified-since": string,
"if-unmodified-since_epoch_utc": integer,
"im": [
string
],
"keep-alive": [
string
],
"large-allocation": integer,
"last-modified": string,
"last-modified_epoch_utc": integer,
"link": [
string
],
"max-forwards": integer,
"memento-datetime": string,
"memento-datetime_epoch_utc": integer,
"permissions-policy": [
string
],
"permissions-policy-report-only": [
string
],
"pragma": [
string
],
"proxy-authenticate": [
string
],
"reporting-endpoints": [
string
],
"retry-after": string,
"retry-after_epoch_utc": integer,
"rtt": integer,
"sec-ch-ua": [
string
],
"sec-ch-ua-full-version-list": [
string
],
"server": [
string
],
"server-timing": [
string
],
"set-cookie": [
string
],
"timing-allow-origin": [
string
],
"trailer": [
string
],
"transfer-encoding": [
string
],
"upgrade": [
string
],
"upgrade-insecure-requests": integer,
"vary": [
string
],
"via": [
string
],
"warning": [
string
],
"www-authenticate": [
string
],
"x-cache-hits": [
integer
],
"x-content-duration": float
}
]
Examples:
$ curl --head www.example.com | jc --curl-head -p
[
{
"_type": "response",
"_response_version": "HTTP/1.1",
"_response_status": 200,
"_response_reason": [
"OK"
],
"accept-ranges": [
"bytes"
],
"age": 241144,
"cache-control": [
"max-age=604800"
],
"content-type": "text/html; charset=UTF-8",
"date": "Sun, 04 Feb 2024 23:26:29 GMT",
"etag": "\"3147526947\"",
"expires": "Sun, 11 Feb 2024 23:26:29 GMT",
"last-modified": "Thu, 17 Oct 2019 07:18:26 GMT",
"server": [
"ECS (sac/2508)"
],
"x-cache": "HIT",
"content-length": 1256,
"date_epoch_utc": 1707089189,
"expires_epoch_utc": 1707693989,
"last-modified_epoch_utc": 1571296706
}
]
$ curl --head www.example.com | jc --curl-head -p -r
[
{
"_type": "response",
"_response_version": "HTTP/1.1",
"_response_status": 200,
"_response_reason": [
"OK"
],
"accept-ranges": [
"bytes"
],
"age": "225102",
"cache-control": [
"max-age=604800"
],
"content-type": "text/html; charset=UTF-8",
"date": "Sun, 04 Feb 2024 23:28:17 GMT",
"etag": "\"3147526947\"",
"expires": "Sun, 11 Feb 2024 23:28:17 GMT",
"last-modified": "Thu, 17 Oct 2019 07:18:26 GMT",
"server": [
"ECS (sac/2575)"
],
"x-cache": "HIT",
"content-length": "1256"
}
]
<a id="jc.parsers.curl_head.parse"></a>
### parse
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[Dict[str, Any]]
```
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
Source: [`jc/parsers/curl_head.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/curl_head.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,24 +1,28 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.date"></a>
# jc.parsers.date
jc - JSON CLI output utility `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)
jc - JSON Convert `date` command output parser
The `epoch_utc` calculated timestamp field is timezone-aware and is only available if the timezone field is UTC.
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):
$ date | jc --date
or
or
$ jc date
Usage (module):
import jc.parsers.date
result = jc.parsers.date.parse(date_command_output)
import jc
result = jc.parse('date', date_command_output)
Schema:
@@ -35,15 +39,19 @@ Schema:
"second": integer,
"period": string,
"timezone": string,
"utc_offset": string, # null if timezone field is not UTC
"utc_offset": string, # null if timezone field is not UTC
"day_of_year": integer,
"week_of_year": integer,
"iso": string,
"epoch": integer, # naive timestamp
"epoch_utc": integer, # timezone-aware timestamp. Only available if timezone field is UTC
"timezone_aware": boolean # if true, all fields are correctly based on UTC
"epoch": integer, # [0]
"epoch_utc": integer, # [1]
"timezone_aware": boolean # [2]
}
[0] naive timestamp
[1] timezone-aware timestamp. Only available if timezone field is UTC
[2] if true, all fields are correctly based on UTC
Examples:
$ date | jc --date -p
@@ -69,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
@@ -86,14 +90,18 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, darwin, freebsd
Version 2.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
Source: [`jc/parsers/date.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/date.py)
This parser can be used with the `--slurp` command-line option.
Version 2.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -0,0 +1,95 @@
[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
Source: [`jc/parsers/datetime_iso.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/datetime_iso.py)
This parser can be used with the `--slurp` command-line option.
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -0,0 +1,107 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.debconf_show"></a>
# jc.parsers.debconf_show
jc - JSON Convert `debconf-show` command output parser
Usage (cli):
$ debconf-show onlyoffice-documentserver | jc --debconf-show
or
$ jc debconf-show onlyoffice-documentserver
Usage (module):
import jc
result = jc.parse('debconf_show', debconf_show_command_output)
Schema:
[
{
"asked": boolean,
"packagename": string,
"name": string,
"value": string
}
]
Examples:
$ debconf-show onlyoffice-documentserver | jc --debconf-show -p
[
{
"asked": true,
"packagename": "onlyoffice",
"name": "jwt_secret",
"value": "aL8ei2iereuzee7cuJ6Cahjah1ixee2ah"
},
{
"asked": false,
"packagename": "onlyoffice",
"name": "db_pwd",
"value": "(password omitted)"
},
{
"asked": true,
"packagename": "onlyoffice",
"name": "rabbitmq_pwd",
"value": "(password omitted)"
},
{
"asked": true,
"packagename": "onlyoffice",
"name": "db_port",
"value": "5432"
},
{
"asked": true,
"packagename": "onlyoffice",
"name": "db_user",
"value": "onlyoffice"
},
{
"asked": true,
"packagename": "onlyoffice",
"name": "rabbitmq_proto",
"value": "amqp"
},
{
"asked": true,
"packagename": "onlyoffice",
"name": "cluster_mode",
"value": "false"
}
]
<a id="jc.parsers.debconf_show.parse"></a>
### parse
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[Dict[str, Any]]
```
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
Source: [`jc/parsers/debconf_show.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/debconf_show.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,27 +1,31 @@
[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
Values are normalized to bytes when using `df -h`.
Usage (cli):
$ df | jc --df
or
or
$ jc df
Usage (module):
import jc.parsers.df
result = jc.parsers.df.parse(df_command_output)
import jc
result = jc.parse('df', df_command_output)
Schema:
[
{
"filesystem": string,
"size": string,
"size": integer,
"1k_blocks": integer,
"512_blocks": integer,
"used": integer,
@@ -95,16 +99,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
@@ -112,14 +112,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
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)
Source: [`jc/parsers/df.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/df.py)
Version 2.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,28 +1,34 @@
[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 information is desired.
- `+noall +answer` options are supported in cases where only the answer
information is desired.
- `+axfr` option is supported on its own
- `+nsid` option is supported
The `when_epoch` calculated timestamp field is naive (i.e. based on the local time of the system the parser is run on)
The `when_epoch` calculated timestamp field is naive. (i.e. based on the
local time of the system the parser is run on)
The `when_epoch_utc` calculated timestamp field is timezone-aware and is only available if the timezone field is UTC.
The `when_epoch_utc` calculated timestamp field is timezone-aware and is
only available if the timezone field is UTC.
Usage (cli):
$ dig example.com | jc --dig
or
or
$ jc dig example.com
Usage (module):
import jc.parsers.dig
result = jc.parsers.dig.parse(dig_command_output)
import jc
result = jc.parse('dig', dig_command_output)
Schema:
@@ -93,13 +99,16 @@ Schema:
"query_time": integer, # in msec
"server": string,
"when": string,
"when_epoch": integer, # naive timestamp if when field is parsable, else null
"when_epoch_utc": integer, # timezone aware timestamp availabe for UTC, else null
"when_epoch": integer, # [0]
"when_epoch_utc": integer, # [1]
"rcvd": integer
"size": string
}
]
[0] naive timestamp if "when" field is parsable, else null
[1] timezone aware timestamp available for UTC, else null
Examples:
$ dig example.com | jc --dig -p
@@ -314,16 +323,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
@@ -331,14 +336,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
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)
Source: [`jc/parsers/dig.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/dig.py)
Version 2.5 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`
@@ -9,18 +11,20 @@ Options supported:
- `/C, /-C`
- `/S`
The "Magic" syntax is not supported since the `dir` command is a shell builtin.
The "Magic" syntax is not supported since the `dir` command is a shell
builtin.
The `epoch` calculated timestamp field is naive (i.e. based on the local time of the system the parser is run on)
The `epoch` calculated timestamp field is naive. (i.e. based on the local
time of the system the parser is run on)
Usage (cli):
C:> dir | jc --dir
C:\> dir | jc --dir
Usage (module):
import jc.parsers.dir
result = jc.parsers.dir.parse(dir_command_output)
import jc
result = jc.parse('dir', dir_command_output)
Schema:
@@ -38,7 +42,7 @@ Schema:
Examples:
C:> dir | jc --dir -p
C:\> dir | jc --dir -p
[
{
"date": "03/24/2021",
@@ -46,7 +50,7 @@ Examples:
"dir": true,
"size": null,
"filename": ".",
"parent": "C:\Program Files\Internet Explorer",
"parent": "C:\\Program Files\\Internet Explorer",
"epoch": 1616624100
},
{
@@ -55,7 +59,7 @@ Examples:
"dir": true,
"size": null,
"filename": "..",
"parent": "C:\Program Files\Internet Explorer",
"parent": "C:\\Program Files\\Internet Explorer",
"epoch": 1616624100
},
{
@@ -64,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
},
{
@@ -73,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",
@@ -87,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",
@@ -95,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",
@@ -103,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",
@@ -111,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
@@ -133,14 +133,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: win32
Version 1.4 by Rasheed Elsaleh (rasheed@rebelliondefense.com)
Source: [`jc/parsers/dir.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/dir.py)
Version 1.6 by Rasheed Elsaleh (rasheed@rebelliondefense.com)

View File

@@ -1,20 +1,22 @@
[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
Usage (module):
import jc.parsers.dmidecode
result = jc.parsers.dmidecode.parse(dmidecode_command_output)
import jc
result = jc.parse('dmidecode', dmidecode_command_output)
Schema:
@@ -24,7 +26,7 @@ Schema:
"type": integer,
"bytes": integer,
"description": string,
"values": { (null if empty)
"values": { # null if empty
"lowercase_no_spaces_keys": string,
"multiline_key_values": [
string,
@@ -123,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
@@ -140,14 +138,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Source: [`jc/parsers/dmidecode.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/dmidecode.py)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,9 +1,12 @@
[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
Set the `COLUMNS` environment variable to a large value to avoid field truncation. For example:
jc - JSON Convert `dpkg -l` command output parser
Set the `COLUMNS` environment variable to a large value to avoid field
truncation. For example:
$ COLUMNS=500 dpkg -l | jc --dpkg-l
@@ -11,14 +14,14 @@ Usage (cli):
$ dpkg -l | jc --dpkg-l
or
or
$ jc dpkg -l
Usage (module):
import jc.parsers.dpkg_l
result = jc.parsers.dpkg_l.parse(dpkg_command_output)
import jc
result = jc.parse('dpkg_l', dpkg_command_output)
Schema:
@@ -72,7 +75,7 @@ Examples:
"name": "acpid",
"version": "1:2.0.28-1ubuntu1",
"architecture": "amd64",
"description": "Advanced Configuration and Power Interface event daemon",
"description": "Advanced Configuration and Power Interface...",
"desired": "remove",
"status": "half installed"
},
@@ -116,7 +119,7 @@ Examples:
"name": "acpid",
"version": "1:2.0.28-1ubuntu1",
"architecture": "amd64",
"description": "Advanced Configuration and Power Interface event daemon"
"description": "Advanced Configuration and Power Interface..."
},
{
"codes": "pn",
@@ -128,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
@@ -145,14 +144,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
Source: [`jc/parsers/dpkg_l.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/dpkg_l.py)
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,20 +1,26 @@
[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
Usage (module):
import jc.parsers.du
result = jc.parsers.du.parse(du_command_output)
import jc
result = jc.parse('du', du_command_output)
Schema:
@@ -35,23 +41,23 @@ Examples:
},
{
"size": 56,
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/Contents/_CodeSignature"
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
},
{
"size": 0,
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/Contents/Resources/Firmware/usr/local/standalone"
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
},
{
"size": 0,
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/Contents/Resources/Firmware/usr/local"
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
},
{
"size": 0,
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/Contents/Resources/Firmware/usr"
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
},
{
"size": 1008,
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/Contents/Resources/Firmware/dfu"
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
},
...
]
@@ -64,37 +70,33 @@ Examples:
},
{
"size": "56",
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/Contents/_CodeSignature"
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
},
{
"size": "0",
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/Contents/Resources/Firmware/usr/local/standalone"
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
},
{
"size": "0",
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/Contents/Resources/Firmware/usr/local"
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
},
{
"size": "0",
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/Contents/Resources/Firmware/usr"
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
},
{
"size": "1008",
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/Contents/Resources/Firmware/dfu"
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
},
...
]
<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
@@ -102,14 +104,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
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)
Source: [`jc/parsers/du.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/du.py)
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

104
docs/parsers/efibootmgr.md Normal file
View File

@@ -0,0 +1,104 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.efibootmgr"></a>
# jc.parsers.efibootmgr
jc - JSON Convert `efibootmgr` command output parser
The `-v` option is also supported.
Usage (cli):
$ sudo efibootmgr | jc --efibootmgr
$ sudo efibootmgr -v | jc --efibootmgr
or
$ sudo jc efibootmgr
Usage (module):
import jc
result = jc.parse('efibootmgr', efibootmgr_command_output)
Schema:
{
"boot_current": string,
"timeout_seconds": integer,
"boot_order": [
string
],
mirrored_percentage_above_4g: float,
mirror_memory_below_4gb: boolean,
"boot_options": [
{
"boot_option_reference": string,
"display_name": string,
"uefi_device_path": string,
"boot_option_enabled": boolean
}
]
}
Examples:
$ sudo efibootmgr -v | jc --efibootmgr --p
{
"boot_current": "0002",
"timeout_seconds": 0,
"boot_order": [
"0002",
"0000",
"0001"
],
"mirrored_percentage_above_4g": 0.0,
"mirror_memory_below_4gb": false,
"boot_options": [
{
"boot_option_reference": "Boot0000",
"display_name": "WARNADO",
"uefi_device_path": "HD(1,GPT,05b9944c-1c60-492b-a510-7bbedccdc...",
"boot_option_enabled": true
},
{
"boot_option_reference": "Boot0001",
"display_name": "Embedded NIC 1 Port 1 Partition 1",
"uefi_device_path": "VenHw(3a191845-5f86-4e78-8fce-c4cff59f9daa)",
"boot_option_enabled": true
},
{
"boot_option_reference": "Boot0002",
"display_name": "opensuse-secureboot",
"uefi_device_path": "HD(1,GPT,c5d4f69d-6fc2-48c7-acee-af3f30336...",
"boot_option_enabled": true
}
]
}
<a id="jc.parsers.efibootmgr.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
```
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
Source: [`jc/parsers/efibootmgr.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/efibootmgr.py)
Version 1.0 by Yaofei Zheng (zyf26256@gmail.com, Yaofei.Zheng@dell.com)

View File

@@ -0,0 +1,71 @@
[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
Source: [`jc/parsers/email_address.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/email_address.py)
This parser can be used with the `--slurp` command-line option.
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,22 +1,27 @@
[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
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 `-r` command-line option or the `raw=True` argument in the `parse()` function.
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
`-r` command-line option or the `raw=True` argument in the `parse()`
function.
Usage (cli):
$ env | jc --env
or
or
$ jc env
Usage (module):
import jc.parsers.env
result = jc.parsers.env.parse(env_command_output)
import jc
result = jc.parse('env', env_command_output)
Schema:
@@ -67,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
@@ -84,15 +85,17 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary of raw structured data or
List of Dictionaries of processed structured data
Dictionary of raw structured data or (default)
List of Dictionaries of processed structured data (raw)
## Parser Information
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Source: [`jc/parsers/env.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/env.py)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

197
docs/parsers/ethtool.md Normal file
View File

@@ -0,0 +1,197 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ethtool"></a>
# jc.parsers.ethtool
jc - JSON Convert `ethtool` command output parser
Supports standard `ethtool` output and the `--module-info` option.
Usage (cli):
$ ethtool <interface> | jc --ethtool
$ ethtool --module-info <interface> | jc --ethtool
or
$ jc ethtool <interface>
$ jc ethtool --module-info <interface>
Usage (module):
import jc
result = jc.parse('ethtool', ethtool_command_output)
Schema:
Note: many units fields are converted to integers and floats
when detected. Use raw output for the original string values.
{
"name": string,
"supported_ports": [
string
],
"supported_link_modes": [
string
],
"supported_pause_frame_use": string,
"supports_auto_negotiation": boolean,
"supported_fec_modes": [
string
],
"advertised_link_modes": [
string
],
"advertised_pause_frame_use": boolean,
"advertised_auto_negotiation": boolean,
"advertised_fec_modes": [
string
],
"speed": string,
"speed_bps": integer,
"duplex": string,
"auto_negotiation": boolean,
"port": string,
"phyad": string,
"mdi_x": string,
"transceiver": string,
"supports_wake_on": string,
"wake_on": string,
"current_message_level": [
string
],
"link_detected": boolean,
"identifier": string,
"extended_identifier": string,
"connector": string,
"transceiver_codes": string,
"transceiver_type": [
string
],
"encoding": string,
"br_nominal": string,
"rate_identifier": string,
"length_smf_km": string,
"length_smf": string,
"length_50um": string,
"length_62_5um": string,
"length_copper": string,
"length_om3": string,
"passive_cu_cmplnce": string,
"vendor_name": string,
"vendor_oui": string,
"vendor_pn": string,
"vendor_rev": string,
"option_values": string,
"br_margin_max": string,
"br_margin_min": string
}
Examples:
$ ethtool enp0s3 | jc --ethtool -p
{
"name": "enp0s3",
"supported_pause_frame_use": "No",
"supports_auto_negotiation": true,
"supported_fec_modes": "Not reported",
"advertised_pause_frame_use": false,
"advertised_auto_negotiation": true,
"advertised_fec_modes": "Not reported",
"speed": "1000Mb/s",
"duplex": "Full",
"port": "Twisted Pair",
"phyad": "0",
"transceiver": "internal",
"auto_negotiation": false,
"mdi_x": "off (auto)",
"supports_wake_on": "umbg",
"wake_on": "d",
"link_detected": true,
"supported_ports": [
"TP"
],
"supported_link_modes": [
"10baseT/Half",
"10baseT/Full",
"100baseT/Half",
"100baseT/Full",
"1000baseT/Full"
],
"advertised_link_modes": [
"10baseT/Half",
"10baseT/Full",
"100baseT/Half",
"100baseT/Full",
"1000baseT/Full"
],
"current_message_level": [
"0x00000007 (7)",
"drv probe link"
],
"speed_bps": 1000000000
}
$ ethtool --module-info enp0s3 | jc --ethtool -p
{
"identifier": "0x03 (SFP)",
"extended_identifier": "0x04 (GBIC/SFP defined by 2-wire interface ID)",
"connector": "0x21 (Copper pigtail)",
"transceiver_codes": "0x01 0x00 0x00 0x04 0x00 0x04 0x80 0xd5 0x00",
"transceiver_type": [
"Infiniband: 1X Copper Passive",
"Ethernet: 1000BASE-CX",
"Passive Cable",
"FC: Twin Axial Pair (TW)",
"FC: 1200 MBytes/sec",
"FC: 800 MBytes/sec",
"FC: 400 MBytes/sec",
"FC: 200 MBytes/sec",
"FC: 100 MBytes/sec"
],
"encoding": "0x00 (unspecified)",
"br_nominal": "10300MBd",
"rate_identifier": "0x00 (unspecified)",
"length_smf_km": "0km",
"length_smf": "0m",
"length_50um": "0m",
"length_62_5um": "0m",
"length_copper": "2m",
"length_om3": "0m",
"passive_cu_cmplnce": "0x01 (SFF-8431 appendix E) [SFF-8472 rev10.4 only]",
"vendor_name": "UbiquitiNetworks",
"vendor_oui": "00:40:20",
"vendor_pn": "UDC-2",
"vendor_rev": "",
"option_values": "0x00 0x00",
"br_margin_max": "0%",
"br_margin_min": "0%"
}
<a id="jc.parsers.ethtool.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
```
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
Source: [`jc/parsers/ethtool.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ethtool.py)
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,27 +1,29 @@
[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 *
Usage (module):
import jc.parsers.file
result = jc.parsers.file.parse(file_command_output)
import jc
result = jc.parse('file', file_command_output)
Schema:
[
{
"filename": string,
"type ": string
"type": string
}
]
@@ -51,25 +53,21 @@ Examples:
},
{
"filename": "cd_catalog.xml",
"type": "XML 1.0 document text, ASCII text, with CRLF line terminators"
"type": "XML 1.0 document text, ASCII text, with CRLF line ..."
},
{
"filename": "centosserial.sh",
"type": "Bourne-Again shell script text executable, UTF-8 Unicode text"
"type": "Bourne-Again shell script text executable, UTF-8 ..."
},
...
]
<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
@@ -77,14 +75,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, aix, freebsd, darwin
Source: [`jc/parsers/file.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/file.py)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

84
docs/parsers/find.md Normal file
View File

@@ -0,0 +1,84 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.find"></a>
# jc.parsers.find
jc - JSON Convert `find` command output parser
This parser returns a list of objects by default and a list of strings if
the `--raw` option is used.
Usage (cli):
$ find | jc --find
Usage (module):
import jc
result = jc.parse('find', find_command_output)
Schema:
[
{
"path": string,
"node": string,
"error": string
}
]
Examples:
$ find | jc --find -p
[
{
"path": "./directory"
"node": "filename"
},
{
"path": "./anotherdirectory"
"node": "anotherfile"
},
{
"path": null
"node": null
"error": "find: './inaccessible': Permission denied"
}
...
]
$ find | jc --find -p -r
[
"./templates/readme_template",
"./templates/manpage_template",
"./.github/workflows/pythonapp.yml",
...
]
<a id="jc.parsers.find.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:
List of raw strings or
List of Dictionaries of processed structured data
### Parser Information
Compatibility: linux
Source: [`jc/parsers/find.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/find.py)
Version 1.0 by Solomon Leang (solomonleang@gmail.com)

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

@@ -0,0 +1,119 @@
[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[Dict[str, Any]]
```
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
Source: [`jc/parsers/findmnt.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/findmnt.py)
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,14 +11,14 @@ Usage (cli):
$ finger | jc --finger
or
or
$ jc finger
Usage (module):
import jc.parsers.finger
result = jc.parsers.finger.parse(finger_command_output)
import jc
result = jc.parse('finger', finger_command_output)
Schema:
@@ -88,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
@@ -105,14 +103,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, darwin, cygwin, freebsd
Source: [`jc/parsers/finger.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/finger.py)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,32 +1,36 @@
[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
Values are normalized to bytes when using `free -h`.
Usage (cli):
$ free | jc --free
or
or
$ jc free
Usage (module):
import jc.parsers.free
result = jc.parsers.free.parse(free_command_output)
import jc
result = jc.parse('free', free_command_output)
Schema:
[
{
"type": string,
"total": integer,
"used": integer,
"free": integer,
"shared": integer,
"buff_cache": integer,
"available": integer
"type": string,
"total": integer,
"used": integer,
"free": integer,
"shared": integer,
"buff_cache": integer,
"available": integer
}
]
@@ -70,16 +74,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
@@ -87,14 +87,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
Source: [`jc/parsers/free.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/free.py)
Version 1.8 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):
@@ -9,8 +11,8 @@ Usage (cli):
Usage (module):
import jc.parsers.fstab
result = jc.parsers.fstab.parse(fstab_command_output)
import jc
result = jc.parse('fstab', fstab_command_output)
Schema:
@@ -83,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
@@ -100,14 +98,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
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)
Source: [`jc/parsers/fstab.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/fstab.py)
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,247 @@
[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
],
"file_stats": [
{
"name": string,
"lines_changed": integer
}
]
}
}
]
[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"
],
"file_stats": [
{
"name": "docs/parsers/git_log.md",
"lines_changed": 3
},
{
"name": "jc/parsers/git_log.py",
"lines_changed": 7
}
]
},
"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"
],
"file_stats": [
{
"name": "docs/parsers/git_log.md",
"lines_changed": 3
},
{
"name": "docs/utils.md",
"lines_changed": 7
},
{
"name": "jc/parsers/git_log.py",
"lines_changed": 1
},
{
"name": "jc/utils.py",
"lines_changed": 12
},
{
"name": "man/jc.1",
"lines_changed": 14
}
]
},
"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"
],
"file_stats": [
{
"name": "docs/parsers/git_log.md",
"lines_changed": "3"
},
{
"name": "jc/parsers/git_log.py",
"lines_changed": "7"
}
]
},
"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"
],
"file_stats": [
{
"name": "docs/parsers/git_log.md",
"lines_changed": "3"
},
{
"name": "docs/utils.md",
"lines_changed": "7"
},
{
"name": "jc/parsers/git_log.py",
"lines_changed": "1"
},
{
"name": "jc/utils.py",
"lines_changed": "12"
},
{
"name": "man/jc.1",
"lines_changed": "14"
}
]
},
"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
Source: [`jc/parsers/git_log.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/git_log.py)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,118 @@
[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
],
"file_stats": [
{
"name": string,
"lines_changed": integer
}
]
}
# 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
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
Source: [`jc/parsers/git_log_s.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/git_log_s.py)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -0,0 +1,94 @@
[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[Dict[str, Any], List[Dict[str, Any]]]
```
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
Source: [`jc/parsers/git_ls_remote.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/git_ls_remote.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,147 @@
[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
Source: [`jc/parsers/gpg.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/gpg.py)
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):
@@ -9,8 +11,8 @@ Usage (cli):
Usage (module):
import jc.parsers.group
result = jc.parsers.group.parse(group_file_output)
import jc
result = jc.parse('group', group_file_output)
Schema:
@@ -107,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
@@ -124,14 +122,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
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)
Source: [`jc/parsers/group.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/group.py)
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):
@@ -9,8 +11,8 @@ Usage (cli):
Usage (module):
import jc.parsers.gshadow
result = jc.parsers.gshadow.parse(gshadow_file_output)
import jc
result = jc.parse('gshadow', gshadow_file_output)
Schema:
@@ -75,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
@@ -92,14 +90,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, aix, freebsd
Source: [`jc/parsers/gshadow.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/gshadow.py)
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):
@@ -9,8 +11,8 @@ Usage (cli):
Usage (module):
import jc.parsers.hash
result = jc.parsers.hash.parse(hash_command_output)
import jc
result = jc.parse('hash', hash_command_output)
Schema:
@@ -35,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
@@ -52,14 +50,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
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)
Source: [`jc/parsers/hash.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/hash.py)
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,14 +19,14 @@ Usage (cli):
$ md5sum file.txt | jc --hashsum
or
or
$ jc md5sum file.txt
Usage (module):
import jc.parsers.hashsum
result = jc.parsers.hashsum.parse(md5sum_command_output)
import jc
result = jc.parse('hashsum', md5sum_command_output)
Schema:
@@ -66,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
@@ -83,14 +81,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Source: [`jc/parsers/hashsum.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/hashsum.py)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,20 +1,22 @@
[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
Usage (module):
import jc.parsers.hciconfig
result = jc.parsers.hciconfig.parse(hciconfig_command_output)
import jc
result = jc.parse('hciconfig', hciconfig_command_output)
Schema:
@@ -315,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
@@ -332,14 +330,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
Source: [`jc/parsers/hciconfig.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/hciconfig.py)
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,11 +1,17 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.history"></a>
# jc.parsers.history
jc - JSON CLI output utility `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 `-r` command-line option or the `raw=True` argument in the `parse()` function.
jc - JSON Convert `history` command output parser
The "Magic" syntax is not supported since the `history` command is a shell builtin.
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
`-r` command-line option or the `raw=True` argument in the `parse()`
function.
The "Magic" syntax is not supported since the `history` command is a shell
builtin.
Usage (cli):
@@ -13,8 +19,8 @@ Usage (cli):
Usage (module):
import jc.parsers.history
result = jc.parsers.history.parse(history_command_output)
import jc
result = jc.parse('history', history_command_output)
Schema:
@@ -39,7 +45,7 @@ Examples:
},
{
"line": 120,
"command": "echo "hello""
"command": "echo \"hello\""
},
{
"line": 121,
@@ -52,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
@@ -74,7 +76,7 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
@@ -82,7 +84,9 @@ 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)
Source: [`jc/parsers/history.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/history.py)
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,115 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.host"></a>
# jc.parsers.host
jc - JSON Convert `host` command output parser
Supports parsing of the most commonly used RR types (A, AAAA, MX, TXT)
Usage (cli):
$ host google.com | jc --host
or
$ jc host google.com
Usage (module):
import jc
result = jc.parse('host', host_command_output)
Schema:
[
{
"hostname": string,
"address": [
string
],
"v6-address": [
string
],
"mail": [
string
]
}
]
[
{
"nameserver": string,
"zone": string,
"mname": string,
"rname": string,
"serial": integer,
"refresh": integer,
"retry": integer,
"expire": integer,
"minimum": integer
}
]
Examples:
$ host google.com | jc --host
[
{
"hostname": "google.com",
"address": [
"142.251.39.110"
],
"v6-address": [
"2a00:1450:400e:811::200e"
],
"mail": [
"smtp.google.com."
]
}
]
$ jc host -C sunet.se
[
{
"nameserver": "2001:6b0:7::2",
"zone": "sunet.se",
"mname": "sunic.sunet.se.",
"rname": "hostmaster.sunet.se.",
"serial": "2023090401",
"refresh": "28800",
"retry": "7200",
"expire": "604800",
"minimum": "300"
},
{
...
}
]
<a id="jc.parsers.host.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = 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:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Source: [`jc/parsers/host.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/host.py)
Version 1.0 by Pettai (pettai@sunet.se)

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):
@@ -9,8 +11,8 @@ Usage (cli):
Usage (module):
import jc.parsers.hosts
result = jc.parsers.hosts.parse(hosts_file_output)
import jc
result = jc.parse('hosts', hosts_file_output)
Schema:
@@ -72,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
@@ -89,14 +87,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Source: [`jc/parsers/hosts.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/hosts.py)
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -0,0 +1,336 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.http_headers"></a>
# jc.parsers.http_headers
jc - JSON Convert HTTP headers parser
Converts HTTP request and response headers into a list of dictionaries.
Well-known headers are processed to allow multiple instances which are
aggregated into an array along with any comma-separated values. Integer,
float, and datetimes are converted where defined in the specifications.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
https://datatracker.ietf.org/doc/html/rfc2616
https://datatracker.ietf.org/doc/html/rfc3229
https://datatracker.ietf.org/doc/html/rfc7089
https://datatracker.ietf.org/doc/html/rfc7231
https://datatracker.ietf.org/doc/html/rfc5789
If you are converting HTTP headers from `curl` verbose output, use the
`curl-head` parser which will strip the `>` and `<` characters and remove
non-header lines that begin with `*`.
Usage (cli):
$ cat headers.txt | jc --http-headers
Usage (module):
import jc
result = jc.parse('http_headers', http_headers_output)
Schema:
[
{
"_type": string, # request or response
"_request_method": string,
"_request_uri": string,
"_request_version": string,
"_response_version": string,
"_response_status": integer,
"_response_reason": string or null,
"<header>": string,
# well-known headers:
"accept": [
string
],
"accept-ch": [
string
],
"accept-ch-lifetime": integer,
"accept-encoding": [
string
],
"accept-language": [
string
],
"accept-patch": [
string
],
"accept-post": [
string
],
"accept-ranges": [
string
],
"access-control-allow-headers": [
string
],
"access-control-allow-methods": [
string
],
"access-control-expose-headers": [
string
],
"access-control-max-age": integer,
"access-control-request-headers": [
string
],
"age": integer,
"allow": [
string
],
"alt-svc": [
string
],
"cache-control": [
string
],
"clear-site-data": [
string
],
"connection": [
string
],
"content-encoding": [
string
],
"content-dpr": integer,
"content-language": [
string
],
"content-length": integer,
"content-security-policy": [
string
],
"content-security-policy-report-only": [
string
],
"cookie": [
string
],
"critical-ch": [
string
],
"date": string,
"date_epoch_utc": integer,
"expect-ct": [
string
],
"expires": string,
"expires_epoch_utc": integer,
"device-memory": integer,
"downlink": integer,
"dpr": integer,
"forwarded": [
string
],
"if-match": [
string
],
"if-modified-since": string,
"if-modified-since_epoch_utc": integer,
"if-none-match": [
string
],
"if-range": string,
"if-range_epoch_utc": integer,
"if-unmodified-since": string,
"if-unmodified-since_epoch_utc": integer,
"im": [
string
],
"keep-alive": [
string
],
"large-allocation": integer,
"last-modified": string,
"last-modified_epoch_utc": integer,
"link": [
string
],
"max-forwards": integer,
"memento-datetime": string,
"memento-datetime_epoch_utc": integer,
"permissions-policy": [
string
],
"permissions-policy-report-only": [
string
],
"pragma": [
string
],
"proxy-authenticate": [
string
],
"reporting-endpoints": [
string
],
"retry-after": string,
"retry-after_epoch_utc": integer,
"rtt": integer,
"sec-ch-ua": [
string
],
"sec-ch-ua-full-version-list": [
string
],
"server": [
string
],
"server-timing": [
string
],
"set-cookie": [
string
],
"timing-allow-origin": [
string
],
"trailer": [
string
],
"transfer-encoding": [
string
],
"upgrade": [
string
],
"upgrade-insecure-requests": integer,
"vary": [
string
],
"via": [
string
],
"warning": [
string
],
"www-authenticate": [
string
],
"x-cache-hits": [
integer
],
"x-content-duration": float
}
]
Examples:
$ cat headers.txt | jc --http-headers -p
[
{
"_type": "request",
"_request_method": "HEAD",
"_request_uri": "/",
"_request_version": "HTTP/1.1",
"host": "example.com",
"user-agent": "curl/8.1.2",
"accept": [
"*/*"
]
},
{
"_type": "response",
"_response_version": "HTTP/1.1",
"_response_status": 200,
"_response_reason": [
"OK"
],
"accept-ranges": [
"bytes"
],
"age": 140203,
"cache-control": [
"max-age=604800"
],
"content-type": "text/html; charset=UTF-8",
"date": "Sun, 04 Feb 2024 02:25:07 GMT",
"etag": "\"3147526947\"",
"expires": "Sun, 11 Feb 2024 02:25:07 GMT",
"last-modified": "Thu, 17 Oct 2019 07:18:26 GMT",
"server": [
"ECS (sac/252F)"
],
"x-cache": "HIT",
"content-length": 1256,
"date_epoch_utc": 1707013507,
"expires_epoch_utc": 1707618307,
"last-modified_epoch_utc": 1571296706
}
]
$ cat headers.txt | jc --http-headers -p -r
[
{
"_type": "request",
"_request_method": "HEAD",
"_request_uri": "/",
"_request_version": "HTTP/1.1",
"host": "example.com",
"user-agent": "curl/8.1.2",
"accept": [
"*/*"
]
},
{
"_type": "response",
"_response_version": "HTTP/1.1",
"_response_status": 200,
"_response_reason": [
"OK"
],
"accept-ranges": [
"bytes"
],
"age": "140203",
"cache-control": [
"max-age=604800"
],
"content-type": "text/html; charset=UTF-8",
"date": "Sun, 04 Feb 2024 02:25:07 GMT",
"etag": "\"3147526947\"",
"expires": "Sun, 11 Feb 2024 02:25:07 GMT",
"last-modified": "Thu, 17 Oct 2019 07:18:26 GMT",
"server": [
"ECS (sac/252F)"
],
"x-cache": "HIT",
"content-length": "1256"
}
]
<a id="jc.parsers.http_headers.parse"></a>
### parse
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[Dict[str, Any]]
```
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
Source: [`jc/parsers/http_headers.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/http_headers.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,20 +1,22 @@
[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
Usage (module):
import jc.parsers.id
result = jc.parsers.id.parse(id_command_output)
import jc
result = jc.parse('id', id_command_output)
Schema:
@@ -103,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
@@ -120,14 +118,18 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
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)
Source: [`jc/parsers/id.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/id.py)
This parser can be used with the `--slurp` command-line option.
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,61 +1,118 @@
[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
Usage (module):
import jc.parsers.ifconfig
result = jc.parsers.ifconfig.parse(ifconfig_command_output)
import jc
result = jc.parse('ifconfig', 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",
@@ -67,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[Dict[str, Any]]
```
Main text parsing function
@@ -201,14 +230,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
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)
Source: [`jc/parsers/ifconfig.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ifconfig.py)
Version 2.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,11 +1,22 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ini"></a>
# jc.parsers.ini
jc - JSON CLI output utility `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.
jc - JSON Convert INI file 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()`.
Parses standard INI files.
- 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.
- If any section names have the same name as a top-level key, the top-level
key will be overwritten by the section data.
> 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):
@@ -13,66 +24,61 @@ Usage (cli):
Usage (module):
import jc.parsers.ini
result = jc.parsers.ini.parse(ini_file_output)
import jc
result = jc.parse('ini', ini_file_output)
Schema:
ini or key/value document converted to a dictionary - see configparser standard
library documentation for more details.
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 or raw=True argument.
INI document converted to a dictionary - see the python configparser
standard library documentation for more details.
{
"key1": string,
"key2": string
"<key1>": string,
"<key2>": string,
"<section1>": {
"<key1>": string,
"<key2>": string
},
"<section2>": {
"<key1>": string,
"<key2>": string
}
}
Examples:
$ cat example.ini
[DEFAULT]
ServerAliveInterval = 45
Compression = yes
CompressionLevel = 9
ForwardX11 = yes
foo = fiz
bar = buz
[bitbucket.org]
User = hg
[section1]
fruit = apple
color = blue
[topsecret.server.com]
Port = 50022
ForwardX11 = no
[section2]
fruit = pear
color = green
$ cat example.ini | jc --ini -p
{
"bitbucket.org": {
"serveraliveinterval": "45",
"compression": "yes",
"compressionlevel": "9",
"forwardx11": "yes",
"user": "hg"
"foo": "fiz",
"bar": "buz",
"section1": {
"fruit": "apple",
"color": "blue"
},
"topsecret.server.com": {
"serveraliveinterval": "45",
"compression": "yes",
"compressionlevel": "9",
"forwardx11": "no",
"port": "50022"
"section2": {
"fruit": "pear",
"color": "green"
}
}
<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
@@ -80,14 +86,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary representing the ini file
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)
Source: [`jc/parsers/ini.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ini.py)
Version 2.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

123
docs/parsers/ini_dup.md Normal file
View File

@@ -0,0 +1,123 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ini_dup"></a>
# jc.parsers.ini_dup
jc - JSON Convert INI with duplicate key file parser
Parses standard INI files and preserves duplicate values. All values are
contained in lists/arrays.
- Delimiter can be `=` or `:`. Missing values are supported.
- Comment prefix can be `#` or `;`. Comments must be on their own line.
- If any section names have the same name as a top-level key, the top-level
key will be overwritten by the section data.
- If multi-line values are used, each line will be a separate item in the
value list. Blank lines in multi-line values are not supported.
> 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):
$ cat foo.ini | jc --ini-dup
Usage (module):
import jc
result = jc.parse('ini_dup', ini_file_output)
Schema:
INI document converted to a dictionary - see the python configparser
standard library documentation for more details.
{
"<key1>": [
string
],
"<key2>": [
string
],
"<section1>": {
"<key1>": [
string
],
"<key2>": [
string
]
}
}
Examples:
$ cat example.ini
foo = fiz
bar = buz
[section1]
fruit = apple
color = blue
color = red
[section2]
fruit = pear
fruit = peach
color = green
$ cat example.ini | jc --ini-dup -p
{
"foo": [
"fiz"
],
"bar": [
"buz"
],
"section1": {
"fruit": [
"apple"
],
"color": [
"blue",
"red"
]
},
"section2": {
"fruit": [
"pear",
"peach"
],
"color": [
"green"
]
}
}
<a id="jc.parsers.ini_dup.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 representing the INI file.
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Source: [`jc/parsers/ini_dup.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ini_dup.py)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,22 +1,24 @@
[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
Usage (module):
import jc.parsers.iostat
result = jc.parsers.iostat.parse(iostat_command_output)
import jc
result = jc.parse('iostat', iostat_command_output)
Schema:
@@ -157,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
@@ -174,14 +172,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
Source: [`jc/parsers/iostat.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/iostat.py)
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,20 +1,31 @@
[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
> 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.parsers.iostat_s
result = jc.parsers.iostat_s.parse(iostat_command_output.splitlines()) # result is an iterable object
import jc
result = jc.parse('iostat_s', iostat_command_output.splitlines())
for item in result:
# do something
@@ -71,56 +82,53 @@ Schema:
"percent_util": float,
"percent_rrqm": float,
"percent_wrqm": float,
"_jc_meta": # This object only exists if using -qq or ignore_exceptions=True
{
"success": boolean, # true if successfully parsed, false if error
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
# 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:
$ iostat | jc --iostat-s
{"percent_user":0.14,"percent_nice":0.0,"percent_system":0.16,"percent_iowait":0.0,"percent_steal":0.0,"percent_idle":99.7,"type":"cpu"}
{"device":"sda","tps":0.24,"kb_read_s":5.28,"kb_wrtn_s":1.1,"kb_read":203305,"kb_wrtn":42368,"type":"device"}
{"percent_user":0.14,"percent_nice":0.0,"percent_system":0.16,...}
{"device":"sda","tps":0.24,"kb_read_s":5.28,"kb_wrtn_s":1.1...}
...
$ iostat | jc --iostat-s -r
{"percent_user":"0.14","percent_nice":"0.00","percent_system":"0.16","percent_iowait":"0.00","percent_steal":"0.00","percent_idle":"99.70","type":"cpu"}
{"device":"sda","tps":"0.24","kb_read_s":"5.28","kb_wrtn_s":"1.10","kb_read":"203305","kb_wrtn":"42368","type":"device"}
{"percent_user":"0.14","percent_nice":"0.00","percent_system":"0.16"...}
{"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)
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:
data: (iterable) line-based text data to parse (e.g. sys.stdin or str.splitlines())
raw: (boolean) output preprocessed JSON if True
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
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)
Source: [`jc/parsers/iostat_s.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/iostat_s.py)
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,559 @@
[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
Source: [`jc/parsers/ip_address.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ip_address.py)
This parser can be used with the `--slurp` command-line option.
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

76
docs/parsers/ip_route.md Normal file
View File

@@ -0,0 +1,76 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ip_route"></a>
# jc.parsers.ip_route
jc - JSON Convert `ip route` command output parser
Usage (cli):
$ ip route | jc --ip-route
or
$ jc ip-route
Usage (module):
import jc
result = jc.parse('ip_route', ip_route_command_output)
Schema:
[
{
"ip": string,
"via": string,
"dev": string,
"metric": integer,
"proto": string,
"scope": string,
"src": string,
"via": string,
"status": string
}
]
Examples:
$ ip route | jc --ip-route -p
[
{
"ip": "10.0.2.0/24",
"dev": "enp0s3",
"proto": "kernel",
"scope": "link",
"src": "10.0.2.15",
"metric": 100
}
]
<a id="jc.parsers.ip_route.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:
List of Json objects if data is processed and Raw data if raw = true.
### Parser Information
Compatibility: linux
Source: [`jc/parsers/ip_route.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ip_route.py)
Version 1.0 by Julian Jackson (jackson.julian55@yahoo.com)

461
docs/parsers/ipconfig.md Normal file
View File

@@ -0,0 +1,461 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ipconfig"></a>
# jc.parsers.ipconfig
jc - JSON Convert `ipconfig` Windows command output parser
Usage (cli):
$ ipconfig /all | jc --ipconfig
$ ipconfig | jc --ipconfig
$ jc ipconfig /all
Usage (module):
import jc
result = jc.parse('ipconfig', ipconfig_command_output)
Schema:
{
"host_name": string,
"primary_dns_suffix": string,
"node_type": string,
"ip_routing_enabled": boolean,
"wins_proxy_enabled": boolean,
"dns_suffix_search_list": [
string
],
"adapters": [
{
"name_long": string,
"name": string,
"type": string,
"connection_specific_dns_suffix": string,
"connection_specific_dns_suffix_search_list": [
string
]
"description": string,
"physical_address": string,
"dhcp_enabled": boolean,
"autoconfiguration_enabled": boolean,
"ipv6_addresses": [
{
"address": string,
"status": string,
},
],
"temporary_ipv6_addresses": [
{
"address": string,
"status": string,
},
],
"link_local_ipv6_addresses": [
{
"address": string,
"status": string,
"prefix_length": integer,
}
],
"ipv4_addresses": [
{
"address": string, # [2]
"subnet_mask": string,
"status": string,
"autoconfigured": boolean # [1]
}
],
"default_gateways": [
string
],
"dhcp_server": null,
"dhcpv6_iaid": string,
"dhcpv6_client_duid": string,
"dns_servers": [
string
],
"primary_wins_server": string,
"lease_expires": string,
"lease_expires_epoch": integer, # [0]
"lease_expires_iso": string,
"lease_obtained": string,
"lease_obtained_epoch": integer, # [0]
"lease_obtained_iso": string,
"netbios_over_tcpip": boolean,
"media_state": string,
"extras": [
<string>: string
]
}
],
"extras": []
}
Notes:
[0] - The epoch calculated timestamp field is naive. (i.e. based on
the local time of the system the parser is run on)
[1] - 'autoconfigured' under 'ipv4_address' is only providing
indication if the ipv4 address was labeled as "Autoconfiguration
IPv4 Address" vs "IPv4 Address". It does not infer any
information from other fields
[2] - Windows XP uses 'IP Address' instead of 'IPv4 Address'. Both
values are parsed to the 'ipv4_address' object for consistency
Examples:
$ ipconfig /all | jc --ipconfig -p
{
"host_name": "DESKTOP-WIN11-HOME",
"primary_dns_suffix": null,
"node_type": "Hybrid",
"ip_routing_enabled": false,
"wins_proxy_enabled": false,
"dns_suffix_search_list": [
"localdomain"
],
"adapters": [
{
"name_long": "Ethernet adapter Ethernet",
"name": "Ethernet",
"type": "Ethernet",
"connection_specific_dns_suffix": null,
"connection_specific_dns_suffix_search_list": [],
"description": "Intel(R) I211 Gigabit Network Connection",
"physical_address": "24-4B-FE-AB-43-C3",
"dhcp_enabled": true,
"autoconfiguration_enabled": true,
"ipv6_addresses": [],
"temporary_ipv6_addresses": [],
"link_local_ipv6_addresses": [],
"ipv4_addresses": [],
"default_gateways": [],
"dhcp_server": null,
"dhcpv6_iaid": null,
"dhcpv6_client_duid": null,
"dns_servers": [],
"primary_wins_server": null,
"lease_expires": null,
"lease_obtained": null,
"netbios_over_tcpip": null,
"media_state": "Media disconnected",
"extras": []
},
{
"name_long": "Ethernet adapter Ethernet 2",
"name": "Ethernet 2",
"type": "Ethernet",
"connection_specific_dns_suffix": null,
"connection_specific_dns_suffix_search_list": [],
"description": "Realtek PCIe 2.5GbE Family Controller",
"physical_address": "24-4B-FE-57-3D-F2",
"dhcp_enabled": true,
"autoconfiguration_enabled": true,
"ipv6_addresses": [],
"temporary_ipv6_addresses": [],
"link_local_ipv6_addresses": [],
"ipv4_addresses": [],
"default_gateways": [],
"dhcp_server": null,
"dhcpv6_iaid": null,
"dhcpv6_client_duid": null,
"dns_servers": [],
"primary_wins_server": null,
"lease_expires": null,
"lease_obtained": null,
"netbios_over_tcpip": null,
"media_state": "Media disconnected",
"extras": []
},
{
"name_long": "Unknown adapter OpenVPN Data Channel Offload for NordVPN",
"name": "OpenVPN Data Channel Offload for NordVPN",
"type": "Unknown",
"connection_specific_dns_suffix": null,
"connection_specific_dns_suffix_search_list": [],
"description": "OpenVPN Data Channel Offload",
"physical_address": null,
"dhcp_enabled": true,
"autoconfiguration_enabled": true,
"ipv6_addresses": [],
"temporary_ipv6_addresses": [],
"link_local_ipv6_addresses": [],
"ipv4_addresses": [],
"default_gateways": [],
"dhcp_server": null,
"dhcpv6_iaid": null,
"dhcpv6_client_duid": null,
"dns_servers": [],
"primary_wins_server": null,
"lease_expires": null,
"lease_obtained": null,
"netbios_over_tcpip": null,
"media_state": "Media disconnected",
"extras": []
},
{
"name_long": "Unknown adapter Local Area Connection",
"name": "Local Area Connection",
"type": "Unknown",
"connection_specific_dns_suffix": null,
"connection_specific_dns_suffix_search_list": [],
"description": "TAP-NordVPN Windows Adapter V9",
"physical_address": "00-FF-4C-F4-5E-49",
"dhcp_enabled": true,
"autoconfiguration_enabled": true,
"ipv6_addresses": [],
"temporary_ipv6_addresses": [],
"link_local_ipv6_addresses": [],
"ipv4_addresses": [],
"default_gateways": [],
"dhcp_server": null,
"dhcpv6_iaid": null,
"dhcpv6_client_duid": null,
"dns_servers": [],
"primary_wins_server": null,
"lease_expires": null,
"lease_obtained": null,
"netbios_over_tcpip": null,
"media_state": "Media disconnected",
"extras": []
},
{
"name_long": "Wireless LAN adapter Local Area Connection* 1",
"name": "Local Area Connection* 1",
"type": "Wireless LAN",
"connection_specific_dns_suffix": null,
"connection_specific_dns_suffix_search_list": [],
"description": "Microsoft Wi-Fi Direct Virtual Adapter",
"physical_address": "A8-7E-EA-5A-7F-DE",
"dhcp_enabled": true,
"autoconfiguration_enabled": true,
"ipv6_addresses": [],
"temporary_ipv6_addresses": [],
"link_local_ipv6_addresses": [],
"ipv4_addresses": [],
"default_gateways": [],
"dhcp_server": null,
"dhcpv6_iaid": null,
"dhcpv6_client_duid": null,
"dns_servers": [],
"primary_wins_server": null,
"lease_expires": null,
"lease_obtained": null,
"netbios_over_tcpip": null,
"media_state": "Media disconnected",
"extras": []
},
{
"name_long": "Wireless LAN adapter Local Area Connection* 2",
"name": "Local Area Connection* 2",
"type": "Wireless LAN",
"connection_specific_dns_suffix": null,
"connection_specific_dns_suffix_search_list": [],
"description": "Microsoft Wi-Fi Direct Virtual Adapter #2",
"physical_address": "AA-7E-EA-F3-64-C3",
"dhcp_enabled": true,
"autoconfiguration_enabled": true,
"ipv6_addresses": [],
"temporary_ipv6_addresses": [],
"link_local_ipv6_addresses": [],
"ipv4_addresses": [],
"default_gateways": [],
"dhcp_server": null,
"dhcpv6_iaid": null,
"dhcpv6_client_duid": null,
"dns_servers": [],
"primary_wins_server": null,
"lease_expires": null,
"lease_obtained": null,
"netbios_over_tcpip": null,
"media_state": "Media disconnected",
"extras": []
},
{
"name_long": "Ethernet adapter VMware Network Adapter VMnet1",
"name": "VMware Network Adapter VMnet1",
"type": "Ethernet",
"connection_specific_dns_suffix": null,
"connection_specific_dns_suffix_search_list": [],
"description": "VMware Virtual Ethernet Adapter for VMnet1",
"physical_address": "00-50-56-CC-27-73",
"dhcp_enabled": true,
"autoconfiguration_enabled": true,
"ipv6_addresses": [],
"temporary_ipv6_addresses": [],
"link_local_ipv6_addresses": [
{
"address": "fe80::f47d:9c7f:69dc:591e",
"prefix_length": 8,
"status": "Preferred"
}
],
"ipv4_addresses": [
{
"address": "192.168.181.1",
"subnet_mask": "255.255.255.0",
"status": "Preferred",
"autoconfigured": false
}
],
"default_gateways": [],
"dhcp_server": "192.168.181.254",
"dhcpv6_iaid": "771772502",
"dhcpv6_client_duid": "00-01-00-01-2C-CF-19-EB-24-4B-FE-5B-9B-E6",
"dns_servers": [],
"primary_wins_server": null,
"lease_expires": "2024-09-19T18:01:29",
"lease_obtained": "2024-09-19T08:31:29",
"netbios_over_tcpip": true,
"media_state": null,
"extras": []
},
{
"name_long": "Ethernet adapter VMware Network Adapter VMnet8",
"name": "VMware Network Adapter VMnet8",
"type": "Ethernet",
"connection_specific_dns_suffix": null,
"connection_specific_dns_suffix_search_list": [],
"description": "VMware Virtual Ethernet Adapter for VMnet8",
"physical_address": "00-50-56-C9-A3-78",
"dhcp_enabled": true,
"autoconfiguration_enabled": true,
"ipv6_addresses": [],
"temporary_ipv6_addresses": [],
"link_local_ipv6_addresses": [
{
"address": "fe80::4551:bf0d:59dd:a4f0",
"prefix_length": 10,
"status": "Preferred"
}
],
"ipv4_addresses": [
{
"address": "192.168.213.1",
"subnet_mask": "255.255.255.0",
"status": "Preferred",
"autoconfigured": false
}
],
"default_gateways": [],
"dhcp_server": "192.168.213.254",
"dhcpv6_iaid": "788549718",
"dhcpv6_client_duid": "00-01-00-01-2C-CF-19-EB-24-4B-FE-5B-9B-E6",
"dns_servers": [],
"primary_wins_server": "192.168.213.2",
"lease_expires": "2024-09-19T18:01:29",
"lease_obtained": "2024-09-19T08:31:29",
"netbios_over_tcpip": true,
"media_state": null,
"extras": []
},
{
"name_long": "Wireless LAN adapter Wi-Fi",
"name": "Wi-Fi",
"type": "Wireless LAN",
"connection_specific_dns_suffix": "localdomain",
"connection_specific_dns_suffix_search_list": [],
"description": "Intel(R) Wi-Fi 6 AX200 160MHz",
"physical_address": "A8-7E-EA-55-26-B0",
"dhcp_enabled": true,
"autoconfiguration_enabled": true,
"ipv6_addresses": [
{
"address": "fd63:cc9c:65eb:3f95:57c2:aa:10d8:db08",
"status": "Preferred"
}
],
"temporary_ipv6_addresses": [
{
"address": "fd63:cc9c:65eb:3f95:8928:348e:d692:b7ef",
"status": "Preferred"
}
],
"link_local_ipv6_addresses": [
{
"address": "fe80::4fae:1380:5a1b:8b6b",
"prefix_length": 11,
"status": "Preferred"
}
],
"ipv4_addresses": [
{
"address": "192.168.1.169",
"subnet_mask": "255.255.255.0",
"status": "Preferred",
"autoconfigured": false
}
],
"default_gateways": [
"192.168.1.1"
],
"dhcp_server": "192.168.1.1",
"dhcpv6_iaid": "162037482",
"dhcpv6_client_duid": "00-01-00-01-2C-CF-19-EB-24-4B-FE-5B-9B-E6",
"dns_servers": [
"192.168.1.1"
],
"primary_wins_server": null,
"lease_expires": "2024-09-20T08:31:30",
"lease_obtained": "2024-09-19T08:31:30",
"netbios_over_tcpip": true,
"media_state": null,
"extras": []
},
{
"name_long": "Ethernet adapter Bluetooth Network Connection",
"name": "Bluetooth Network Connection",
"type": "Ethernet",
"connection_specific_dns_suffix": null,
"connection_specific_dns_suffix_search_list": [],
"description": "Bluetooth Device (Personal Area Network)",
"physical_address": "A8-7E-EA-43-23-14",
"dhcp_enabled": true,
"autoconfiguration_enabled": true,
"ipv6_addresses": [],
"temporary_ipv6_addresses": [],
"link_local_ipv6_addresses": [],
"ipv4_addresses": [],
"default_gateways": [],
"dhcp_server": null,
"dhcpv6_iaid": null,
"dhcpv6_client_duid": null,
"dns_servers": [],
"primary_wins_server": null,
"lease_expires": null,
"lease_obtained": null,
"netbios_over_tcpip": null,
"media_state": "Media disconnected",
"extras": []
}
],
"extras": []
}
<a id="jc.parsers.ipconfig.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:
Parsed dictionary. The raw and processed data structures are the same.
### Parser Information
Compatibility: windows
Source: [`jc/parsers/ipconfig.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ipconfig.py)
Version 1.0 by joehacksalot (joehacksalot@gmail.com)

View File

@@ -1,34 +1,39 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.iptables"></a>
# jc.parsers.iptables
jc - JSON CLI output utility `ipables` command output parser
Supports `-vLn` and `--line-numbers` for all tables.
jc - JSON Convert `iptables` command output parser
Supports `-vLnx` and `--line-numbers` for all tables.
Usage (cli):
$ sudo iptables -L -t nat | jc --iptables
or
or
$ jc iptables -L -t nat
Usage (module):
import jc.parsers.iptables
result = jc.parsers.iptables.parse(iptables_command_output)
import jc
result = jc.parse('iptables', iptables_command_output)
Schema:
[
{
"chain": string,
"default_policy": string,
"default_packets": integer,
"default_bytes": integer,
"rules": [
{
"num" integer,
"pkts": integer,
"bytes": integer, # converted based on suffix
"target": string,
"target": string, # Null if blank
"prot": string,
"opt": string, # "--" = Null
"in": string,
@@ -47,6 +52,9 @@ Examples:
[
{
"chain": "PREROUTING",
"default_policy": "DROP",
"default_packets": 0,
"default_bytes": 0,
"rules": [
{
"num": 1,
@@ -106,6 +114,9 @@ Examples:
[
{
"chain": "PREROUTING",
"default_policy": "DROP",
"default_packets": "0",
"default_bytes": "0",
"rules": [
{
"num": "1",
@@ -161,16 +172,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
@@ -178,14 +185,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
Source: [`jc/parsers/iptables.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/iptables.py)
Version 1.12 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,28 +1,31 @@
[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
This parser is considered beta quality. Not all fields are parsed and there are not enough samples to test.
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.
Usage (cli):
$ iw dev wlan0 scan | jc --iw-scan
or
or
$ jc iw dev wlan0 scan
Usage (module):
import jc.parsers.iw-scan
result = jc.parsers.iw-scan.parse(iw-scan_command_output)
import jc
result = jc.parse('iw_scan', iw_scan_command_output)
Schema:
[
{
"foo": string/integer/float, # best guess based on value
"foo": string/integer/float, # best guess based on value
"bar": string/integer/float,
"baz": string/integer/float
}
@@ -118,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
@@ -135,14 +134,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 0.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
Source: [`jc/parsers/iw_scan.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/iw_scan.py)
Version 0.75 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,113 @@
[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[Dict[str, Any]]
```
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
Source: [`jc/parsers/iwconfig.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/iwconfig.py)
Version 1.2 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 - JSON Convert Java `MANIFEST.MF` file parser
Usage (cli):
@@ -9,8 +11,8 @@ Usage (cli):
Usage (module):
import jc.parsers.jar_manifest
result = jc.parsers.jar_manifest.parse(jar_manifest_file_output)
import jc
result = jc.parse('jar_manifest', jar_manifest_file_output)
Schema:
@@ -24,15 +26,16 @@ Schema:
Examples:
$ cat MANIFEST.MF | jc --jar-manifest -p
$ unzip -c apache-log4j-2.16.0-bin/log4j-core-2.16.0.jar META-INF/MANIFEST.MF | jc --jar-manifest -p
$ unzip -c 'apache-log4j-2.16.0-bin/*.jar' META-INF/MANIFEST.MF | jc --jar-manifest -p
$ 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 | \\
jc --jar-manifest -p
$ cat MANIFEST.MF | jc --jar-manifest -p
[
{
"Import_Package": "com.conversantmedia.util.concurrent;resolution:=optional,com.fasterxml.jackson.annotation;version="[2.12,3)";resolution:=optional,com.fasterxml.jackson.core;version="[2.12,3)";resolution:=optional,com.fasterxml.jackson.core.type;version="[2.12,3)";resolution:=optional,com.fasterxml.jackson.cor...",
"Export_Package": "org.apache.logging.log4j.core;uses:="org.apache.logging.log4j,org.apache.logging.log4j.core.config,org.apache.logging.log4j.core.impl,org.apache.logging.log4j.core.layout,org.apache.logging.log4j.core.time,org.apache.logging.log4j.message,org.apache.logging.log4j.spi,org.apache.logging.log4j.status...",
"Import_Package": "com.conversantmedia.util.concurrent;resoluti...",
"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",
@@ -45,28 +48,28 @@ Examples:
}
]
$ unzip -c 'apache-log4j-2.16.0-bin/*.jar' META-INF/MANIFEST.MF | jc --jar-manifest -p
$ unzip -c 'apache-log4j-2.16.0-bin/*.jar' META-INF/MANIFEST.MF | \\
jc --jar-manifest -p
[
...
{
"Archive": "apache-log4j-2.16.0-bin/log4j-spring-boot-2.16.0-sources.jar",
"Archive": "apache-log4j-2.16.0-bin/log4j-spring-boot-2.16.0-so...",
"Manifest_Version": "1.0",
"Built_By": "matt",
"Created_By": "Apache Maven 3.8.4",
"Build_Jdk": "1.8.0_312"
},
{
"Archive": "apache-log4j-2.16.0-bin/log4j-spring-boot-2.16.0-javadoc.jar",
"Archive": "apache-log4j-2.16.0-bin/log4j-spring-boot-2.16.0-ja...",
"Manifest_Version": "1.0",
"Built_By": "matt",
"Created_By": "Apache Maven 3.8.4",
"Build_Jdk": "1.8.0_312"
},
{
"Bundle_SymbolicName": "org.apache.logging.log4j.spring-cloud-config-client.logging.log4j.core.util;version="[2.16,3)",org.springframework.boot.autoconfigure.condition,org.springframework.cloud.context.environment,org.springframework.context,org.springframework.stereotype",
"Export_Package": "org.apache.logging.log4j.spring.cloud.config.controller;version="2.16.0"ient",
"Archive": "apache-log4j-2.16.0-bin/log4j-spring-cloud-config-client-2.16.0.jar",
"Bundle_SymbolicName": "org.apache.logging.log4j.spring-cloud-c...",
"Export_Package": "org.apache.logging.log4j.spring.cloud.config...",
"Archive": "apache-log4j-2.16.0-bin/log4j-spring-cloud-config-c...",
"Manifest_Version": "1.0",
"Bundle_License": "https://www.apache.org/licenses/LICENSE-2.0.txt",
...
@@ -74,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
@@ -91,14 +90,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Source: [`jc/parsers/jar_manifest.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/jar_manifest.py)
Version 0.01 by Matt J (https://github.com/listuser)

View File

@@ -1,11 +1,14 @@
[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.
The "Magic" syntax is not supported since the `jobs` command is a shell builtin.
The "Magic" syntax is not supported since the `jobs` command is a shell
builtin.
Usage (cli):
@@ -13,8 +16,8 @@ Usage (cli):
Usage (module):
import jc.parsers.jobs
result = jc.parsers.jobs.parse(jobs_command_output)
import jc
result = jc.parse('jobs', jobs_command_output)
Schema:
@@ -90,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
@@ -107,14 +106,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
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)
Source: [`jc/parsers/jobs.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/jobs.py)
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,77 @@
[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
Source: [`jc/parsers/jwt.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/jwt.py)
This parser can be used with the `--slurp` command-line option.
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,11 +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):
@@ -13,12 +21,13 @@ Usage (cli):
Usage (module):
import jc.parsers.kv
result = jc.parsers.kv.parse(kv_file_output)
import jc
result = jc.parse('kv', kv_file_output)
Schema:
key/value document converted to a dictionary - see configparser standard library documentation for more details.
Key/Value document converted to a dictionary - see the python configparser
standard library documentation for more details.
{
"key1": string,
@@ -32,6 +41,7 @@ Examples:
name = John Doe
address=555 California Drive
age: 34
; comments can include # or ;
# delimiter can be = or :
# quoted values have quotation marks stripped by default
@@ -46,33 +56,29 @@ 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
Note: this is just a wrapper for jc.parsers.ini
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary representing the key/value file
Dictionary representing a Key/Value pair document.
## Parser Information
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
Source: [`jc/parsers/kv.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/kv.py)
Version 2.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

91
docs/parsers/kv_dup.md Normal file
View File

@@ -0,0 +1,91 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.kv_dup"></a>
# jc.parsers.kv_dup
jc - JSON Convert `Key/Value` with duplicate key file and string parser
Supports files containing simple key/value pairs and preserves duplicate
values. All values are contained in lists/arrays.
- Delimiter can be `=` or `:`. Missing values are supported.
- Comment prefix can be `#` or `;`. Comments must be on their own line.
- If multi-line values are used, each line will be a separate item in the
value list. Blank lines in multi-line values are not supported.
> 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):
$ cat foo.txt | jc --kv-dup
Usage (module):
import jc
result = jc.parse('kv_dup', kv_file_output)
Schema:
Key/Value document converted to a dictionary - see the python configparser
standard library documentation for more details.
{
"<key1>": [
string
],
"<key2>": [
string
]
}
Examples:
$ cat keyvalue.txt
# this file contains key/value pairs
name = John Doe
address=555 California Drive
age: 34
; comments can include # or ;
# delimiter can be = or :
# quoted values have quotation marks stripped by default
# but can be preserved with the -r argument
occupation:"Engineer"
occupation = "Pilot"
$ cat keyvalue.txt | jc --kv-dup -p
{
"name": ["John Doe"],
"address": ["555 California Drive"],
"age": ["34"],
"occupation": ["Engineer", "Pilot"]
}
<a id="jc.parsers.kv_dup.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 representing a Key/Value pair document.
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Source: [`jc/parsers/kv_dup.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/kv_dup.py)
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,24 +1,28 @@
[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
Supports `-w` and `-F` options.
jc - JSON Convert `last` and `lastb` command output parser
Calculated epoch time fields are naive (i.e. based on the local time of the system the parser is run on) since there is no timezone information in the `last` command output.
Supports `-w`, `-F`, and `-x` options.
Calculated epoch time fields are naive (i.e. based on the local time of the
system the parser is run on) since there is no timezone information in the
`last` command output.
Usage (cli):
$ last | jc --last
or
or
$ jc last
Usage (module):
import jc.parsers.last
result = jc.parsers.last.parse(last_command_output)
import jc
result = jc.parse('last', last_command_output)
Schema:
@@ -30,9 +34,9 @@ Schema:
"login": string,
"logout": string,
"duration": string,
"login_epoch": integer, # (naive) available with last -F option
"logout_epoch": integer, # (naive) available with last -F option
"duration_seconds": integer # available with last -F option
"login_epoch": integer, # (naive) available w/last -F option
"logout_epoch": integer, # (naive) available w/last -F option
"duration_seconds": integer # available w/last -F option
}
]
@@ -100,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
@@ -118,14 +117,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
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)
Source: [`jc/parsers/last.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/last.py)
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,30 +1,39 @@
[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)
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.
The `epoch_utc` calculated timestamp field is timezone-aware and is only
available if the timezone field is UTC.
Usage (cli):
$ ls | jc --ls
or
or
$ jc ls
Usage (module):
import jc.parsers.ls
result = jc.parsers.ls.parse(ls_command_output)
import jc
result = jc.parse('ls', ls_command_output)
Schema:
@@ -38,11 +47,15 @@ Schema:
"group": string,
"size": integer,
"date": string,
"epoch": integer, # naive timestamp if date field exists and can be converted
"epoch_utc": integer # timezone aware timestamp if date field is in UTC and can be converted
"epoch": integer, # [0]
"epoch_utc": integer # [1]
}
]
[0] naive timestamp if date field exists and can be converted.
[1] timezone aware timestamp if date field is in UTC and can
be converted.
Examples:
$ ls /usr/bin | jc --ls -p
@@ -104,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
@@ -121,14 +130,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
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)
Source: [`jc/parsers/ls.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ls.py)
Version 1.12 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,17 +1,24 @@
[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
> This streaming parser outputs JSON Lines
jc - JSON Convert `ls` and `vdir` command output streaming parser
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`.
> This streaming parser outputs JSON Lines (cli) or returns an Iterable of
> Dictionaries (module)
The `jc` `-qq` option can be used to ignore parsing errors. (e.g. filenames with newline characters, but `-b` was not used)
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`.
The `epoch` calculated timestamp field is naive (i.e. based on the local time of the system the parser is run on)
The `jc` `-qq` option can be used to ignore parsing errors. (e.g. filenames
with newline characters, but `-b` was not used)
The `epoch_utc` calculated timestamp field is timezone-aware and is only available if the timezone field is UTC.
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):
@@ -19,8 +26,9 @@ Usage (cli):
Usage (module):
import jc.parsers.ls_s
result = jc.parsers.ls_s.parse(ls_command_output.splitlines()) # result is an iterable object
import jc
result = jc.parse('ls_s', ls_command_output.splitlines())
for item in result:
# do something
@@ -35,60 +43,61 @@ Schema:
"group": string,
"size": integer,
"date": string,
"epoch": integer, # naive timestamp if date field exists and can be converted
"epoch_utc": integer, # timezone aware timestamp if date field is in UTC and can be converted
"_jc_meta": # This object only exists if using -qq or ignore_exceptions=True
{
"success": boolean, # true if successfully parsed, false if error
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
"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
}
}
[0] naive timestamp if date field exists and can be converted.
[1] timezone aware timestamp if date field is in UTC and can
be converted
Examples:
$ ls -l /usr/bin | jc --ls-s
{"filename":"2to3-","flags":"-rwxr-xr-x","links":4,"owner":"root","group":"wheel","size":925,"date":"Feb 22 2019"}
{"filename":"2to3-2.7","link_to":"../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/2to3-2.7","flags":"lrwxr-xr-x","links":1,"owner":"root","group":"wheel","size":74,"date":"May 4 2019"}
{"filename":"AssetCacheLocatorUtil","flags":"-rwxr-xr-x","links":1,"owner":"root","group":"wheel","size":55152,"date":"May 3 2019"}
{"filename":"2to3-","flags":"-rwxr-xr-x","links":4,"owner":"root","...}
{"filename":"2to3-2.7","link_to":"../../System/Library/Frameworks/P...}
{"filename":"AssetCacheLocatorUtil","flags":"-rwxr-xr-x","links":1,...}
...
$ ls -l /usr/bin | jc --ls-s -r
{"filename":"2to3-","flags":"-rwxr-xr-x","links":"4","owner":"root","group":"wheel","size":"925","date":"Feb 22 2019"}
{"filename":"2to3-2.7","link_to":"../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/2to3-2.7","flags":"lrwxr-xr-x","links":"1","owner":"root","group":"wheel","size":"74","date":"May 4 2019"}
{"filename":"AssetCacheLocatorUtil","flags":"-rwxr-xr-x","links":"1","owner":"root","group":"wheel","size":"55152","date":"May 3 2019"}
{"filename":"2to3-","flags":"-rwxr-xr-x","links":"4","owner":"roo"..."}
{"filename":"2to3-2.7","link_to":"../../System/Library/Frameworks/P...}
{"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)
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:
data: (iterable) line-based text data to parse (e.g. sys.stdin or str.splitlines())
raw: (boolean) output preprocessed JSON if True
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
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)
Source: [`jc/parsers/ls_s.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ls_s.py)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

91
docs/parsers/lsattr.md Normal file
View File

@@ -0,0 +1,91 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.lsattr"></a>
# jc.parsers.lsattr
jc - JSON Convert `lsattr` command output parser
Usage (cli):
$ lsattr | jc --lsattr
or
$ jc lsattr
Usage (module):
import jc
result = jc.parse('lsattr', lsattr_command_output)
Schema:
Information from https://github.com/mirror/busybox/blob/2d4a3d9e6c1493a9520b907e07a41aca90cdfd94/e2fsprogs/e2fs_lib.c#L40
used to define field names
[
{
"file": string,
"compressed_file": Optional[boolean],
"compressed_dirty_file": Optional[boolean],
"compression_raw_access": Optional[boolean],
"secure_deletion": Optional[boolean],
"undelete": Optional[boolean],
"synchronous_updates": Optional[boolean],
"synchronous_directory_updates": Optional[boolean],
"immutable": Optional[boolean],
"append_only": Optional[boolean],
"no_dump": Optional[boolean],
"no_atime": Optional[boolean],
"compression_requested": Optional[boolean],
"encrypted": Optional[boolean],
"journaled_data": Optional[boolean],
"indexed_directory": Optional[boolean],
"no_tailmerging": Optional[boolean],
"top_of_directory_hierarchies": Optional[boolean],
"extents": Optional[boolean],
"no_cow": Optional[boolean],
"casefold": Optional[boolean],
"inline_data": Optional[boolean],
"project_hierarchy": Optional[boolean],
"verity": Optional[boolean],
}
]
Examples:
$ sudo lsattr /etc/passwd | jc --lsattr
[
{
"file": "/etc/passwd",
"extents": true
}
]
<a id="jc.parsers.lsattr.parse"></a>
### parse
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function
Parameters:
data: (string) text data to parse
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Source: [`jc/parsers/lsattr.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/lsattr.py)
Version 1.0 by Mark Rotner (rotner.mr@gmail.com)

View File

@@ -0,0 +1,63 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.lsb_release"></a>
# jc.parsers.lsb_release
jc - JSON Convert `lsb_release` command parser
This parser is an alias to the Key/Value parser (`--kv`).
Usage (cli):
$ lsb_release -a | jc --lsb-release
or
$ jc lsb_release -a
Usage (module):
import jc
result = jc.parse('lsb_release', lsb_release_command_output)
Schema:
{
"<key>": string
}
Examples:
$ lsb_release -a | jc --lsb-release -p
{
"Distributor ID": "Ubuntu",
"Description": "Ubuntu 16.04.6 LTS",
"Release": "16.04",
"Codename": "xenial"
}
<a id="jc.parsers.lsb_release.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
```
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
Source: [`jc/parsers/lsb_release.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/lsb_release.py)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,65 +1,74 @@
[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
Usage (module):
import jc.parsers.lsblk
result = jc.parsers.lsblk.parse(lsblk_command_output)
import jc
result = jc.parse('lsblk', lsblk_command_output)
Schema:
[
{
"name": string,
"maj_min": string,
"rm": boolean,
"size": string,
"ro": boolean,
"type": string,
"mountpoint": string,
"kname": string,
"fstype": string,
"label": string,
"uuid": string,
"partlabel": string,
"partuuid": string,
"ra": integer,
"model": string,
"serial": string,
"state": string,
"owner": string,
"group": string,
"mode": string,
"alignment": integer,
"min_io": integer,
"opt_io": integer,
"phy_sec": integer,
"log_sec": integer,
"rota": boolean,
"sched": string,
"rq_size": integer,
"disc_aln": integer,
"disc_gran": string,
"disc_max": string,
"disc_zero": boolean,
"wsame": string,
"wwn": string,
"rand": boolean,
"pkname": string,
"hctl": string,
"tran": string,
"rev": string,
"vendor": string
"name": string,
"maj_min": string,
"rm": boolean,
"size": string,
"size_bytes": integer
"ro": boolean,
"type": string,
"mountpoint": string,
"mountpoints": [
string
],
"kname": string,
"fstype": string,
"label": string,
"uuid": string,
"partlabel": string,
"partuuid": string,
"ra": integer,
"model": string,
"serial": string,
"state": string,
"owner": string,
"group": string,
"mode": string,
"alignment": integer,
"min_io": integer,
"opt_io": integer,
"phy_sec": integer,
"log_sec": integer,
"rota": boolean,
"sched": string,
"rq_size": integer,
"disc_aln": integer,
"disc_gran": string,
"disc_gran_bytes": integer,
"disc_max": string,
"disc_max_bytes": integer,
"disc_zero": boolean,
"wsame": string,
"wsame_bytes": integer,
"wwn": string,
"rand": boolean,
"pkname": string,
"hctl": string,
"tran": string,
"rev": string,
"vendor": string
}
]
@@ -72,6 +81,7 @@ Examples:
"maj_min": "8:0",
"rm": false,
"size": "20G",
"size_bytes": 20000000000,
"ro": false,
"type": "disk",
"mountpoint": null
@@ -81,6 +91,7 @@ Examples:
"maj_min": "8:1",
"rm": false,
"size": "1G",
"size_bytes": 1000000000
"ro": false,
"type": "part",
"mountpoint": "/boot"
@@ -88,13 +99,17 @@ 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,PKNAME,HCTL,TRAN,REV,VENDOR | jc --lsblk -p
$ 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
[
{
"name": "sda",
"maj_min": "8:0",
"rm": false,
"size": "20G",
"size_bytes": 20000000000,
"ro": false,
"type": "disk",
"mountpoint": null,
@@ -121,9 +136,12 @@ Examples:
"rq_size": 128,
"disc_aln": 0,
"disc_gran": "0B",
"disc_gran_bytes": 0,
"disc_max": "0B",
"disc_max_bytes": 0,
"disc_zero": false,
"wsame": "32M",
"wsame_bytes": 32000000,
"wwn": null,
"rand": true,
"pkname": null,
@@ -137,6 +155,7 @@ Examples:
"maj_min": "8:1",
"rm": false,
"size": "1G",
"size_bytes": 1000000000
"ro": false,
"type": "part",
"mountpoint": "/boot",
@@ -163,9 +182,12 @@ Examples:
"rq_size": 128,
"disc_aln": 0,
"disc_gran": "0B",
"disc_gran_bytes": 0,
"disc_max": "0B",
"disc_max_bytes": 0,
"disc_zero": false,
"wsame": "32M",
"wsame_bytes": 32000000,
"wwn": null,
"rand": true,
"pkname": "sda",
@@ -177,13 +199,17 @@ 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,PKNAME,HCTL,TRAN,REV,VENDOR | jc --lsblk -p -r
$ 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
[
{
"name": "sda",
"maj_min": "8:0",
"rm": "0",
"size": "20G",
"size_bytes": 20000000000,
"ro": "0",
"type": "disk",
"mountpoint": null,
@@ -210,9 +236,12 @@ Examples:
"rq_size": "128",
"disc_aln": "0",
"disc_gran": "0B",
"disc_gran_bytes": 0,
"disc_max": "0B",
"disc_max_bytes": 0,
"disc_zero": "0",
"wsame": "32M",
"wsame_bytes": 32000000,
"wwn": null,
"rand": "1",
"pkname": null,
@@ -226,6 +255,7 @@ Examples:
"maj_min": "8:1",
"rm": "0",
"size": "1G",
"size_bytes": 1000000000
"ro": "0",
"type": "part",
"mountpoint": "/boot",
@@ -252,9 +282,12 @@ Examples:
"rq_size": "128",
"disc_aln": "0",
"disc_gran": "0B",
"disc_gran_bytes": 0,
"disc_max": "0B",
"disc_max_bytes": 0,
"disc_zero": "0",
"wsame": "32M",
"wsame_bytes": 32000000,
"wwn": null,
"rand": "1",
"pkname": "sda",
@@ -266,16 +299,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
@@ -283,14 +312,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
Source: [`jc/parsers/lsblk.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/lsblk.py)
Version 1.10 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,20 +1,22 @@
[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
Usage (module):
import jc.parsers.lsmod
result = jc.parsers.lsmod.parse(lsmod_command_output)
import jc
result = jc.parse('lsmod', lsmod_command_output)
Schema:
@@ -123,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
@@ -140,14 +138,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
Source: [`jc/parsers/lsmod.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/lsmod.py)
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,20 +1,22 @@
[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
Usage (module):
import jc.parsers.lsof
result = jc.parsers.lsof.parse(lsof_command_output)
import jc
result = jc.parse('lsof', lsof_command_output)
Schema:
@@ -117,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
@@ -134,14 +132,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
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
### Parser Information
Compatibility: linux, darwin, aix, freebsd
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
Source: [`jc/parsers/lsof.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/lsof.py)
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,
"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",
"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[Dict[str, Any]]
```
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
Source: [`jc/parsers/lspci.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/lspci.py)
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.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,19 +11,20 @@ Usage (cli):
$ lsusb -v | jc --lsusb
or
or
$ jc lsusb -v
Usage (module):
import jc.parsers.lsusb
result = jc.parsers.lsusb.parse(lsusb_command_output)
import jc
result = jc.parse('lsusb', 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.
[
{
@@ -99,6 +102,46 @@ Schema:
]
}
},
"cdc_mbim": {
"<item>": {
"value": string,
"description": string,
"attributes": [
string
]
}
},
"cdc_mbim_extended": {
"<item>": {
"value": string,
"description": string,
"attributes": [
string
]
}
},
"videocontrol_descriptors": [
{
"<item>": {
"value": string,
"description": string,
"attributes": [
string
]
}
}
],
"videostreaming_descriptors": [
{
"<item>": {
"value": string,
"description": string,
"attributes": [
string
]
}
}
],
"endpoint_descriptors": [
{
"<item>": {
@@ -131,6 +174,12 @@ Schema:
}
}
},
"device_qualifier": {
"<item>": {
"value": string,
"description": string
}
},
"device_status": {
"value": string,
"description": string
@@ -258,16 +307,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
@@ -275,14 +320,16 @@ Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
## Parser Information
### Parser Information
Compatibility: linux
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
Source: [`jc/parsers/lsusb.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/lsusb.py)
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,92 @@
[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
Source: [`jc/parsers/m3u.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/m3u.py)
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