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

Compare commits

...

180 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
594 changed files with 12274 additions and 2236 deletions

View File

@@ -9,12 +9,69 @@ on:
- "**/*.py"
jobs:
build:
very_old_python:
if: github.event.pull_request.draft == false
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-20.04, windows-latest]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
os: [macos-13, windows-2019]
python-version: ["3.6"]
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
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

View File

@@ -1,5 +1,69 @@
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

View File

@@ -76,7 +76,7 @@ function parameter in `parse()` when using `jc` as a python library.
Schemas for each parser can be found at the documentation link beside each
[**Parser**](#parsers) below.
Release notes can be found [here](https://blog.kellybrazil.com/category/jc-news/).
Release notes can be found in the [Releases section](https://github.com/kellyjonbrazil/jc/releases) on Github.
## Why Would Anyone Do This!?
For more information on the motivations for this project, please see my blog
@@ -159,6 +159,9 @@ option.
| `--acpi` | `acpi` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/acpi) |
| `--airport` | `airport -I` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/airport) |
| `--airport-s` | `airport -s` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/airport_s) |
| `--amixer` | `amixer` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/amixer) |
| `--apt-cache-show` | `apt-cache show` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/apt_cache_show) |
| `--apt-get-sqq` | `apt-get -sqq` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/apt_get_sqq) |
| `--arp` | `arp` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/arp) |
| `--asciitable` | ASCII and Unicode table parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/asciitable) |
| `--asciitable-m` | multi-line ASCII and Unicode table parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/asciitable_m) |
@@ -189,6 +192,7 @@ option.
| `--efibootmgr` | `efibootmgr` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/efibootmgr) |
| `--email-address` | Email Address string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/email_address) |
| `--env` | `env` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/env) |
| `--ethtool` | `ethtool` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ethtool) |
| `--file` | `file` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/file) |
| `--find` | `find` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/find) |
| `--findmnt` | `findmnt` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/findmnt) |
@@ -215,6 +219,7 @@ option.
| `--iostat` | `iostat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/iostat) |
| `--iostat-s` | `iostat` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/iostat_s) |
| `--ip-address` | IPv4 and IPv6 Address string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ip_address) |
| `--ipconfig` | `ipconfig` Windows command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ipconfig) |
| `--iptables` | `iptables` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/iptables) |
| `--ip-route` | `ip route` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/ip_route) |
| `--iw-scan` | `iw dev [device] scan` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/iw_scan) |
@@ -239,6 +244,7 @@ option.
| `--mount` | `mount` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/mount) |
| `--mpstat` | `mpstat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/mpstat) |
| `--mpstat-s` | `mpstat` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/mpstat_s) |
| `--needrestart` | `needrestart -b` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/needrestart) |
| `--netstat` | `netstat` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/netstat) |
| `--nmcli` | `nmcli` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/nmcli) |
| `--nsd-control` | `nsd-control` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/nsd_control) |
@@ -246,6 +252,7 @@ option.
| `--openvpn` | openvpn-status.log file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/openvpn) |
| `--os-prober` | `os-prober` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/os_prober) |
| `--os-release` | `/etc/os-release` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/os_release) |
| `--pacman` | `pacman` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/pacman) |
| `--passwd` | `/etc/passwd` file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/passwd) |
| `--path` | POSIX path string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/path) |
| `--path-list` | POSIX path list string parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/path_list) |
@@ -312,6 +319,7 @@ option.
| `--vmstat-s` | `vmstat` command streaming parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/vmstat_s) |
| `--w` | `w` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/w) |
| `--wc` | `wc` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/wc) |
| `--wg-show` | `wg show` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/wg_show) |
| `--who` | `who` command parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/who) |
| `--x509-cert` | X.509 PEM and DER certificate file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/x509_cert) |
| `--x509-csr` | X.509 PEM and DER certificate request file parser | [details](https://kellyjonbrazil.github.io/jc/docs/parsers/x509_csr) |
@@ -1371,4 +1379,4 @@ cat istio.yaml | jc -p --yaml
]
```
© 2019-2024 Kelly Brazil
© 2019-2025 Kelly Brazil

View File

@@ -3,8 +3,8 @@ _jc()
local cur prev words cword jc_commands jc_parsers jc_options \
jc_about_options jc_about_mod_options jc_help_options jc_special_options
jc_commands=(acpi airport arp blkid bluetoothctl cbt certbot chage cksum crontab curl date debconf-show df dig dmidecode dpkg du efibootmgr env file findmnt finger free git gpg hciconfig host id ifconfig iostat ip iptables iw iwconfig jobs last lastb ls lsattr lsb_release lsblk lsmod lsof lspci lsusb md5 md5sum mdadm mount mpstat netstat nmcli nsd-control ntpq os-prober 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 who xrandr zipinfo zpool)
jc_parsers=(--acpi --airport --airport-s --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 --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 --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 --netstat --nmcli --nsd-control --ntpq --openvpn --os-prober --os-release --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 --who --x509-cert --x509-csr --xml --xrandr --yaml --zipinfo --zpool-iostat --zpool-status)
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)

View File

@@ -9,10 +9,13 @@ _jc() {
jc_help_options jc_help_options_describe \
jc_special_options jc_special_options_describe
jc_commands=(acpi airport arp blkid bluetoothctl cbt certbot chage cksum crontab curl date debconf-show df dig dmidecode dpkg du efibootmgr env file findmnt finger free git gpg hciconfig host id ifconfig iostat ip iptables iw iwconfig jobs last lastb ls lsattr lsb_release lsblk lsmod lsof lspci lsusb md5 md5sum mdadm mount mpstat netstat nmcli nsd-control ntpq os-prober 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 who xrandr zipinfo zpool)
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.'
@@ -31,6 +34,7 @@ _jc() {
'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.'
@@ -43,6 +47,7 @@ _jc() {
'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.'
@@ -62,11 +67,13 @@ _jc() {
'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.'
@@ -112,16 +119,20 @@ _jc() {
'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 --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 --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 --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 --netstat --nmcli --nsd-control --ntpq --openvpn --os-prober --os-release --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 --who --x509-cert --x509-csr --xml --xrandr --yaml --zipinfo --zpool-iostat --zpool-status)
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'
@@ -152,6 +163,7 @@ _jc() {
'--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'
@@ -178,6 +190,7 @@ _jc() {
'--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'
@@ -202,6 +215,7 @@ _jc() {
'--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'
@@ -209,6 +223,7 @@ _jc() {
'--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'
@@ -326,6 +341,7 @@ _jc() {
'--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'

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)

110
docgen.sh
View File

@@ -1,107 +1,32 @@
#!/bin/bash
# Generate docs.md
# requires pydoc-markdown 4.6.1
# Generate markdown document files (*.md)
# Requires the yapf python library
# use ./docgen all to generate all docs
readme_config=$(cat <<'EOF'
{
"processors": [
{
"type": "filter"
},
{
"type": "pydocmd"
}
],
"renderer": {
"type": "markdown",
"header_level_by_type": {
"Module": 1,
"Class": 3,
"Method": 3,
"Function": 3,
"Variable": 3
}
}
}
EOF
)
toc_config=$(cat <<'EOF'
{
"processors": [
{
"type": "filter"
},
{
"type": "pydocmd"
}
],
"renderer": {
"type": "markdown",
"render_toc": true,
"header_level_by_type": {
"Module": 1,
"Class": 3,
"Method": 3,
"Function": 3,
"Variable": 3
}
}
}
EOF
)
parser_config=$(cat <<'EOF'
{
"processors": [
{
"type": "filter",
"expression": "not name == \"info\" and not name.startswith(\"_\") and default()"
},
{
"type": "pydocmd"
}
],
"renderer": {
"type": "markdown",
"header_level_by_type": {
"Module": 1,
"Class": 3,
"Method": 3,
"Function": 3,
"Variable": 3
}
}
}
EOF
)
cd jc
(
echo Building docs for: package
pydoc-markdown -m jc "${readme_config}" > ../docs/readme.md; echo "+++ package docs complete"
../doc2md.py jc > ../docs/readme.md && echo "+++ package docs complete" || echo "*** PACKAGE DOCS FAILED ***"
) &
(
echo Building docs for: lib
pydoc-markdown -m jc.lib "${toc_config}" > ../docs/lib.md; echo "+++ lib docs complete"
../doc2md.py jc.lib > ../docs/lib.md && echo "+++ lib docs complete" || echo "*** LIB DOCS FAILED ***"
) &
(
echo Building docs for: utils
pydoc-markdown -m jc.utils "${toc_config}" > ../docs/utils.md; echo "+++ utils docs complete"
../doc2md.py jc.utils > ../docs/utils.md && echo "+++ utils docs complete" || echo "*** UTILS DOCS FAILED ***"
) &
(
echo Building docs for: streaming
pydoc-markdown -m jc.streaming "${toc_config}" > ../docs/streaming.md; echo "+++ streaming docs complete"
../doc2md.py jc.streaming > ../docs/streaming.md && echo "+++ streaming docs complete" || echo "*** STREAMING DOCS FAILED ***"
) &
(
echo Building docs for: universal parser
pydoc-markdown -m jc.parsers.universal "${toc_config}" > ../docs/parsers/universal.md; echo "+++ universal parser docs complete"
../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
@@ -119,27 +44,8 @@ for parser in "${parsers[@]}"; do
parser_name=$(jq -r '.name' <<< "$parser")
{
if [[ $1 == "all" ]] || ! git diff --quiet --exit-code HEAD~5 -- "parsers/${parser_name}.py"; then
compatible=$(jq -r '.compatible | join(", ")' <<< "$parser")
version=$(jq -r '.version' <<< "$parser")
author=$(jq -r '.author' <<< "$parser")
author_email=$(jq -r '.author_email' <<< "$parser")
echo "Building docs for: ${parser_name}"
echo "[Home](https://kellyjonbrazil.github.io/jc/)" > ../docs/parsers/"${parser_name}".md
pydoc-markdown -m jc.parsers."${parser_name}" "${parser_config}" >> ../docs/parsers/"${parser_name}".md
echo "### Parser Information" >> ../docs/parsers/"${parser_name}".md
echo "Compatibility: ${compatible}" >> ../docs/parsers/"${parser_name}".md
echo >> ../docs/parsers/"${parser_name}".md
echo "Source: [\`jc/parsers/${parser_name}.py\`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/${parser_name}.py)" >> ../docs/parsers/"${parser_name}".md
echo >> ../docs/parsers/"${parser_name}".md
if $(jq -e '.tags | contains(["slurpable"])' <<< "$parser"); then
echo "This parser can be used with the \`--slurp\` command-line option." >> ../docs/parsers/"${parser_name}".md
echo >> ../docs/parsers/"${parser_name}".md
fi
echo "Version ${version} by ${author} (${author_email})" >> ../docs/parsers/"${parser_name}".md
echo "+++ ${parser_name} docs complete"
../doc2md.py jc.parsers."${parser_name}" > ../docs/parsers/"${parser_name}".md && echo "+++ ${parser_name} docs complete" || echo "*** ${parser_name} DOCS FAILED ***"
fi
} &
done

View File

@@ -1,29 +1,67 @@
# Table of Contents
* [jc.lib](#jc.lib)
* [get\_parser](#jc.lib.get_parser)
* [parse](#jc.lib.parse)
* [parser\_mod\_list](#jc.lib.parser_mod_list)
* [plugin\_parser\_mod\_list](#jc.lib.plugin_parser_mod_list)
* [standard\_parser\_mod\_list](#jc.lib.standard_parser_mod_list)
* [streaming\_parser\_mod\_list](#jc.lib.streaming_parser_mod_list)
* [slurpable\_parser\_mod\_list](#jc.lib.slurpable_parser_mod_list)
* [parser\_info](#jc.lib.parser_info)
* [all\_parser\_info](#jc.lib.all_parser_info)
* [get\_help](#jc.lib.get_help)
[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
### get_parser
```python
def get_parser(parser_mod_name: Union[str, ModuleType]) -> ModuleType
def get_parser(parser_mod_name: Union[str, module]) -> module
```
Return the parser module object and check that the module is a valid
@@ -56,13 +94,13 @@ Raises:
```python
def parse(
parser_mod_name: Union[str, ModuleType],
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[JSONDictType, List[JSONDictType], Iterator[JSONDictType]]
) -> Union[Dict[str, Any], List[Dict[str, Any]], Iterator[Dict[str, Any]]]
```
Parse the data (string or bytes) using the supplied parser (string or
@@ -152,73 +190,13 @@ Returns:
Standard Parsers: Dictionary or List of Dictionaries
Streaming Parsers: Generator Object containing Dictionaries
<a id="jc.lib.parser_mod_list"></a>
### parser\_mod\_list
```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.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()`.
<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.parser_info"></a>
### parser\_info
### parser_info
```python
def parser_info(parser_mod_name: Union[str, ModuleType],
documentation: bool = False) -> ParserInfoType
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.
@@ -233,39 +211,64 @@ Parameters:
documentation: (boolean) include parser docstring if True
<a id="jc.lib.all_parser_info"></a>
<a id="jc.lib.parser_mod_list"></a>
### all\_parser\_info
### parser_mod_list
```python
def all_parser_info(documentation: bool = False,
show_hidden: bool = False,
show_deprecated: bool = False) -> List[ParserInfoType]
def parser_mod_list(show_hidden: bool = False,
show_deprecated: bool = False) -> List[str]
```
Returns a list of dictionaries that includes metadata for all parser
modules. By default only non-hidden, non-deprecated parsers are
returned.
Returns a list of all available parser module names.
Parameters:
<a id="jc.lib.plugin_parser_mod_list"></a>
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
### plugin_parser_mod_list
```python
def get_help(parser_mod_name: Union[str, ModuleType]) -> None
def plugin_parser_mod_list(show_hidden: bool = False,
show_deprecated: bool = False) -> List[str]
```
Show help screen for the selected parser.
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()`.
This function will accept **module_name**, **cli-name**, and
**--argument-name** variants of the module name string as well as a
parser module object.

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.airport_s"></a>
# jc.parsers.airport\_s
# jc.parsers.airport_s
jc - JSON Convert `airport -s` command output parser

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,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.asciitable_m"></a>
# jc.parsers.asciitable\_m
# jc.parsers.asciitable_m
jc - JSON Convert `asciitable-m` parser

View File

@@ -33,6 +33,8 @@ 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,
@@ -70,7 +72,8 @@ a controller and a device but there might be fields corresponding to one entity.
"rssi": int,
"txpower": int,
"uuids": array,
"modalias": string
"modalias": string,
"battery_percentage": int
}
]
@@ -101,7 +104,8 @@ Examples:
"Headset HS (00001831-0000-1000-8000-00805f9b34fb)"
],
"rssi": -52,
"txpower": 4
"txpower": 4,
"battery_percentage": 70
}
]
@@ -112,7 +116,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function
@@ -132,4 +136,4 @@ Compatibility: linux
Source: [`jc/parsers/bluetoothctl.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/bluetoothctl.py)
Version 1.1 by Jake Ob (iakopap at gmail.com)
Version 1.4 by Jake Ob (iakopap at gmail.com)

View File

@@ -104,7 +104,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.cef_s"></a>
# jc.parsers.cef\_s
# jc.parsers.cef_s
jc - JSON Convert CEF string output streaming parser
@@ -95,7 +95,6 @@ Examples:
### parse
```python
@add_jc_meta
def parse(data: Iterable[str],
raw: bool = False,
quiet: bool = False,

View File

@@ -140,7 +140,7 @@ Examples:
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> JSONDictType
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
```
Main text parsing function

View File

@@ -178,7 +178,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.clf_s"></a>
# jc.parsers.clf\_s
# jc.parsers.clf_s
jc - JSON Convert Common Log Format file streaming parser
@@ -88,11 +88,12 @@ Examples:
### parse
```python
@add_jc_meta
def parse(data: Iterable[str],
raw: bool = False,
quiet: bool = False,
ignore_exceptions: bool = False) -> StreamingOutputType
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.

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.crontab_u"></a>
# jc.parsers.crontab\_u
# jc.parsers.crontab_u
jc - JSON Convert `crontab -l` command output and crontab
file parser

View File

@@ -84,7 +84,7 @@ Examples:
```python
def parse(data: Union[str, bytes],
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.csv_s"></a>
# jc.parsers.csv\_s
# jc.parsers.csv_s
jc - JSON Convert `csv` file streaming parser
@@ -64,7 +64,6 @@ Examples:
### parse
```python
@add_jc_meta
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
```

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.curl_head"></a>
# jc.parsers.curl\_head
# jc.parsers.curl_head
jc - JSON Convert `curl --head` command output parser
@@ -286,7 +286,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.datetime_iso"></a>
# jc.parsers.datetime\_iso
# jc.parsers.datetime_iso
jc - JSON Convert ISO 8601 Datetime string parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.debconf_show"></a>
# jc.parsers.debconf\_show
# jc.parsers.debconf_show
jc - JSON Convert `debconf-show` command output parser
@@ -84,7 +84,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function

View File

@@ -5,6 +5,8 @@
jc - JSON Convert `df` command output parser
Values are normalized to bytes when using `df -h`.
Usage (cli):
$ df | jc --df
@@ -23,7 +25,7 @@ Schema:
[
{
"filesystem": string,
"size": string,
"size": integer,
"1k_blocks": integer,
"512_blocks": integer,
"used": integer,
@@ -122,4 +124,4 @@ Compatibility: linux, darwin, freebsd
Source: [`jc/parsers/df.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/df.py)
Version 1.11 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 2.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.dpkg_l"></a>
# jc.parsers.dpkg\_l
# jc.parsers.dpkg_l
jc - JSON Convert `dpkg -l` command output parser

View File

@@ -81,7 +81,7 @@ Examples:
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> JSONDictType
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
```
Main text parsing function

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.email_address"></a>
# jc.parsers.email\_address
# jc.parsers.email_address
jc - JSON Convert Email Address string parser

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

@@ -96,7 +96,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function

View File

@@ -5,6 +5,8 @@
jc - JSON Convert `free` command output parser
Values are normalized to bytes when using `free -h`.
Usage (cli):
$ free | jc --free
@@ -22,13 +24,13 @@ 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
}
]
@@ -97,4 +99,4 @@ Compatibility: linux
Source: [`jc/parsers/free.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/free.py)
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.git_log"></a>
# jc.parsers.git\_log
# jc.parsers.git_log
jc - JSON Convert `git log` command output parser
@@ -55,6 +55,12 @@ Schema:
"deletions": integer,
"files": [
string
],
"file_stats": [
{
"name": string,
"lines_changed": integer
}
]
}
}
@@ -79,6 +85,16 @@ Examples:
"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",
@@ -100,6 +116,28 @@ Examples:
"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",
@@ -123,6 +161,16 @@ Examples:
"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"
@@ -142,6 +190,28 @@ Examples:
"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"
@@ -174,4 +244,4 @@ 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.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.git_log_s"></a>
# jc.parsers.git\_log\_s
# jc.parsers.git_log_s
jc - JSON Convert `git log` command output streaming parser
@@ -56,6 +56,12 @@ Schema:
"deletions": integer,
"files": [
string
],
"file_stats": [
{
"name": string,
"lines_changed": integer
}
]
}
@@ -82,7 +88,6 @@ Examples:
### parse
```python
@add_jc_meta
def parse(data: Iterable[str],
raw: bool = False,
quiet: bool = False,
@@ -110,4 +115,4 @@ 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.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.git_ls_remote"></a>
# jc.parsers.git\_ls\_remote
# jc.parsers.git_ls_remote
jc - JSON Convert `git ls-remote` command output parser
@@ -71,7 +71,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> Union[JSONDictType, List[JSONDictType]]
quiet: bool = False) -> Union[Dict[str, Any], List[Dict[str, Any]]]
```
Main text parsing function

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.http_headers"></a>
# jc.parsers.http\_headers
# jc.parsers.http_headers
jc - JSON Convert HTTP headers parser
@@ -313,7 +313,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function

View File

@@ -222,7 +222,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function
@@ -242,4 +242,4 @@ Compatibility: linux, aix, freebsd, darwin
Source: [`jc/parsers/ifconfig.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ifconfig.py)
Version 2.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 2.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ini_dup"></a>
# jc.parsers.ini\_dup
# jc.parsers.ini_dup
jc - JSON Convert INI with duplicate key file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.iostat_s"></a>
# jc.parsers.iostat\_s
# jc.parsers.iostat_s
jc - JSON Convert `iostat` command output streaming parser
@@ -108,7 +108,6 @@ Examples:
### parse
```python
@add_jc_meta
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
```

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ip_address"></a>
# jc.parsers.ip\_address
# jc.parsers.ip_address
jc - JSON Convert IP Address string parser
@@ -556,4 +556,4 @@ Source: [`jc/parsers/ip_address.py`](https://github.com/kellyjonbrazil/jc/blob/m
This parser can be used with the `--slurp` command-line option.
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ip_route"></a>
# jc.parsers.ip\_route
# jc.parsers.ip_route
jc - JSON Convert `ip route` command output parser

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

@@ -5,7 +5,7 @@
jc - JSON Convert `iptables` command output parser
Supports `-vLn` and `--line-numbers` for all tables.
Supports `-vLnx` and `--line-numbers` for all tables.
Usage (cli):
@@ -25,6 +25,9 @@ Schema:
[
{
"chain": string,
"default_policy": string,
"default_packets": integer,
"default_bytes": integer,
"rules": [
{
"num" integer,
@@ -49,6 +52,9 @@ Examples:
[
{
"chain": "PREROUTING",
"default_policy": "DROP",
"default_packets": 0,
"default_bytes": 0,
"rules": [
{
"num": 1,
@@ -108,6 +114,9 @@ Examples:
[
{
"chain": "PREROUTING",
"default_policy": "DROP",
"default_packets": "0",
"default_bytes": "0",
"rules": [
{
"num": "1",
@@ -188,4 +197,4 @@ Compatibility: linux
Source: [`jc/parsers/iptables.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/iptables.py)
Version 1.10 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.12 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.iw_scan"></a>
# jc.parsers.iw\_scan
# jc.parsers.iw_scan
jc - JSON Convert `iw dev <device> scan` command output parser
@@ -146,4 +146,4 @@ Compatibility: linux
Source: [`jc/parsers/iw_scan.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/iw_scan.py)
Version 0.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 0.75 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -90,7 +90,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function
@@ -110,4 +110,4 @@ Compatibility: linux
Source: [`jc/parsers/iwconfig.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/iwconfig.py)
Version 1.1 by Thomas Vincent (vrince@gmail.com)
Version 1.2 by Thomas Vincent (vrince@gmail.com)

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.jar_manifest"></a>
# jc.parsers.jar\_manifest
# jc.parsers.jar_manifest
jc - JSON Convert Java `MANIFEST.MF` file parser

View File

@@ -81,4 +81,4 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Source: [`jc/parsers/kv.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/kv.py)
Version 2.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 2.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.kv_dup"></a>
# jc.parsers.kv\_dup
# jc.parsers.kv_dup
jc - JSON Convert `Key/Value` with duplicate key file and string parser
@@ -88,4 +88,4 @@ 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.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ls_s"></a>
# jc.parsers.ls\_s
# jc.parsers.ls_s
jc - JSON Convert `ls` and `vdir` command output streaming parser
@@ -77,7 +77,6 @@ Examples:
### parse
```python
@add_jc_meta
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
```

View File

@@ -69,7 +69,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.lsb_release"></a>
# jc.parsers.lsb\_release
# jc.parsers.lsb_release
jc - JSON Convert `lsb_release` command parser
@@ -40,7 +40,7 @@ Examples:
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> JSONDictType
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
```
Main text parsing function
@@ -60,4 +60,4 @@ 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.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -22,46 +22,53 @@ 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
}
]
@@ -74,6 +81,7 @@ Examples:
"maj_min": "8:0",
"rm": false,
"size": "20G",
"size_bytes": 20000000000,
"ro": false,
"type": "disk",
"mountpoint": null
@@ -83,6 +91,7 @@ Examples:
"maj_min": "8:1",
"rm": false,
"size": "1G",
"size_bytes": 1000000000
"ro": false,
"type": "part",
"mountpoint": "/boot"
@@ -100,6 +109,7 @@ Examples:
"maj_min": "8:0",
"rm": false,
"size": "20G",
"size_bytes": 20000000000,
"ro": false,
"type": "disk",
"mountpoint": null,
@@ -126,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,
@@ -142,6 +155,7 @@ Examples:
"maj_min": "8:1",
"rm": false,
"size": "1G",
"size_bytes": 1000000000
"ro": false,
"type": "part",
"mountpoint": "/boot",
@@ -168,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",
@@ -192,6 +209,7 @@ Examples:
"maj_min": "8:0",
"rm": "0",
"size": "20G",
"size_bytes": 20000000000,
"ro": "0",
"type": "disk",
"mountpoint": null,
@@ -218,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,
@@ -234,6 +255,7 @@ Examples:
"maj_min": "8:1",
"rm": "0",
"size": "1G",
"size_bytes": 1000000000
"ro": "0",
"type": "part",
"mountpoint": "/boot",
@@ -260,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",
@@ -299,4 +324,4 @@ Compatibility: linux
Source: [`jc/parsers/lsblk.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/lsblk.py)
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.10 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -53,7 +53,6 @@ Schema:
"sdevice_id_int": integer,
"rev": string,
"physlot": string,
"physlot_int": integer,
"progif": string,
"progif_int": integer
}
@@ -89,7 +88,6 @@ Examples:
"sdevice_id": "07e0",
"sdevice_id_int": 2016,
"physlot": "37",
"physlot_int": 55,
"progif": "01",
"progif_int": 1
},
@@ -127,7 +125,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function
@@ -147,4 +145,4 @@ Compatibility: linux
Source: [`jc/parsers/lspci.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/lspci.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -100,4 +100,4 @@ Compatibility: linux, darwin, freebsd, aix
Source: [`jc/parsers/mount.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/mount.py)
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.11 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.mpstat_s"></a>
# jc.parsers.mpstat\_s
# jc.parsers.mpstat_s
jc - JSON Convert `mpstat` command output streaming parser
@@ -100,7 +100,6 @@ Examples:
### parse
```python
@add_jc_meta
def parse(data: Iterable[str],
raw: bool = False,
quiet: bool = False,

101
docs/parsers/needrestart.md Normal file
View File

@@ -0,0 +1,101 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.needrestart"></a>
# jc.parsers.needrestart
jc - JSON Convert `needrestart -b` command output parser
Usage (cli):
$ needrestart -b | jc --needrestart
or
$ jc needrestart -b
Usage (module):
import jc
result = jc.parse('needrestart', needrestart_command_output)
Schema:
{
"version": string,
"running_kernel_version": string,
"expected_kernel_version": string,
"kernel_status": integer,
"container": string,
"session": [
string
],
"service": [
string
],
"pid": [
string
]
}
Examples:
$ needrestart -b | jc --needrestart -p
{
"version": "2.1",
"running_kernel_version": "3.19.3-tl1+",
"expected_kernel_version": "3.19.3-tl1+",
"kernel_status": 1,
"container": "LXC web1",
"session": [
"metabase @ user manager service",
"root @ session #28017"
],
"service": [
"systemd-journald.service",
"systemd-machined.service"
]
}
$ needrestart -b | jc --needrestart -p -r
{
"needrestart_ver": "2.1",
"needrestart_kcur": "3.19.3-tl1+",
"needrestart_kexp": "3.19.3-tl1+",
"needrestart_ksta": "1",
"needrestart_cont": "LXC web1",
"needrestart_sess": [
"metabase @ user manager service",
"root @ session #28017"
],
"needrestart_svc": [
"systemd-journald.service",
"systemd-machined.service"
]
}
<a id="jc.parsers.needrestart.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/needrestart.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/needrestart.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -380,4 +380,4 @@ Compatibility: linux, darwin, freebsd, win32
Source: [`jc/parsers/netstat.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/netstat.py)
Version 1.15 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.16 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -41,6 +41,7 @@ These are documented below.
[
{
"<key>": string/integer/float, # [0]
"team_config": object,
"dhcp4_option_x": {
"name": string,
"value": string/integer/float,
@@ -170,4 +171,4 @@ Compatibility: linux
Source: [`jc/parsers/nmcli.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/nmcli.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.nsd_control"></a>
# jc.parsers.nsd\_control
# jc.parsers.nsd_control
jc - JSON Convert `nsd-control` command output parser
@@ -22,20 +22,24 @@ Schema:
[
{
"version": string,
"verbosity": integer,
"ratelimit": integer
"version": string,
"verbosity": integer,
"ratelimit": integer
}
]
[
{
"zone": string
"zone": string
"status": {
"state": string,
"served-serial": string,
"commit-serial": string,
"wait": string
"state": string,
"pattern": string, # Additional
"catalog-member-id": string, # Additional
"served-serial": string,
"commit-serial": string,
"notified-serial": string, # Conditional
"wait": string,
"transfer": string # Conditional
}
}
]
@@ -89,4 +93,4 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Source: [`jc/parsers/nsd_control.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/nsd_control.py)
Version 1.1 by Pettai (pettai@sunet.se)
Version 1.2 by Pettai (pettai@sunet.se)

View File

@@ -157,7 +157,7 @@ Examples:
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> JSONDictType
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
```
Main text parsing function

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.os_prober"></a>
# jc.parsers.os\_prober
# jc.parsers.os_prober
jc - JSON Convert `os-prober` command output parser
@@ -45,7 +45,7 @@ Examples:
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> JSONDictType
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
```
Main text parsing function

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.os_release"></a>
# jc.parsers.os\_release
# jc.parsers.os_release
jc - JSON Convert `/etc/os-release` file parser
@@ -65,7 +65,7 @@ Examples:
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> JSONDictType
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
```
Main text parsing function
@@ -85,4 +85,4 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Source: [`jc/parsers/os_release.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/os_release.py)
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

208
docs/parsers/pacman.md Normal file
View File

@@ -0,0 +1,208 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.pacman"></a>
# jc.parsers.pacman
jc - JSON Convert `pacman` command output parser
Supports the following `pacman` arguments:
- `-Si`
- `-Sii`
- `-Qi`
- `-Qii`
The `*_epoch` calculated timestamp fields are naive. (i.e. based on the
local time of the system the parser is run on)
Usage (cli):
$ pacman -Si <package> | jc --pacman
or
$ jc pacman -Si <package>
Usage (module):
import jc
result = jc.parse('pacman', pacman_command_output)
Schema:
[
{
"repository": string,
"name": string,
"version": string,
"description": string,
"architecture": string,
"url": string,
"licenses": [
string
],
"groups": [
string
],
"provides": [
string
],
"depends_on": [
string
],
"optional_deps": [
{
"name": string,
"description": string
}
],
"optional_for": [
string
],
"conflicts_with": [
string
],
"replaces": [
string
],
"download_size": string,
"download_size_bytes": integer [0]
"installed_size": string,
"installed_size_bytes": integer, [0]
"packager": string,
"build_date": string,
"build_date_epoch": integer, [0]
"install_date": string,
"install_date_epoch": integer, [0]
"validated_by": [
string
],
"backup_files": [
string
]
}
]
[0] Field exists if conversion successful
Examples:
$ pacman -qii zstd | jc --pacman -p
[
{
"name": "zstd",
"version": "1.5.6-1",
"description": "Zstandard - Fast real-time compression algorithm",
"architecture": "x86_64",
"url": "https://facebook.github.io/zstd/",
"licenses": [
"BSD-3-Clause",
"GPL-2.0-only"
],
"groups": [],
"provides": [
"libzstd.so=1-64"
],
"depends_on": [
"glibc",
"gcc-libs",
"zlib",
"xz",
"lz4"
],
"required_by": [
"android-tools",
"appstream",
...
"tiled",
"vulkan-radeon",
"wireshark-cli"
],
"optional_for": [
"xarchiver"
],
"conflicts_with": [],
"replaces": [],
"installed_size": "1527.00 KiB",
"installed_size_bytes": 1563648,
"packager": "Levente Polyak <anthraxx@archlinux.org>",
"build_date": "Sat 11 May 2024 06:14:19 AM +08",
"build_date_epoch": 1715433259,
"install_date": "Fri 24 May 2024 09:50:31 AM +08",
"install_date_epoch": 1715663342,
"install_reason": "Installed as a dependency for another package",
"install_script": "No",
"validated_by": [
"Signature"
],
"extended_data": "pkgtype=pkg"
}
]
$ pacman -qii zstd | jc --pacman -p -r
[
{
"name": "zstd",
"version": "1.5.6-1",
"description": "Zstandard - Fast real-time compression algorithm",
"architecture": "x86_64",
"url": "https://facebook.github.io/zstd/",
"licenses": "BSD-3-Clause GPL-2.0-only",
"groups": null,
"provides": "libzstd.so=1-64",
"depends_on": "glibc gcc-libs zlib xz lz4",
"required_by": [
"android-tools appstream avr-gcc binutils blender blosc",
"boost-libs btrfs-progs cloudflare-warp-bin comgr curl",
"dolphin-emu file flatpak gcc gdal gnutls karchive",
"karchive5 kmod lib32-zstd libarchive libelf libtiff",
"libva-mesa-driver libxmlb libzip lld llvm-libs mariadb-libs",
"mesa mesa-vdpau minizip-ng mkinitcpio mold netcdf",
"opencl-clover-mesa opencl-rusticl-mesa openucx postgresql",
"postgresql-libs ppsspp qemu-img qemu-system-riscv",
"qemu-system-x86 qgis qt6-base qt6-tools rsync rustup",
"squashfs-tools squashfuse systemd-libs tiled vulkan-radeon",
"wireshark-cli"
],
"optional_for": "xarchiver",
"conflicts_with": null,
"replaces": null,
"installed_size": "1527.00 KiB",
"packager": "Levente Polyak <anthraxx@archlinux.org>",
"build_date": "Sat 11 May 2024 06:14:19 AM +08",
"install_date": "Fri 24 May 2024 09:50:31 AM +08",
"install_reason": "Installed as a dependency for another package",
"install_script": "No",
"validated_by": "Signature",
"extended_data": "pkgtype=pkg"
}
]
<a id="jc.parsers.pacman.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/pacman.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/pacman.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.path_list"></a>
# jc.parsers.path\_list
# jc.parsers.path_list
jc - JSON Convert POSIX path list string parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.pci_ids"></a>
# jc.parsers.pci\_ids
# jc.parsers.pci_ids
jc - JSON Convert `pci.ids` file parser
@@ -78,7 +78,7 @@ Examples:
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> JSONDictType
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
```
Main text parsing function
@@ -98,4 +98,4 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Source: [`jc/parsers/pci_ids.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/pci_ids.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -54,7 +54,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.pidstat_s"></a>
# jc.parsers.pidstat\_s
# jc.parsers.pidstat_s
jc - JSON Convert `pidstat -H` command output streaming parser
@@ -86,7 +86,6 @@ Examples:
### parse
```python
@add_jc_meta
def parse(data: Iterable[str],
raw: bool = False,
quiet: bool = False,

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ping_s"></a>
# jc.parsers.ping\_s
# jc.parsers.ping_s
jc - JSON Convert `ping` command output streaming parser
@@ -86,7 +86,6 @@ Examples:
### parse
```python
@add_jc_meta
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
```
@@ -110,4 +109,4 @@ Compatibility: linux, darwin, freebsd
Source: [`jc/parsers/ping_s.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ping_s.py)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.pip_list"></a>
# jc.parsers.pip\_list
# jc.parsers.pip_list
jc - JSON Convert `pip-list` command output parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.pip_show"></a>
# jc.parsers.pip\_show
# jc.parsers.pip_show
jc - JSON Convert `pip-show` command output parser
@@ -90,4 +90,4 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Source: [`jc/parsers/pip_show.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/pip_show.py)
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.pkg_index_apk"></a>
# jc.parsers.pkg\_index\_apk
# jc.parsers.pkg_index_apk
jc - JSON Convert Alpine Linux Package Index files

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.pkg_index_deb"></a>
# jc.parsers.pkg\_index\_deb
# jc.parsers.pkg_index_deb
jc - JSON Convert Debian Package Index file parser
@@ -27,9 +27,15 @@ Schema:
"maintainer": string,
"description": string,
"homepage": string,
"depends": string,
"conflicts": string,
"replaces": string,
"depends": [
string
],
"conflicts": [
string
],
"replaces": [
string
],
"vcs_git": string,
"sha256": string,
"size": integer,
@@ -43,35 +49,44 @@ Examples:
$ cat Packages | jc --pkg-index-deb
[
{
"package": "aspnetcore-runtime-2.1",
"version": "2.1.22-1",
"package": "dotnet-host",
"version": "3.1.16-1",
"architecture": "amd64",
"section": "libs",
"priority": "standard",
"installed_size": 146,
"maintainer": ".NET Core Team <dotnetpackages@dotnetfoundation.org>",
"description": "Microsoft .NET Core Host - 3.1.16",
"homepage": "https://dot.net/core",
"conflicts": [
"dotnet",
"dotnet-nightly"
],
"depends": [
"libgcc1",
"libstdc++6",
"libc6"
],
"sha256": "2557da13447d61382f255eb751ba29cc1a8220899c1e3e640a7bb3d2a0c1d297",
"size": 32594,
"filename": "pool/main/d/dotnet-host/dotnet-host-3.1.16-x64.deb"
},
{
"package": "aspnetcore-runtime-5.0",
"version": "5.0.10-1",
"architecture": "amd64",
"section": "devel",
"priority": "standard",
"installed_size": 71081,
"installed_size": 18551,
"maintainer": "Microsoft <nugetaspnet@microsoft.com>",
"description": "Microsoft ASP.NET Core 2.1.22 Shared Framework",
"homepage": "https://www.asp.net/",
"depends": "libc6 (>= 2.14), dotnet-runtime-2.1 (>= 2.1.22)",
"sha256": "48d4e78a7ceff34105411172f4c3e91a0359b3929d84d26a493...",
"size": 21937036,
"filename": "pool/main/a/aspnetcore-runtime-2.1/aspnetcore-run..."
},
{
"package": "azure-functions-core-tools-4",
"version": "4.0.4590-1",
"architecture": "amd64",
"section": "devel",
"priority": "optional",
"maintainer": "Ahmed ElSayed <ahmels@microsoft.com>",
"description": "Azure Function Core Tools v4",
"homepage": "https://docs.microsoft.com/en-us/azure/azure-func...",
"conflicts": "azure-functions-core-tools-2, azure-functions-co...",
"replaces": "azure-functions-core-tools-2, azure-functions-cor...",
"vcs_git": "https://github.com/Azure/azure-functions-core-tool...",
"sha256": "a2a4f99d6d98ba0a46832570285552f2a93bab06cebbda2afc7...",
"size": 124417844,
"filename": "pool/main/a/azure-functions-core-tools-4/azure-fu..."
"description": "Shared Framework for hosting of Microsoft ASP.NET Core applications. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/aspnetcore). We happily accept issues and PRs.",
"homepage": "https://asp.net",
"depends": [
"dotnet-runtime-5.0 (>= 5.0.10)"
],
"sha256": "1d9869f862cb4e9c46b245a343d8e39fbbc84d9f8ab9ef357c4643da20805ad3",
"size": 6084188,
"filename": "pool/main/a/aspnetcore-runtime-5.0/aspnetcore-runtime-5.0.10-x64.deb"
}
]
@@ -117,7 +132,7 @@ Examples:
```python
def parse(data: str,
raw: bool = False,
quiet: bool = False) -> List[JSONDictType]
quiet: bool = False) -> List[Dict[str, Any]]
```
Main text parsing function
@@ -137,4 +152,4 @@ Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Source: [`jc/parsers/pkg_index_deb.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/pkg_index_deb.py)
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -31,7 +31,7 @@ or
or
$ cat /proc/meminfo | jc --proc-memifno
$ cat /proc/meminfo | jc --proc-meminfo
Usage (module):
@@ -52,7 +52,7 @@ Specific Proc file parser names can be found with `jc -hh` or `jc -a`.
Schemas can also be found online at:
https://kellyjonbrazil.github.io/jc/docs/parsers/proc_<name>
https://kellyjonbrazil.github.io/jc/docs/parsers/proc_<name>
For example:
@@ -151,4 +151,4 @@ Source: [`jc/parsers/proc.py`](https://github.com/kellyjonbrazil/jc/blob/master/
This parser can be used with the `--slurp` command-line option.
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_buddyinfo"></a>
# jc.parsers.proc\_buddyinfo
# jc.parsers.proc_buddyinfo
jc - JSON Convert `/proc/buddyinfo` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_cmdline"></a>
# jc.parsers.proc\_cmdline
# jc.parsers.proc_cmdline
jc - JSON Convert `/proc/cmdline` file parser
@@ -71,7 +71,7 @@ Examples:
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> JSONDictType
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
```
Main text parsing function

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_consoles"></a>
# jc.parsers.proc\_consoles
# jc.parsers.proc_consoles
jc - JSON Convert `/proc/consoles` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_cpuinfo"></a>
# jc.parsers.proc\_cpuinfo
# jc.parsers.proc_cpuinfo
jc - JSON Convert `/proc/cpuinfo` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_crypto"></a>
# jc.parsers.proc\_crypto
# jc.parsers.proc_crypto
jc - JSON Convert `/proc/crypto` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_devices"></a>
# jc.parsers.proc\_devices
# jc.parsers.proc_devices
jc - JSON Convert `/proc/devices` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_diskstats"></a>
# jc.parsers.proc\_diskstats
# jc.parsers.proc_diskstats
jc - JSON Convert `/proc/diskstats` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_driver_rtc"></a>
# jc.parsers.proc\_driver\_rtc
# jc.parsers.proc_driver_rtc
jc - JSON Convert `/proc/driver/rtc` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_filesystems"></a>
# jc.parsers.proc\_filesystems
# jc.parsers.proc_filesystems
jc - JSON Convert `/proc/filesystems` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_interrupts"></a>
# jc.parsers.proc\_interrupts
# jc.parsers.proc_interrupts
jc - JSON Convert `/proc/interrupts` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_iomem"></a>
# jc.parsers.proc\_iomem
# jc.parsers.proc_iomem
jc - JSON Convert `/proc/iomem` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_ioports"></a>
# jc.parsers.proc\_ioports
# jc.parsers.proc_ioports
jc - JSON Convert `/proc/ioports` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_loadavg"></a>
# jc.parsers.proc\_loadavg
# jc.parsers.proc_loadavg
jc - JSON Convert `/proc/loadavg` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_locks"></a>
# jc.parsers.proc\_locks
# jc.parsers.proc_locks
jc - JSON Convert `/proc/locks` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_meminfo"></a>
# jc.parsers.proc\_meminfo
# jc.parsers.proc_meminfo
jc - JSON Convert `/proc/meminfo` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_modules"></a>
# jc.parsers.proc\_modules
# jc.parsers.proc_modules
jc - JSON Convert `/proc/modules` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_mtrr"></a>
# jc.parsers.proc\_mtrr
# jc.parsers.proc_mtrr
jc - JSON Convert `/proc/mtrr` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_arp"></a>
# jc.parsers.proc\_net\_arp
# jc.parsers.proc_net_arp
jc - JSON Convert `/proc/net/arp` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_dev"></a>
# jc.parsers.proc\_net\_dev
# jc.parsers.proc_net_dev
jc - JSON Convert `/proc/net/dev` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_dev_mcast"></a>
# jc.parsers.proc\_net\_dev\_mcast
# jc.parsers.proc_net_dev_mcast
jc - JSON Convert `/proc/net/dev_mcast` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_if_inet6"></a>
# jc.parsers.proc\_net\_if\_inet6
# jc.parsers.proc_net_if_inet6
jc - JSON Convert `/proc/net/if_inet6` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_igmp"></a>
# jc.parsers.proc\_net\_igmp
# jc.parsers.proc_net_igmp
jc - JSON Convert `/proc/net/igmp` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_igmp6"></a>
# jc.parsers.proc\_net\_igmp6
# jc.parsers.proc_net_igmp6
jc - JSON Convert `/proc/net/igmp6` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_ipv6_route"></a>
# jc.parsers.proc\_net\_ipv6\_route
# jc.parsers.proc_net_ipv6_route
jc - JSON Convert `/proc/net/ipv6_route` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_netlink"></a>
# jc.parsers.proc\_net\_netlink
# jc.parsers.proc_net_netlink
jc - JSON Convert `/proc/net/netlink` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_netstat"></a>
# jc.parsers.proc\_net\_netstat
# jc.parsers.proc_net_netstat
jc - JSON Convert `/proc/net/netstat` file parser

View File

@@ -1,7 +1,7 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_net_packet"></a>
# jc.parsers.proc\_net\_packet
# jc.parsers.proc_net_packet
jc - JSON Convert `/proc/net/packet` file parser

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