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

Compare commits

...

2323 Commits

Author SHA1 Message Date
Kelly Brazil
fecb2193ae Merge pull request #234 from kellyjonbrazil/dev
Dev v1.18.7
2022-04-25 17:17:49 -07:00
Kelly Brazil
46af3bd0c0 add UnicodeError fix 2022-04-25 17:04:19 -07:00
Kelly Brazil
c245c89f82 don't try to detect locale, just asciify on exception 2022-04-25 16:51:00 -07:00
Kelly Brazil
a8f0cd9dae C locale fixes 2022-04-25 14:48:59 -07:00
Kelly Brazil
3101189d47 doc update 2022-04-25 08:39:33 -07:00
Kelly Brazil
3f0b644b85 fix test 2022-04-25 08:37:03 -07:00
Kelly Brazil
25c2c483f8 Merge pull request #233 from chriscroome/dev
Update name of alternative from name to alternative
2022-04-25 08:34:34 -07:00
Chris Croome
8bc2ea14a3 Whitespace fix 2022-04-25 11:20:36 +01:00
Chris Croome
8d4f22d9a5 Merge branch 'dev' of github.com:chriscroome/jc into dev 2022-04-25 11:16:47 +01:00
Chris Croome
d2adc2630c Use alternative rather than name to match manpage 2022-04-25 11:16:20 +01:00
Chris Croome
727f2b589e Use alternative rather than name toi match manpage 2022-04-25 11:14:18 +01:00
Kelly Brazil
abbfc92da0 clarify plugin filename requirements 2022-04-22 17:05:22 -07:00
Kelly Brazil
73b7e71cad add tests 2022-04-22 16:25:45 -07:00
Kelly Brazil
4825b16f07 doc update 2022-04-22 15:23:11 -07:00
Kelly Brazil
d2013366cc add update-alternatives examples 2022-04-22 15:20:20 -07:00
Kelly Brazil
96609a2c70 add update-alternatives --get-selections parser 2022-04-22 15:10:48 -07:00
Kelly Brazil
39306573da add update-alternatives parser 2022-04-22 14:47:07 -07:00
Kelly Brazil
01e330aa97 precompile regex patterns 2022-04-22 13:33:36 -07:00
Kelly Brazil
f08a74097d add tests 2022-04-22 12:12:45 -07:00
Kelly Brazil
79e37a7383 fix for oneline output 2022-04-22 12:12:38 -07:00
Kelly Brazil
3eebb6ee19 add update-alternatives parser info 2022-04-22 12:11:56 -07:00
Kelly Brazil
096fffdb79 use stat examples 2022-04-20 10:03:36 -04:00
Kelly Brazil
728d882ed0 add timestamp docs and examples 2022-04-20 09:50:19 -04:00
Kelly Brazil
b53e42aca6 add calculated timestamp 2022-04-20 09:44:42 -04:00
Kelly Brazil
477329ce5b add linefeed to version text 2022-04-20 08:26:26 -04:00
Kelly Brazil
283dc4efd5 add python interpreter version and path to -v and -a output 2022-04-19 17:44:15 -04:00
Kelly Brazil
d490bbcaa0 normalize add/update 2022-04-19 15:26:31 -04:00
Kelly Brazil
f49ddf8e5c doc update 2022-04-19 15:18:04 -04:00
Kelly Brazil
e1e341652b doc update 2022-04-19 15:10:40 -04:00
Kelly Brazil
ecda667549 process integers 2022-04-19 15:10:35 -04:00
Kelly Brazil
a0d96a188a doc update 2022-04-19 14:45:20 -04:00
Kelly Brazil
6c0f0cddfe fix for datetime objects in yaml files 2022-04-19 14:43:47 -04:00
Kelly Brazil
c7173ecd89 fix mypy issues 2022-04-19 14:34:53 -04:00
Kelly Brazil
e98240c905 extend instead of append list 2022-04-19 14:20:44 -04:00
Kelly Brazil
6cb7e25974 add docs 2022-04-19 13:17:24 -04:00
Kelly Brazil
c37980c05c add stat support 2022-04-19 13:17:16 -04:00
Kelly Brazil
b5943bd39d initial docstring 2022-04-19 10:32:55 -04:00
Kelly Brazil
49a3a7db3b initial git-log parser 2022-04-19 09:30:38 -04:00
Kelly Brazil
0c55240e9d move test templates to fix test failures on some systems 2022-04-13 10:54:28 -07:00
Kelly Brazil
f91988aed5 iterator -> iterable 2022-04-12 14:22:06 -07:00
Kelly Brazil
3c3ad9fc6a iterator -> iterable in doc 2022-04-12 14:20:58 -07:00
Kelly Brazil
291ab79e22 fix arch linux command 2022-04-12 11:07:34 -07:00
Kelly Brazil
e6d5892c14 Merge pull request #226 from kellyjonbrazil/master
sync to dev
2022-04-12 11:02:37 -07:00
Kelly Brazil
dcca7a57d5 Merge pull request #225 from adrianteri/patch-1
Update README
2022-04-12 11:00:51 -07:00
003
4ee8a69337 Update README
Specify the Arch package is in the AUR and NOT in the standard Archlinux repositories.
2022-04-12 20:53:39 +03:00
Kelly Brazil
c0414e7db7 clean up background tasks 2022-04-10 17:18:20 -07:00
Kelly Brazil
a419175fe6 enhance parallelization 2022-04-10 17:14:34 -07:00
Kelly Brazil
cd6dead034 man page update 2022-04-10 16:54:34 -07:00
Kelly Brazil
45342ea9fe parallelize doc gneration 2022-04-10 16:54:22 -07:00
Kelly Brazil
585bf0e159 xrandr update 2022-04-10 10:32:51 -07:00
Kelly Brazil
3a860b9bab add rotation field 2022-04-10 10:31:13 -07:00
Kelly Brazil
269180df77 Merge pull request #223 from anekos/fix/support-rotated-devices
Fix/support rotated devices
2022-04-10 10:19:50 -07:00
anekos
a1afed8d95 doc update 2022-04-10 19:53:37 +09:00
anekos
e39f150a21 Support rotated devices 2022-04-10 19:53:37 +09:00
Kelly Brazil
e85f11c6fc doc formatting 2022-04-04 12:00:41 -07:00
Kelly Brazil
49a9d7b07e doc update 2022-04-04 11:42:16 -07:00
Kelly Brazil
a2ef9c429e allow duplicate keys 2022-04-04 11:38:52 -07:00
Kelly Brazil
d5e9074f1c version bump 2022-04-04 11:38:04 -07:00
Kelly Brazil
774699f085 Merge pull request #220 from kellyjonbrazil/master
sync to dev
2022-04-04 18:21:15 +00:00
Kelly Brazil
7138eef3d1 fix newline chars in doc 2022-03-30 14:39:56 -07:00
Kelly Brazil
fad5e544aa formatting 2022-03-29 09:58:44 -07:00
Kelly Brazil
64757e2cf5 doc formatting 2022-03-29 09:35:54 -07:00
Kelly Brazil
e05be3f08b Merge pull request #213 from kellyjonbrazil/dev
Dev v1.18.6
2022-03-25 22:36:05 +00:00
Kelly Brazil
789f0735df doc update 2022-03-25 15:32:37 -07:00
Kelly Brazil
34bc775317 doc update 2022-03-25 15:32:11 -07:00
Kelly Brazil
38de059a1b doc update 2022-03-24 16:58:45 -07:00
Kelly Brazil
304ae6268f minor optimization by changing the expression order 2022-03-24 16:58:39 -07:00
Kelly Brazil
978caf4522 minor optimization by reordering expressions 2022-03-24 12:37:46 -07:00
Kelly Brazil
17df5bfcfc cache _is_separator function 2022-03-24 11:58:13 -07:00
Kelly Brazil
5e6a5068cf allow iterables for simple table parser 2022-03-24 11:57:01 -07:00
Kelly Brazil
619de68a61 formatting 2022-03-24 09:39:53 -07:00
Kelly Brazil
6748c3cc91 remove lines from corner detection and add rounded corners 2022-03-24 09:31:12 -07:00
Kelly Brazil
0a462978b7 fix for special characters in headers 2022-03-23 15:08:33 -07:00
Kelly Brazil
e66a82ff49 doc update 2022-03-23 10:50:34 -07:00
Kelly Brazil
f3aa797d96 add more pretty table separators 2022-03-22 17:47:19 -07:00
Kelly Brazil
e5b478218c add quiet=True to parse tests 2022-03-22 16:05:07 -07:00
Kelly Brazil
35e0e9c32a remove print statement 2022-03-22 15:57:43 -07:00
Kelly Brazil
17c3c2f029 add bold bar seperator and ANSI code tests 2022-03-22 15:55:59 -07:00
Kelly Brazil
cf83e6398b add fancy separators 2022-03-22 15:13:07 -07:00
Kelly Brazil
94e061b881 add asciitable parser tests 2022-03-22 14:53:34 -07:00
Kelly Brazil
720480e39c doc update 2022-03-22 13:21:10 -07:00
Kelly Brazil
82a63fe159 doc update 2022-03-22 12:42:07 -07:00
Kelly Brazil
9c1ec9940e doc update 2022-03-22 12:35:56 -07:00
Kelly Brazil
f23f19da45 doc update 2022-03-22 12:25:59 -07:00
Kelly Brazil
aea2e1b0a9 fix tests so blank strings are now None 2022-03-22 12:25:51 -07:00
Kelly Brazil
7d95d679bf add asciitable parser 2022-03-22 12:25:24 -07:00
Kelly Brazil
b3b140066b doc update 2022-03-22 07:21:19 -07:00
Kelly Brazil
b204c423c1 doc update 2022-03-22 07:05:14 -07:00
Kelly Brazil
d451c309bb change multiple or statements to any() 2022-03-22 06:30:07 -07:00
Kelly Brazil
01d53da68e remove debug print 2022-03-21 19:11:27 -07:00
Kelly Brazil
53dd05e52c fix rstrip and add tests 2022-03-21 19:10:02 -07:00
Kelly Brazil
ab564f5be8 add tests 2022-03-21 17:57:14 -07:00
Kelly Brazil
00c39450f9 enhance type annotation 2022-03-21 13:36:54 -07:00
Kelly Brazil
f611d08b50 formatting 2022-03-21 13:33:35 -07:00
Kelly Brazil
90e79b7df3 formatting 2022-03-21 13:27:44 -07:00
Kelly Brazil
4eb2d725d5 formatting 2022-03-21 13:09:50 -07:00
Kelly Brazil
51ae5ebcac new streamlined parser 2022-03-21 13:06:34 -07:00
Kelly Brazil
9ecbdb0916 use generator instead of iterable in function return annotation 2022-03-20 10:16:29 -07:00
Kelly Brazil
b3a2886fd0 formatting 2022-03-20 10:12:29 -07:00
Kelly Brazil
ceacec0f46 remove errant os sep import 2022-03-18 16:57:47 -07:00
Kelly Brazil
ff0f794b01 working 2022-03-18 16:53:23 -07:00
Kelly Brazil
70fafbf3f8 remove asciitable so tests pass for now 2022-03-18 14:19:00 -07:00
Kelly Brazil
5a248a8fc5 add multiline asciitable parser 2022-03-18 13:05:57 -07:00
Kelly Brazil
4a3a4e10df add asciitable and asciitable-m parsers 2022-03-18 13:03:43 -07:00
Kelly Brazil
c27bd5ff39 pad lines in sparse_table_parse and use str.isspace() 2022-03-17 16:24:18 -07:00
Kelly Brazil
f804c9627f copy input list so we don't mutate the caller's data 2022-03-15 16:04:58 -07:00
Kelly Brazil
3ab25d02f9 use _parser_is_streaming from lib 2022-03-14 12:30:09 -07:00
Kelly Brazil
9e80fd2b97 fallback if info and doc items don't exist 2022-03-14 12:17:18 -07:00
Kelly Brazil
ff9527a098 import cleanup and use all_parser_info in parsers_text 2022-03-14 11:35:57 -07:00
Kelly Brazil
7dac2f8dc3 doc update 2022-03-14 10:50:10 -07:00
Kelly Brazil
32e4d55e86 use parser_info for help_doc 2022-03-14 10:46:54 -07:00
Kelly Brazil
f9a9062147 add documentation argument to parser_info and all_parser_info 2022-03-14 10:46:23 -07:00
Kelly Brazil
89e5919796 add -A to second example 2022-03-14 09:56:50 -07:00
Kelly Brazil
e5f5b2591d changelog update 2022-03-14 09:45:17 -07:00
Kelly Brazil
77c667eec0 ubuntu fixes 2022-03-14 09:43:18 -07:00
Kelly Brazil
b257ce8c2f add mpstat_s tests 2022-03-13 12:25:50 -07:00
Kelly Brazil
c693c868ca add mpstat streaming parser 2022-03-11 15:59:38 -08:00
Kelly Brazil
6f98b27a05 add mpstat tests 2022-03-11 15:33:31 -08:00
Kelly Brazil
d7efd25d88 add mpstat to docs 2022-03-11 14:54:06 -08:00
Kelly Brazil
2cddb1f0bb working mpstat 2022-03-11 14:00:19 -08:00
Kelly Brazil
ae1c331595 initial working version 2022-03-11 13:15:39 -08:00
Kelly Brazil
bc97052ed4 initial add mpstat parser 2022-03-11 12:37:17 -08:00
Kelly Brazil
6c3e0e2aa0 formatting 2022-03-11 12:37:01 -08:00
Kelly Brazil
dd052e0146 add underscores to column examples 2022-03-11 10:25:24 -08:00
Kelly Brazil
54e8f58145 add table result examples 2022-03-10 16:50:55 -08:00
Kelly Brazil
def7aa5764 formatting 2022-03-10 15:36:11 -08:00
Kelly Brazil
6986c74f6d remove direct parser module example from doc 2022-03-10 15:18:27 -08:00
Kelly Brazil
b784db404d streaming doc formatting update 2022-03-10 13:32:26 -08:00
Kelly Brazil
8aee4517bb doc formatting 2022-03-10 13:02:50 -08:00
Kelly Brazil
a5fb8fbf94 streaming doc update 2022-03-10 10:10:57 -08:00
Kelly Brazil
b9365e2ac2 add pidstat-s tests 2022-03-10 09:23:36 -08:00
Kelly Brazil
696338c1a3 add streaming test template 2022-03-10 09:04:12 -08:00
Kelly Brazil
4f0616190b doc update 2022-03-10 08:14:58 -08:00
Kelly Brazil
3278cb0de3 add type hints 2022-03-10 08:14:46 -08:00
Kelly Brazil
4fc04256a5 rollback noReturn to tuple 2022-03-10 08:00:37 -08:00
Kelly Brazil
e4ae0fea63 fix type annotation 2022-03-09 16:28:55 -08:00
Kelly Brazil
d3727ea090 doc update 2022-03-09 16:09:35 -08:00
Kelly Brazil
0d13909cf6 add pidstat-s parser 2022-03-09 16:07:29 -08:00
Kelly Brazil
c52ca20e28 fix comment 2022-03-09 16:07:17 -08:00
Kelly Brazil
21f27f26c8 add pidstat tests 2022-03-09 15:37:10 -08:00
Kelly Brazil
5e7a87f397 add test template 2022-03-09 15:37:04 -08:00
Kelly Brazil
845d763829 format docs to fit 80 columns 2022-03-09 15:09:22 -08:00
Kelly Brazil
f5c7d52ec7 formatting 2022-03-09 14:43:56 -08:00
Kelly Brazil
c3198a5874 formatting 2022-03-09 14:17:48 -08:00
Kelly Brazil
bbd4afa735 add pidstat to docs 2022-03-09 14:09:58 -08:00
Kelly Brazil
ae754a84bf doc update 2022-03-09 14:06:34 -08:00
Kelly Brazil
3389eb5deb initial working parser 2022-03-09 13:18:04 -08:00
Kelly Brazil
01f2c1e71f add pidstat parser 2022-03-09 12:13:32 -08:00
Kelly Brazil
8bfbf8f1bc simplify error message 2022-03-09 12:13:07 -08:00
Kelly Brazil
f4242669ba minor cleanup 2022-03-09 10:52:40 -08:00
Kelly Brazil
bebd9331f1 Merge pull request #211 from kellyjonbrazil/master
sync to dev
2022-03-09 18:49:01 +00:00
Kelly Brazil
ac61e9ad2c add pypi link 2022-03-08 13:21:05 -08:00
Kelly Brazil
648ef4d8a9 update badge links 2022-03-08 13:19:20 -08:00
Kelly Brazil
727fc9a701 doc update 2022-03-05 15:19:25 -08:00
Kelly Brazil
306512d6bb force AM/PM to uppercase in date parser 2022-03-05 15:13:47 -08:00
Kelly Brazil
6afb1d389c Merge pull request #209 from kellyjonbrazil/dev
Dev v1.18.4
2022-03-05 21:49:36 +00:00
Kelly Brazil
9861983481 doc update 2022-03-05 13:45:28 -08:00
Kelly Brazil
ca79053db0 document pydoc version 2022-03-05 12:15:47 -08:00
Kelly Brazil
29c263f878 pydoc formatting fixes 2022-03-05 12:15:14 -08:00
Kelly Brazil
128c3c170a doc update 2022-03-04 16:38:49 -08:00
Kelly Brazil
a531ab8864 formatting 2022-03-04 16:35:06 -08:00
Kelly Brazil
0c1be7cc11 reduce dig example size 2022-03-04 16:29:36 -08:00
Kelly Brazil
e4222b45f5 fix names to mod names 2022-03-04 16:24:13 -08:00
Kelly Brazil
ac32c69c31 formatting 2022-03-04 13:35:16 -08:00
Kelly Brazil
cb2dfeac8d change name to JSON Convert 2022-03-04 13:27:39 -08:00
Kelly Brazil
9a3602e70b doc update 2022-03-04 08:57:11 -08:00
Kelly Brazil
a9f53ee258 optimize streaming parser detection in cli 2022-03-03 17:50:19 -08:00
Kelly Brazil
6be3d3d982 doc update 2022-03-03 17:38:47 -08:00
Kelly Brazil
e49df72083 use streaming parser list to find streaming parsers 2022-03-03 17:37:01 -08:00
Kelly Brazil
7ede7be7bf add standard and streaming list functions 2022-03-03 17:36:40 -08:00
Kelly Brazil
4758e28a36 formatting 2022-03-02 15:24:18 -08:00
Kelly Brazil
4a1ee151b3 add dhcp6 options to docs 2022-03-02 10:57:09 -08:00
Kelly Brazil
8c8afc1a92 formatting 2022-03-02 10:15:01 -08:00
Kelly Brazil
ed205f7720 doc update 2022-02-28 12:55:05 -08:00
Kelly Brazil
d65f7ae992 add nmcli 2022-02-28 12:26:06 -08:00
Kelly Brazil
e2ffef57b9 fix test 2022-02-28 12:20:39 -08:00
Kelly Brazil
002caa9fb3 add fedora tests 2022-02-28 12:19:02 -08:00
Kelly Brazil
b7c6faf3da enhance error message 2022-02-25 11:23:20 -08:00
Kelly Brazil
554ca61d17 add tests 2022-02-25 11:19:20 -08:00
Kelly Brazil
7b9722d255 fix formatting 2022-02-24 21:21:02 -08:00
Kelly Brazil
5505bde8ef doc update 2022-02-24 20:53:54 -08:00
Kelly Brazil
dbcd9a4060 bump version to 1.0 2022-02-24 20:52:28 -08:00
Kelly Brazil
4bdeb2b3aa simplify warning message 2022-02-24 20:52:18 -08:00
Kelly Brazil
6ae1d03187 doc fix 2022-02-24 20:47:15 -08:00
Kelly Brazil
f75b06abe4 doc update 2022-02-24 20:43:20 -08:00
Kelly Brazil
1923925710 update changelog 2022-02-24 20:35:00 -08:00
Kelly Brazil
2c5c57ae04 version bump 2022-02-24 20:33:10 -08:00
Kelly Brazil
f4d11d697e finish use cases and doc 2022-02-24 20:31:58 -08:00
Kelly Brazil
7f409b7082 enhance ParseError cli message 2022-02-24 20:31:09 -08:00
Kelly Brazil
937fa5aad2 split dhcp options 2022-02-24 18:22:19 -08:00
Kelly Brazil
19dcef5135 firm up flow. add/remove text. parse routes 2022-02-24 17:10:39 -08:00
Kelly Brazil
3d01356461 add text_kv function 2022-02-24 14:53:26 -08:00
Kelly Brazil
2d6f666fa4 add dev show and conn show parsers 2022-02-24 12:21:13 -08:00
Kelly Brazil
4dda895f12 initial nmcli parser 2022-02-24 11:25:14 -08:00
Kelly Brazil
52617b1722 Merge pull request #208 from kellyjonbrazil/master
sync to dev
2022-02-21 16:35:12 +00:00
Kelly Brazil
961968a0fc fix schema 2022-02-14 15:14:22 -08:00
Kelly Brazil
f026a788e5 add xrandr example 2022-02-14 11:30:03 -08:00
Kelly Brazil
2f7c03eb35 Merge pull request #207 from kellyjonbrazil/dev
Dev v1.18.3
2022-02-14 10:36:08 -08:00
Kelly Brazil
3afaa48eee doc update 2022-02-14 10:31:41 -08:00
Kelly Brazil
3201452564 add -p to example 2022-02-14 10:06:09 -08:00
Kelly Brazil
7ee1e34fc7 doc update 2022-02-14 10:03:52 -08:00
Kelly Brazil
67dbf05016 add type annotations 2022-02-14 09:58:31 -08:00
Kelly Brazil
4ac9f2e3da doc update 2022-02-14 09:37:37 -08:00
Kelly Brazil
3f5f6e39a7 formatting 2022-02-14 09:20:16 -08:00
Kelly Brazil
4723db8e3c doc updates 2022-02-14 09:14:46 -08:00
Kelly Brazil
ca914ec77d add nodata test 2022-02-14 09:14:38 -08:00
Kelly Brazil
dcc7f3f357 Merge pull request #204 from lyterk/xrandr
New parser: xrandr
2022-02-13 17:45:53 -08:00
Kevin Lyter
cbdc666236 Return empty object if no results and filenames
- If no results are returned, return {} instead of {"screens": [],
"unassociated_devices": []}
- simple_xrandr -> xrandr_simple
2022-02-09 22:06:23 -08:00
Kelly Brazil
184ef3a1fa doc update 2022-02-08 14:45:33 -08:00
Kelly Brazil
c732f75944 doc update 2022-02-08 14:43:14 -08:00
Kelly Brazil
7a1ae4f5fc add library tests 2022-02-08 13:32:22 -08:00
Kelly Brazil
d04bc3757c add xrandr 2022-02-08 07:33:26 -08:00
Kelly Brazil
73e8391653 formatting 2022-02-07 16:58:06 -08:00
Kelly Brazil
f6c1463c15 formatting 2022-02-07 16:31:43 -08:00
Kelly Brazil
d392c7f901 doc update 2022-02-07 15:44:54 -08:00
Kelly Brazil
d0387f5820 add timestamp format hints for better performance 2022-02-07 15:44:46 -08:00
Kelly Brazil
76f92908a3 add format hints for performance optimization 2022-02-07 15:43:24 -08:00
Kelly Brazil
1a115da67b add lru_cache maxsize for python 3.7 support 2022-02-07 08:34:34 -08:00
Kelly Brazil
f0a37ccf30 use lru_cache for significant performance boost to timestamp 2022-02-07 08:30:11 -08:00
Kelly Brazil
f331f53a53 use !r formatting instead of quotes 2022-02-07 08:06:48 -08:00
Kelly Brazil
8611aff06b add examples 2022-02-07 06:42:35 -08:00
Kelly Brazil
2f3f78e8d3 refine streaming parsers 2022-02-07 06:29:17 -08:00
Kelly Brazil
d1e0ee6123 use new streaming functions 2022-02-06 08:56:18 -08:00
Kelly Brazil
45314c9808 move some functions to streaming 2022-02-06 08:55:42 -08:00
Kelly Brazil
df00945b46 move try/except inside for loop 2022-02-04 16:03:44 -08:00
Kelly Brazil
fda0050d86 add rsync-s tests 2022-02-04 14:39:45 -08:00
Kelly Brazil
a76d46f9ec refactor ignore_exceptions 2022-02-04 12:14:16 -08:00
Kevin Lyter
6b069a82d0 Add xrandr to lib.py 2022-02-03 22:40:40 -08:00
Kevin Lyter
6b793d0521 Clean up types
* | operator => Union[]
* Remove unused import Iterator
* Remove comment
2022-02-03 22:40:35 -08:00
Kevin Lyter
ce9103f7cc Delete old files in template folder 2022-02-03 18:12:46 -08:00
Kelly Brazil
671d6dee36 doc update 2022-02-03 15:47:46 -08:00
Kelly Brazil
49929c714c add add_jc_meta decorator 2022-02-03 15:44:18 -08:00
Kelly Brazil
2986771f07 require python v3.7 and above since v3.6 is now deprecated 2022-02-03 09:21:20 -08:00
Kevin Lyter
520082d963 New parser: xrandr
Tests passing, working as intended in plugin directory
2022-02-02 20:33:25 -08:00
Kelly Brazil
021e296d45 move variable inits and regexes up 2022-02-02 17:06:20 -08:00
Kelly Brazil
42e56fbcea move regex up 2022-02-02 17:05:53 -08:00
Kelly Brazil
a5b62a4055 add processing and docs 2022-02-02 16:03:14 -08:00
Kelly Brazil
be98c9b7f6 simplify try/except by moving outside for loop 2022-02-02 15:59:12 -08:00
Kelly Brazil
aceeb84507 doc update 2022-02-02 15:58:29 -08:00
Kelly Brazil
1391063217 first draft rsync streaming parser 2022-02-02 11:49:39 -08:00
Kelly Brazil
52157addd0 fix compatible list 2022-02-02 11:49:24 -08:00
Kelly Brazil
ec0bc6615e formatting 2022-02-01 19:20:19 -08:00
Kelly Brazil
2f80800e38 simplify all_parser_info comprehension 2022-02-01 19:06:41 -08:00
Kelly Brazil
3959d3347c doc update 2022-02-01 18:33:07 -08:00
Kelly Brazil
b57d25c69a clean up return type for parser_info 2022-02-01 18:30:37 -08:00
Kelly Brazil
63e43a7cab doc updates 2022-02-01 17:57:12 -08:00
Kelly Brazil
21719f9a26 type annotation updates 2022-02-01 17:54:22 -08:00
Kelly Brazil
96ec70de4f remove unneeded optional 2022-02-01 17:18:55 -08:00
Kelly Brazil
a15a1967dc fix typo 2022-02-01 17:18:39 -08:00
Kelly Brazil
a10d756629 fixy mypy issues 2022-02-01 16:49:31 -08:00
Kelly Brazil
0700dc7a64 remove cygwin from compatible 2022-02-01 16:42:51 -08:00
Kelly Brazil
ca654b2140 fix parser order 2022-02-01 16:42:10 -08:00
Kelly Brazil
4ff3b87c1c remove future field from docstring 2022-02-01 16:18:38 -08:00
Kelly Brazil
ea244fb7a9 formatting 2022-02-01 16:17:03 -08:00
Kelly Brazil
8061f30e6f add centos -i nochange test 2022-02-01 16:16:33 -08:00
Kelly Brazil
8f3b12e81e add fixes for mac -i output 2022-02-01 14:52:51 -08:00
Kelly Brazil
d0694ce0db add nochange log test for mac 2022-02-01 14:20:53 -08:00
Kelly Brazil
0cd4c4bc7f add nochange tests 2022-02-01 13:58:51 -08:00
Kelly Brazil
12f90c349c update regexes for unchanged files 2022-02-01 13:54:25 -08:00
Kelly Brazil
26b8a1f167 remove packages from binaries and packages header 2022-02-01 09:58:18 -08:00
Kelly Brazil
3abe382c06 add examples 2022-01-31 16:01:42 -08:00
Kelly Brazil
1e2edc2c7b add timestamp 2022-01-31 15:54:05 -08:00
Kelly Brazil
5fe032a674 fix typo 2022-01-31 13:44:44 -08:00
Kelly Brazil
e825c02df1 add rsync tests 2022-01-31 13:23:31 -08:00
Kelly Brazil
a4a4d170b5 update docstring 2022-01-31 13:23:22 -08:00
Kelly Brazil
d0fcd523cb fix process conversions 2022-01-31 11:13:23 -08:00
Kelly Brazil
f72b7dc75d change keyname to files and remove future key 2022-01-30 16:37:45 -08:00
Kelly Brazil
4101dc6bf7 add log-file support 2022-01-30 16:21:03 -08:00
Kelly Brazil
ea5011b616 updated schema. add log-file option support 2022-01-29 17:24:43 -08:00
Kelly Brazil
d6de81747f add int/float conversions 2022-01-28 15:00:05 -08:00
Kelly Brazil
38f04b1c96 add summary 2022-01-28 14:45:01 -08:00
Kelly Brazil
84169e1a91 add rsync parser 2022-01-28 14:08:43 -08:00
Kelly Brazil
1f96586a5e reorder imports 2022-01-28 14:08:21 -08:00
Kelly Brazil
681176e4c9 Merge pull request #203 from kellyjonbrazil/dev
Dev v1.18.2
2022-01-27 16:53:37 -08:00
Kelly Brazil
8bb2663522 date update 2022-01-27 16:49:46 -08:00
Kelly Brazil
663abf3139 clean up scripts 2022-01-27 16:14:14 -08:00
Kelly Brazil
f7ac41db95 final doc update 2022-01-27 13:27:50 -08:00
Kelly Brazil
5502cda9e5 add additional test for dict inside list for all_parser_info() 2022-01-27 13:03:02 -08:00
Kelly Brazil
a2b165565f add lib tests for new functions 2022-01-27 12:54:44 -08:00
Kelly Brazil
b426369815 use all_parser_info() from lib in about function 2022-01-27 07:45:20 -08:00
Kelly Brazil
ac0840cc0a fix typo 2022-01-26 20:51:18 -08:00
Kelly Brazil
ee98ab0a4a doc update 2022-01-26 20:42:20 -08:00
Kelly Brazil
2adec2c003 update type hints with mypy help 2022-01-26 20:40:03 -08:00
Kelly Brazil
f19c9c71bf add type hints 2022-01-26 18:39:14 -08:00
Kelly Brazil
e93adf1884 fix doc 2022-01-26 18:09:30 -08:00
Kelly Brazil
254c4fc507 add new functions 2022-01-26 18:05:00 -08:00
Kelly Brazil
74d5f60d14 update console interview description 2022-01-26 17:17:40 -08:00
Kelly Brazil
db7dc0634b make **kwargs optional 2022-01-26 17:12:35 -08:00
Kelly Brazil
e156b0db45 add type hints 2022-01-26 17:08:03 -08:00
Kelly Brazil
50adc05fbd formatting 2022-01-26 16:58:48 -08:00
Kelly Brazil
446cac7c21 doc update 2022-01-26 16:55:39 -08:00
Kelly Brazil
28ffe3076b formatting 2022-01-26 16:34:23 -08:00
Kelly Brazil
d4d5e206ca type hints update 2022-01-26 15:54:36 -08:00
Kelly Brazil
42fbe40a4a simplify type hints 2022-01-26 15:54:18 -08:00
Kelly Brazil
27e4a120e2 remove trailing comma 2022-01-26 15:31:18 -08:00
Kelly Brazil
b5d5b7c73a remove private classes 2022-01-26 15:01:42 -08:00
Kelly Brazil
e7471556ba remove sed lines 2022-01-26 14:39:11 -08:00
Kelly Brazil
640a21341b fix indentation 2022-01-26 14:38:57 -08:00
Kelly Brazil
f5befad3e4 move docstring under __init__ 2022-01-26 14:21:06 -08:00
Kelly Brazil
f8223023c3 change header depth 2022-01-26 14:16:04 -08:00
Kelly Brazil
7028e87f9b remove TOC for parsers 2022-01-26 13:03:51 -08:00
Kelly Brazil
590728f9c1 try new pydoc-markdown formatting options 2022-01-26 11:50:25 -08:00
Kelly Brazil
7cc147fe2d increase heading size 2022-01-25 19:28:37 -08:00
Kelly Brazil
3cfb3965bb formatting 2022-01-25 19:28:04 -08:00
Kelly Brazil
155d421322 formatting 2022-01-25 19:18:54 -08:00
Kelly Brazil
d3e10bb87b add lsusb docs 2022-01-25 18:59:40 -08:00
Kelly Brazil
fd5433ee62 parse docstring formatting 2022-01-25 18:58:09 -08:00
Kelly Brazil
4568f2d06e formatting for parse docstring 2022-01-25 18:51:56 -08:00
Kelly Brazil
c36e513d1b formatting 2022-01-25 18:42:55 -08:00
Kelly Brazil
8e089baf3f remove info class from docs 2022-01-25 18:38:26 -08:00
Kelly Brazil
386f6c317e update markdown processor settings 2022-01-25 18:03:34 -08:00
Kelly Brazil
75cd84ce8a try new markdown conversion 2022-01-25 17:07:47 -08:00
Kelly Brazil
6fad44e35d fix type hint 2022-01-25 16:28:29 -08:00
Kelly Brazil
1caac750da Update type hints 2022-01-25 16:27:29 -08:00
Kelly Brazil
16370dcb3d update type hints 2022-01-25 15:49:48 -08:00
Kelly Brazil
c1302f2573 add type-hints to public api 2022-01-25 15:49:31 -08:00
Kelly Brazil
6f0ffe0955 docu update 2022-01-25 15:48:00 -08:00
Kelly Brazil
1f89745fe7 version bump 2022-01-25 11:17:18 -08:00
Kelly Brazil
a46ac18ef7 doc update 2022-01-25 10:47:05 -08:00
Kelly Brazil
1a05f1c575 add parser info functions. move _get_parser functionality from cli to lib 2022-01-25 10:46:58 -08:00
Kelly Brazil
08f818aa42 Merge pull request #199 from kellyjonbrazil/master
sync to dev
2022-01-25 00:45:53 +00:00
Kelly Brazil
b3896650c2 revert column formatting 2022-01-23 13:40:50 -08:00
Kelly Brazil
f285539526 conform to 80 columns 2022-01-23 13:36:22 -08:00
Kelly Brazil
a896dcdf3b formatting 2022-01-23 13:14:00 -08:00
Kelly Brazil
0a187d4ed0 add console interview links 2022-01-23 10:04:19 -08:00
Kelly Brazil
2d65bc57d5 add quotes 2022-01-21 16:58:45 -08:00
Kelly Brazil
ab63809fde update description 2022-01-21 16:13:00 -08:00
Kelly Brazil
6f04707dc6 add python package doc info to top of page 2022-01-21 15:33:43 -08:00
Kelly Brazil
d14a86a9b5 fix typo 2022-01-21 15:29:46 -08:00
Kelly Brazil
8e6a31d3da minor fix for macOS binary 2022-01-21 14:08:19 -08:00
Kelly Brazil
6e7b6afe87 Merge pull request #198 from kellyjonbrazil/dev
Dev v1.18.0
2022-01-21 13:52:16 -08:00
Kelly Brazil
027c231097 formatting 2022-01-21 13:48:38 -08:00
Kelly Brazil
f1cf7d1f95 add helper function info 2022-01-21 12:51:26 -08:00
Kelly Brazil
df611cc263 formatting 2022-01-21 12:41:52 -08:00
Kelly Brazil
0f3143bbbb formatting 2022-01-21 12:39:22 -08:00
Kelly Brazil
c280757b76 formatting 2022-01-21 12:35:48 -08:00
Kelly Brazil
d30b9d84ef formatting 2022-01-21 12:33:23 -08:00
Kelly Brazil
50ded1dbd9 doc update 2022-01-21 12:31:03 -08:00
Kelly Brazil
e319aea5a4 add doc version info 2022-01-21 12:29:36 -08:00
Kelly Brazil
ba86509c1d simplify OSError exception handling 2022-01-21 12:15:34 -08:00
Kelly Brazil
0a9279ae6b doc update 2022-01-21 12:15:16 -08:00
Kelly Brazil
a13dde12af change raw output wording 2022-01-21 07:42:03 -08:00
Kelly Brazil
e2ed358de1 changelog update 2022-01-20 15:31:24 -08:00
Kelly Brazil
a2cd366621 Delete _config.yml 2022-01-20 15:01:49 -08:00
Kelly Brazil
15addd9bfc doc fix 2022-01-20 09:59:23 -08:00
Kelly Brazil
a4e34b0053 add universal parser docs 2022-01-20 09:46:24 -08:00
Kelly Brazil
d09529ac30 changelog update 2022-01-20 09:40:34 -08:00
Kelly Brazil
553097b505 docstring update 2022-01-20 09:40:08 -08:00
Kelly Brazil
49c5568577 module doc update 2022-01-20 07:49:45 -08:00
Kelly Brazil
6962b9ee8a formatting 2022-01-19 22:24:59 -08:00
Kelly Brazil
b4575a3f78 add lib docs 2022-01-19 22:20:36 -08:00
Kelly Brazil
35b54d235d add python package doc info 2022-01-19 21:53:13 -08:00
Kelly Brazil
583a5757e4 formatting 2022-01-19 21:32:21 -08:00
Kelly Brazil
f355333eee formatting 2022-01-19 19:27:46 -08:00
Kelly Brazil
4d7df10960 formatting 2022-01-19 19:24:37 -08:00
Kelly Brazil
66b2c28f4b formatting 2022-01-19 19:22:08 -08:00
Kelly Brazil
299a9c6d88 formatting 2022-01-19 19:19:25 -08:00
Kelly Brazil
bd391d979c add lib function docs 2022-01-19 19:18:03 -08:00
Kelly Brazil
7309bd2282 add get_help 2022-01-19 18:47:44 -08:00
Kelly Brazil
ce84c09d33 add get_help() 2022-01-19 18:44:26 -08:00
Kelly Brazil
b4fffbb647 formatting 2022-01-19 17:30:14 -08:00
Kelly Brazil
3701b4198a formatting 2022-01-19 17:29:22 -08:00
Kelly Brazil
d4c34098fa formatting 2022-01-19 11:31:29 -08:00
Kelly Brazil
b3c531193b formatting 2022-01-19 11:08:59 -08:00
Kelly Brazil
1d0e07c77b formatting 2022-01-19 10:31:46 -08:00
Kelly Brazil
06a322cf9c rename tests and add conversion function tests 2022-01-19 10:31:36 -08:00
Kelly Brazil
623d148712 doc update 2022-01-19 09:30:53 -08:00
Kelly Brazil
647e83d043 add test to ensure there are zero plugin parsers installed during tests 2022-01-19 09:29:09 -08:00
Kelly Brazil
91a5544644 doc update 2022-01-19 09:28:35 -08:00
Kelly Brazil
a1190998ae add jc and jc.lib tests 2022-01-19 09:15:24 -08:00
Kelly Brazil
097d7a1850 simplify __init__ 2022-01-19 09:15:11 -08:00
Kelly Brazil
302bf72e72 Update high-level API docs 2022-01-18 15:38:03 -08:00
Kelly Brazil
2c42baf3a4 add new high-level api info 2022-01-18 14:18:12 -08:00
Kelly Brazil
03feb89c84 add module list info 2022-01-18 13:46:11 -08:00
Kelly Brazil
9dd553192f doc update 2022-01-18 13:40:09 -08:00
Kelly Brazil
fa3f02e9d1 version bump 2022-01-18 13:39:51 -08:00
Kelly Brazil
0a9dde58c5 add jc.parse() high-level API 2022-01-18 13:10:14 -08:00
Kelly Brazil
70cb4453be Merge pull request #195 from kellyjonbrazil/dev
Dev v1.17.7
2022-01-14 11:54:29 -08:00
Kelly Brazil
830674cc6f version bump 2022-01-14 11:47:25 -08:00
Kelly Brazil
fb406b58a1 formatting 2022-01-08 20:22:53 -08:00
Kelly Brazil
55b272e412 tighten stat data detection 2022-01-06 11:13:14 -08:00
Kelly Brazil
94f62a9bf3 formatting 2022-01-06 11:03:49 -08:00
Kelly Brazil
8d19e4cb7b doc update 2022-01-06 11:00:53 -08:00
Kelly Brazil
7e510d48e0 simplify non-stat parse error logic 2022-01-06 10:36:33 -08:00
Kelly Brazil
7b20cffb14 simplify last item logic 2022-01-05 11:44:00 -08:00
Kelly Brazil
5c934c43c1 add continue to simplify logic 2022-01-05 11:39:00 -08:00
Kelly Brazil
8609298449 update docstring 2022-01-05 11:25:58 -08:00
Kelly Brazil
72cb0dc10b fixup for first and last items 2022-01-05 11:22:01 -08:00
Kelly Brazil
7b22fa81de raise for non-stat data 2022-01-05 07:46:58 -08:00
Kelly Brazil
0b6a130779 ignore blank lines 2022-01-04 16:43:38 -08:00
Kelly Brazil
fdcf4338e0 add examples to docstring 2022-01-04 15:31:00 -08:00
Kelly Brazil
ee43037f48 remove unused continue lines 2022-01-04 15:13:42 -08:00
Kelly Brazil
26e365563c add schema and _process logic 2022-01-04 15:07:45 -08:00
Kelly Brazil
1b39586bb1 add stat streaming parser 2022-01-04 15:01:42 -08:00
Kelly Brazil
8bb3a6bea3 Merge pull request #194 from kellyjonbrazil/master
sync to dev
2022-01-04 13:33:35 -08:00
Kelly Brazil
e6900e2000 add jar-manifest 2022-01-03 09:41:16 -08:00
Kelly Brazil
0ee244756b spelling 2022-01-03 09:22:35 -08:00
Kelly Brazil
6d5ac9abe6 update docs 2022-01-03 09:19:40 -08:00
Kelly Brazil
44f6d9e132 changelog update 2022-01-03 09:18:43 -08:00
Kelly Brazil
360154559c Merge pull request #193 from kellyjonbrazil/dev
Dev add csv doublequote fix
2022-01-03 09:12:50 -08:00
Kelly Brazil
78672bd7ad Merge pull request #190 from shaikustin/csv-doubleqouted
fix doubleqoute in csv
2022-01-03 09:08:57 -08:00
Kelly Brazil
65d96e26b5 add streaming tests 2022-01-03 09:06:00 -08:00
Kelly Brazil
241d53af9a Merge pull request #192 from kellyjonbrazil/dev
Dev v1.17.6
2022-01-03 08:49:15 -08:00
Kelly Brazil
5563829df2 make dialect sniff behavior match non-streaming parser 2022-01-03 08:48:23 -08:00
Kelly Brazil
3a4a27e1f9 version bump 2022-01-02 11:44:25 -08:00
Kelly Brazil
9c887a36a8 update csv_s parser with csv changes 2022-01-02 11:44:18 -08:00
Kelly Brazil
bc7973af36 update copyright 2022-01-02 11:07:15 -08:00
Kelly Brazil
32972d8fdb doc update 2022-01-02 11:00:52 -08:00
Kelly Brazil
b128d9109c add MANIFEST.MF tests 2022-01-02 10:51:02 -08:00
Kelly Brazil
929d7273a4 doc updates 2022-01-02 10:29:56 -08:00
shaik
2a40f84274 fix doubleqoute in csv 2022-01-02 17:30:25 +02:00
Kelly Brazil
9ff6fa818f add jar-manifest 2022-01-01 10:08:40 -08:00
Kelly Brazil
dac73a4bfe Merge pull request #189 from kellyjonbrazil/master
use github releases instead of packaging site
2022-01-01 10:06:46 -08:00
Kelly Brazil
d7895547f7 Merge pull request #188 from listuser/new_branch
Create key value pairs from a MANIFEST.MF file, to include key multiline value pairs.
2022-01-01 10:04:47 -08:00
listuser
b7d439cb87 Renamed jar-manifest.py to jar_manifest.py, added multi manifest outputs to tests... 2021-12-31 12:15:50 -08:00
listuser
7cc903a5f5 Removed inflating from examples in jar-manifest.py 2021-12-30 15:10:53 -08:00
listuser
c495a8291b Updated test output in MANIFEST.MF.json 2021-12-30 15:06:06 -08:00
listuser
5e1d7d777c Renamed metamf.py to jar-manifest.py, plus other changes 2021-12-30 15:02:48 -08:00
listuser
7edad3f676 Create key value pairs from a MANIFEST.MF file, to include key multiline value pairs. 2021-12-29 12:15:15 -08:00
Kelly Brazil
f7331001d4 use github releases instead of packaging site 2021-12-23 11:35:39 -08:00
Kelly Brazil
f8e09ae2ff Merge pull request #187 from kellyjonbrazil/master
sync to dev
2021-12-21 15:46:39 -06:00
Kelly Brazil
433c7cc0f0 formatting 2021-12-21 13:42:24 -08:00
Kelly Brazil
d753e71a74 Merge pull request #186 from kellyjonbrazil/dev
Dev v1.17.5
2021-12-21 15:21:18 -06:00
Kelly Brazil
2e4f5a508b version bump 2021-12-21 12:19:17 -08:00
Kelly Brazil
88b960eff6 doc update 2021-12-21 12:14:20 -08:00
Kelly Brazil
88c77bd89e add zipinfo tests 2021-12-21 12:08:16 -08:00
Kelly Brazil
51a7a4251f add multi-archive test output 2021-12-21 11:11:56 -08:00
Kelly Brazil
51d2f316f3 add multi-archive support 2021-12-21 11:11:44 -08:00
Kelly Brazil
ff78a46c48 add zipinfo parser 2021-12-21 08:13:17 -08:00
Kelly Brazil
ed4a9dc1d4 formatting 2021-12-21 08:13:00 -08:00
Kelly Brazil
63182dba26 Merge pull request #185 from listuser/new_branch
contributed zipinfo parser
2021-12-21 10:08:46 -06:00
Matt J
9c1eaa9389 revised zipinfo.py nested version 2021-12-20 21:53:34 -08:00
Matt J
bc520fcbcd added zipinfo.py nested version 2021-12-20 14:29:50 -08:00
Matt J
46faac1a12 add test data zipinfo.json and zipinfo.out 2021-12-19 18:08:11 -08:00
Matt J
3c424c0cb3 initial commit zipinfo.py to new_branch 2021-12-19 14:05:48 -08:00
Kelly Brazil
3ac8d0362b use quotes around python versions 2021-12-16 07:04:35 -08:00
Kelly Brazil
d88b998e6c formatting 2021-12-09 10:58:06 -08:00
Kelly Brazil
a9ed55c006 fix spelling 2021-12-09 10:54:04 -08:00
Kelly Brazil
ea61434123 fix schema docs 2021-12-09 10:21:37 -08:00
Kelly Brazil
a73d0d26cb Merge pull request #184 from kellyjonbrazil/dev
Dev 1.17.4
2021-12-08 20:49:01 -08:00
Kelly Brazil
b4506976e3 formatting 2021-12-08 11:21:12 -08:00
Kelly Brazil
34cb75a096 version bump 2021-12-08 08:46:00 -08:00
Kelly Brazil
34df643f60 add disable colors section 2021-12-08 08:35:09 -08:00
Kelly Brazil
ac7c13fcc0 add -C option to docs 2021-12-08 08:22:28 -08:00
Kelly Brazil
4fdb34c7d5 add no-color.org 2021-12-08 08:19:43 -08:00
Kelly Brazil
7ac468e35a changelog update 2021-12-08 08:14:36 -08:00
Kelly Brazil
df190aa299 add -C option to force color even with pipes 2021-12-08 08:14:28 -08:00
Kelly Brazil
9621475e86 changelog update 2021-12-07 15:46:02 -08:00
Kelly Brazil
82e0160de8 refactor NO_COLOR test 2021-12-07 15:45:11 -08:00
Kelly Brazil
d03fb8b626 Merge branch 'dev' of https://github.com/kellyjonbrazil/jc into dev 2021-12-07 15:34:23 -08:00
Kelly Brazil
b300dfb3d7 Add support for NO_COLOR env variable 2021-12-07 15:34:20 -08:00
Kelly Brazil
a7de9111d9 Merge pull request #183 from kellyjonbrazil/dev
Dev v1.17.3
2021-12-02 16:37:46 -08:00
Kelly Brazil
7933dfdbe7 Merge branch 'master' into dev 2021-12-02 16:34:06 -08:00
Kelly Brazil
f7cb5f7d01 update date 2021-12-02 16:30:47 -08:00
Kelly Brazil
a26a298f1a doc update 2021-12-02 11:42:56 -08:00
Kelly Brazil
dbd134d0da add examples to docs 2021-12-02 11:40:47 -08:00
Kelly Brazil
11aa01b0d9 iostat-s tests 2021-12-02 11:38:00 -08:00
Kelly Brazil
6f18e53443 fix for null lines 2021-12-02 11:37:52 -08:00
Kelly Brazil
7b467c4665 add ubuntu 20.10 tests 2021-12-02 09:30:16 -08:00
Kelly Brazil
537b8f2630 add more int conversions 2021-12-02 09:14:43 -08:00
Kelly Brazil
4d823575e7 add more float fields 2021-12-02 08:47:25 -08:00
Kelly Brazil
541aa1d09f Add new field float conversions for iostat v11 2021-12-02 08:41:36 -08:00
Kelly Brazil
8f02021014 formatting 2021-12-02 05:54:38 -08:00
Kelly Brazil
158a15157c changelog update 2021-12-01 16:47:17 -08:00
Kelly Brazil
2752e0d66a add iostat streaming parser 2021-12-01 16:47:09 -08:00
Kelly Brazil
6c11e912af update changelog 2021-12-01 16:14:22 -08:00
Kelly Brazil
43d34461e2 update docs 2021-12-01 16:12:51 -08:00
Kelly Brazil
4dfdc9b0f6 Merge branch 'dev' of https://github.com/kellyjonbrazil/jc into dev 2021-12-01 16:02:10 -08:00
Kelly Brazil
e2311cbb03 add iostat tests 2021-12-01 16:02:06 -08:00
Kelly Brazil
bf15575e90 fixes for ubunut 2021-12-01 16:01:52 -08:00
Kelly Brazil
406336c718 add iostat example 2021-12-01 13:53:31 -08:00
Kelly Brazil
6665ffaeb8 remove python 3.6 from tests 2021-12-01 10:59:07 -08:00
Kelly Brazil
dcf552ca0c add _process and cleanup 2021-12-01 10:34:55 -08:00
Kelly Brazil
7a6ebf3c95 add iostat parser 2021-11-30 16:54:32 -08:00
Kelly Brazil
d2dc4a983c changelog update 2021-11-30 11:59:26 -08:00
Kelly Brazil
1168259bc2 add doc strings 2021-11-30 11:57:04 -08:00
Kelly Brazil
e8e4b46021 use jc.utils type checks 2021-11-30 11:49:40 -08:00
Kelly Brazil
12d2de2282 use jc.utils.input_type_check() and simplify compatibility check 2021-11-30 11:43:06 -08:00
Kelly Brazil
0e2fe401e1 version bump 2021-11-30 10:08:27 -08:00
Kelly Brazil
14247adb0a add input type checks 2021-11-30 10:03:59 -08:00
Kelly Brazil
3a9f0934c4 add input type checks 2021-11-30 09:56:33 -08:00
Kelly Brazil
caf0a5c871 add input type checking 2021-11-30 09:51:27 -08:00
Kelly Brazil
cfb58b1cf3 add input type checks 2021-11-30 09:41:16 -08:00
Kelly Brazil
975cf195cc formatting 2021-11-30 09:40:49 -08:00
Kelly Brazil
8a46a259a3 add input type checks 2021-11-30 09:19:51 -08:00
Kelly Brazil
e395142e59 version bump 2021-11-29 16:45:22 -08:00
Kelly Brazil
caaeaf0d67 add 'str' type check on input 2021-11-29 16:29:23 -08:00
Kelly Brazil
21e69a7cbf ignore _config.yml 2021-11-24 19:33:07 -08:00
Kelly Brazil
603964935b remove trailing whitespace 2021-11-24 19:30:10 -08:00
Kelly Brazil
47eb83ae55 add .vscode 2021-11-24 13:32:51 -08:00
Kelly Brazil
fc0ce6c959 add streaming parser to custom parsers info 2021-11-22 09:45:14 -08:00
Kelly Brazil
077a29fb4e add _jc_meta field info 2021-11-22 09:36:58 -08:00
Kelly Brazil
8568d0d328 fix csv_s documentation 2021-11-22 09:10:11 -08:00
Kelly Brazil
597d39c28e Merge pull request #180 from kellyjonbrazil/dev
Dev v1.17.2
2021-11-18 06:52:01 -10:00
Kelly Brazil
eb888dcbbc version bump 2021-11-18 08:48:03 -08:00
Kelly Brazil
d1b9ac0841 doc update 2021-11-18 08:41:52 -08:00
Kelly Brazil
89a6d9c5c3 add key-check to restore previous behavior even with non-df data 2021-11-17 12:03:40 -08:00
Kelly Brazil
85d9837616 add df info 2021-11-17 11:41:54 -08:00
Kelly Brazil
cd7731484d fix for cases where the Filesystem data overflows the column length (happens on older versions of df) 2021-11-17 11:26:42 -08:00
Kelly Brazil
086da16b17 version bump 2021-11-15 13:05:53 -08:00
Kelly Brazil
20830528f0 add test for older netstat version fix 2021-11-15 12:52:43 -08:00
Kelly Brazil
83371edd8f add space before inode to compensate for removed dash 2021-11-15 12:25:22 -08:00
Kelly Brazil
364a81decc version bump 2021-11-04 10:25:51 -07:00
Kelly Brazil
ef09592ad3 update for 1.17.2 2021-11-04 10:21:38 -07:00
Kelly Brazil
4a86e109cc Merge pull request #179 from shaikustin/ping-alpine-linux
support alpine linux ping
2021-11-04 10:18:47 -07:00
Kelly Brazil
7fa5391b66 change alpine ping6 to ping 2021-11-04 10:13:44 -07:00
shaik
9b53ba5714 support alpine linux ping 2021-11-04 13:42:48 +02:00
Kelly Brazil
b59e38cfd2 Merge pull request #176 from kellyjonbrazil/dev
Dev v1.17.1
2021-10-30 14:02:25 -07:00
Kelly Brazil
5ba22dae59 add JSON lines info 2021-10-30 13:57:36 -07:00
Kelly Brazil
4232e523ac Merge branch 'master' into dev 2021-10-30 13:49:45 -07:00
Kelly Brazil
bee80b35d2 update for version bump 2021-10-30 13:47:21 -07:00
Kelly Brazil
c32395f695 linting 2021-10-27 12:54:20 -07:00
Kelly Brazil
735c5e1078 update comments for ParseError test: https://bugs.python.org/issue45617 2021-10-26 12:26:23 -07:00
Kelly Brazil
d09c94b292 add python 3.10 testing info 2021-10-26 12:24:49 -07:00
Kelly Brazil
4d04866f48 add python bug https://bugs.python.org/issue45617 info 2021-10-26 12:24:37 -07:00
Kelly Brazil
a2d90f4dfc force test 2021-10-26 10:04:39 -07:00
Kelly Brazil
93a5002c8b fix 3.10.0 version number 2021-10-26 10:01:02 -07:00
Kelly Brazil
23bf5227a4 Merge branch 'dev' of https://github.com/kellyjonbrazil/jc into dev 2021-10-26 07:44:04 -07:00
Kelly Brazil
77c96fa2a9 try tests on python 3.10 2021-10-26 07:43:47 -07:00
Kelly Brazil
3f5a1f015e add python 3.10 2021-10-26 07:42:37 -07:00
Kelly Brazil
b280c4fc18 add ParseError test to streaming csv parser 2021-10-26 07:36:44 -07:00
Kelly Brazil
3ab9b43a2e raise ParseError on newline bug 2021-10-26 07:36:23 -07:00
Kelly Brazil
46f568414a change streaming parser test names 2021-10-25 11:35:01 -07:00
Kelly Brazil
cba2fd299f add tests 2021-10-25 11:03:32 -07:00
Kelly Brazil
1e6e44f656 fix for piping data with non-platform newlines (e.g. windows csv files on unix) 2021-10-25 11:03:21 -07:00
Kelly Brazil
acac039994 working tests 2021-10-25 10:06:01 -07:00
Kelly Brazil
50a3b34016 optimizations and use iter() so we can exhaust data coming from list objects 2021-10-25 10:05:39 -07:00
Kelly Brazil
b45396070c update comment 2021-10-24 13:14:05 -07:00
Kelly Brazil
218b9aec8a doc update for streaming CSV parser 2021-10-24 13:10:47 -07:00
Kelly Brazil
2b887debc6 add csv streaming parser 2021-10-24 12:24:44 -07:00
Kelly Brazil
0313e3f8ca linting 2021-10-24 11:21:47 -07:00
Kelly Brazil
1669e6e20c linting 2021-10-24 10:58:13 -07:00
Kelly Brazil
ef6de75dda add vmstat timestamp tests to utils 2021-10-23 13:11:22 -07:00
Kelly Brazil
a6bcec425a comment update 2021-10-23 12:55:14 -07:00
Kelly Brazil
596ad9a64d update comment 2021-10-23 12:47:44 -07:00
Kelly Brazil
7a91c93319 add lsusb 2021-10-23 12:40:24 -07:00
Kelly Brazil
b5f7b35f89 comment update 2021-10-23 12:30:18 -07:00
Kelly Brazil
2f47fb7f14 fix ParseError tests 2021-10-23 12:24:35 -07:00
Kelly Brazil
1b214c4036 raise ParseError if -t option is detected. add test 2021-10-23 12:24:11 -07:00
Kelly Brazil
8f94f8acc6 add tests and update docs 2021-10-23 11:56:12 -07:00
Kelly Brazil
3a2a69cfa5 formatting 2021-10-23 11:39:08 -07:00
Kelly Brazil
f599c65988 add stress test examples 2021-10-23 11:08:26 -07:00
Kelly Brazil
ad12849fd9 update docs example and 2021-10-23 11:08:05 -07:00
Kelly Brazil
f36b3789e8 formatting 2021-10-22 15:39:02 -07:00
Kelly Brazil
6d18c0ba61 change variable name last_attribute and last_attr to last_item 2021-10-22 15:37:40 -07:00
Kelly Brazil
17097abec9 formatting 2021-10-22 15:28:44 -07:00
Kelly Brazil
b7ddd3b285 change variable names 2021-10-22 15:23:04 -07:00
Kelly Brazil
75b23f62c9 working configuration_descriptor and device_descriptor attributes 2021-10-22 15:18:55 -07:00
Kelly Brazil
f88967b2a5 add attribute lists up to interface_association 2021-10-22 15:02:04 -07:00
Kelly Brazil
ba2846664b edpoint_descriptors attributes working 2021-10-22 13:40:01 -07:00
Kelly Brazil
10dba37ca2 hub_descriptor attributes working 2021-10-22 12:49:57 -07:00
Kelly Brazil
0e6f938514 working hub_port_status section 2021-10-22 10:31:26 -07:00
Kelly Brazil
159d87c112 add length guard and test for uname with no -a on linux 2021-10-22 07:14:21 -07:00
Kelly Brazil
9e7b1621cf device_status working 2021-10-21 16:59:28 -07:00
Kelly Brazil
2057817ef8 add uname tests 2021-10-20 15:59:27 -07:00
Kelly Brazil
a1eabad2d3 add comments 2021-10-20 15:58:43 -07:00
Kelly Brazil
92bf2b1ca2 simplify fixup logic for uname 2021-10-20 15:27:14 -07:00
Kelly Brazil
2b2123a4ba add FreeBSD support 2021-10-20 07:34:37 -07:00
Kelly Brazil
908b2f9200 add items 2021-10-19 16:16:25 -07:00
Kelly Brazil
deff0c7bfd remove print debug 2021-10-19 16:05:10 -07:00
Kelly Brazil
7cd01efa64 fixup for cases where the 'process' and/or 'machine' fields are blank on linux 2021-10-19 16:01:56 -07:00
Kelly Brazil
2dbe56456b add nested_dict. start work on hub_port_status and device_status 2021-10-15 11:43:15 -07:00
Kelly Brazil
6078a411ef add initial schema doc 2021-10-13 11:07:09 -06:00
Kelly Brazil
4a3656562f del null keys 2021-10-13 07:26:31 -06:00
Kelly Brazil
ba75989a24 update comments 2021-10-12 22:51:45 -06:00
Kelly Brazil
9e9e2c3628 move state instantiation before has_data test 2021-10-12 22:40:39 -06:00
Kelly Brazil
9a2a8c6b61 shorten set_sections 2021-10-12 22:38:03 -06:00
Kelly Brazil
dae42ef161 add hub_port_status and device_status 2021-10-12 15:55:09 -06:00
Kelly Brazil
931f2cab78 add hub_descriptor 2021-10-12 12:38:40 -07:00
Kelly Brazil
72b061bed4 add endpoint_descriptors 2021-10-12 12:29:59 -07:00
Kelly Brazil
29a7c73990 add hid_device_descriptor and report_descriptors 2021-10-12 11:24:49 -07:00
Kelly Brazil
2d1d68e300 simplify populate_lists. Add CDC lists 2021-10-12 09:57:47 -07:00
Kelly Brazil
c5c1e170d1 interface descriptors working 2021-10-11 21:33:18 -07:00
Kelly Brazil
9c1bb66452 fix remove _state field during schema_populate 2021-10-11 07:48:23 -07:00
Kelly Brazil
a4f3306bae initial schema build. need to figure out why deleting _state from output_line causes exceptions 2021-10-10 22:18:13 -07:00
Kelly Brazil
1bc638b6ee add bus_list and add all device_list data to the list 2021-10-10 10:03:39 -07:00
Kelly Brazil
9ad0cd9dae now storing state within the objects to make building the schema (later) easier. 2021-10-09 20:05:55 -07:00
Kelly Brazil
6d4a469127 use class for state 2021-10-06 22:03:16 -07:00
Kelly Brazil
ed6997e3ff add interface_association section 2021-10-05 16:47:23 -07:00
Kelly Brazil
eb788fca6e somewhat working lsusb parser. needs a lot more TLC 2021-10-05 14:59:49 -07:00
Kelly Brazil
9186f5f377 fix file parser for gzip cases (has ': ' in the description, which is the delimiter) 2021-10-02 14:53:07 -07:00
Kelly Brazil
30cff5f281 add note that the streaming parser outputs JSON Lines 2021-09-27 10:35:08 -07:00
Kelly Brazil
b724e0969a -qq instead of -q 2021-09-26 20:22:16 -07:00
Kelly Brazil
a62c49e871 Merge pull request #172 from kellyjonbrazil/master
sync master to dev
2021-09-26 16:35:29 -07:00
Kelly Brazil
9b160f6279 link update 2021-09-26 16:29:36 -07:00
Kelly Brazil
338a4e2612 formatting 2021-09-26 16:27:15 -07:00
Kelly Brazil
0140688750 link updates 2021-09-26 16:24:18 -07:00
Kelly Brazil
73e5ea98c1 Merge pull request #170 from kellyjonbrazil/dev
jc v1.17.0 from dev
2021-09-26 14:55:18 -07:00
Kelly Brazil
77dcbc544d final doc update 2021-09-26 14:50:02 -07:00
Kelly Brazil
c7bcb0947a indent subsequent error and warning lines 2021-09-26 13:20:42 -07:00
Kelly Brazil
5cd3f7f71d Add example to raise ParseError if there is no output data to yield 2021-09-26 13:15:35 -07:00
Kelly Brazil
5044388ab2 raise if line data is unrecognized 2021-09-26 13:04:27 -07:00
Kelly Brazil
ee075db598 linting 2021-09-26 12:00:30 -07:00
Kelly Brazil
9904e0be61 formatting 2021-09-25 08:28:57 -07:00
Kelly Brazil
31b69b3242 formatting 2021-09-25 08:23:46 -07:00
Kelly Brazil
e6a80fea32 formatting 2021-09-25 08:19:34 -07:00
Kelly Brazil
d6aec00e03 add vmstat-1-long tests 2021-09-24 16:45:38 -07:00
Kelly Brazil
4aa7d81e11 ignore re-printed header rows in output 2021-09-24 16:27:11 -07:00
Kelly Brazil
48cdabc3b0 document timestamps 2021-09-24 10:11:15 -07:00
Kelly Brazil
a1791ef547 linting 2021-09-24 10:01:13 -07:00
Kelly Brazil
7bc87f6c2d change _meta to _jc_meta 2021-09-24 09:24:30 -07:00
Kelly Brazil
bbed9e274b linting 2021-09-24 09:16:44 -07:00
Kelly Brazil
486282b985 linting 2021-09-24 08:52:39 -07:00
Kelly Brazil
a4d45b653f linting 2021-09-24 08:49:37 -07:00
Kelly Brazil
22e151b01c linting 2021-09-24 08:43:09 -07:00
Kelly Brazil
7a4ebcd1ec language hints 2021-09-23 21:22:01 -07:00
Kelly Brazil
651cbfe02f add streaming foo parser 2021-09-23 21:20:25 -07:00
Kelly Brazil
8c3e764516 add streaming parser to contrib guidelines 2021-09-23 21:17:17 -07:00
Kelly Brazil
b4e75da7e3 formatting 2021-09-23 21:14:47 -07:00
Kelly Brazil
37223f086c formatting 2021-09-23 21:13:21 -07:00
Kelly Brazil
a404033735 add error and warning message wrap info 2021-09-23 20:54:44 -07:00
Kelly Brazil
b7433ed085 auto wrap warning and error messages 2021-09-23 20:53:31 -07:00
Kelly Brazil
224d3d65ad Add exception class name to error message 2021-09-23 13:15:38 -07:00
Kelly Brazil
a349fb0bda change _meta to _jc_meta 2021-09-23 13:08:31 -07:00
Kelly Brazil
e7ddcfb83f change _meta to _jc_meta 2021-09-23 13:07:10 -07:00
Kelly Brazil
abd20dfe36 formatting 2021-09-23 12:58:24 -07:00
Kelly Brazil
dc1fd3ef1b fix -qq docs 2021-09-23 11:54:58 -07:00
Kelly Brazil
98a7686db4 use -qq to ignore streaming exceptions 2021-09-23 11:48:39 -07:00
Kelly Brazil
9c6c6c4330 add next() info 2021-09-23 09:04:37 -07:00
Kelly Brazil
f9be5651da add language hints 2021-09-23 08:59:26 -07:00
Kelly Brazil
df9835a3e6 formatting 2021-09-23 08:57:14 -07:00
Kelly Brazil
92363be2dd fix streaming python module example 2021-09-23 08:56:14 -07:00
Kelly Brazil
31b6203015 formatting 2021-09-23 08:54:15 -07:00
Kelly Brazil
18805858d6 formatting 2021-09-23 08:53:25 -07:00
Kelly Brazil
e676f0e20f add streaming parser info for python module use 2021-09-23 08:53:14 -07:00
Kelly Brazil
20652edefa update changelog 2021-09-22 20:11:26 -07:00
Kelly Brazil
98c29d0747 add vmstat tests 2021-09-22 19:54:12 -07:00
Kelly Brazil
41a6311f6b add streaming parser tests 2021-09-22 19:34:44 -07:00
Kelly Brazil
978760ec57 add exception class name to error string 2021-09-22 19:32:20 -07:00
Kelly Brazil
d410425537 replace single quotes with double quotes in doc 2021-09-22 14:43:26 -07:00
Kelly Brazil
6b7430329c doc update 2021-09-22 14:38:13 -07:00
Kelly Brazil
40fe0d4a60 working parser 2021-09-22 14:34:46 -07:00
Kelly Brazil
365c5354a0 remove debug print statement 2021-09-22 14:34:32 -07:00
Kelly Brazil
b246a05cbb fix vmstat-s name 2021-09-22 14:34:19 -07:00
Kelly Brazil
9e5a7a4abb add vmstat sample output 2021-09-22 14:07:09 -07:00
Kelly Brazil
f266acbcca add processing logic 2021-09-22 14:06:51 -07:00
Kelly Brazil
4e3b471f18 add format for vmstat 2021-09-22 14:06:28 -07:00
Kelly Brazil
5e28736c2e add vmstat and vmstat_s 2021-09-22 12:08:20 -07:00
Kelly Brazil
a91913a3b5 streaming parser template 2021-09-22 12:07:27 -07:00
Kelly Brazil
90c64f0ae0 initial working parser 2021-09-22 12:07:09 -07:00
Kelly Brazil
7cc642ed1a formatting 2021-09-22 12:06:56 -07:00
Kelly Brazil
809f64d35a Merge pull request #169 from kellyjonbrazil/streaming
Streaming to dev
2021-09-21 22:58:18 -07:00
Kelly Brazil
a6f859a55e add final ping_s tests 2021-09-21 22:47:48 -07:00
Kelly Brazil
39ef88078f add destination_ip to error lines 2021-09-21 22:47:02 -07:00
Kelly Brazil
aeea5e8d2e formatting 2021-09-21 22:00:05 -07:00
Kelly Brazil
1a0700bff4 add more ping-s tests 2021-09-21 21:58:59 -07:00
Kelly Brazil
b5fa6d068f update docs 2021-09-21 16:03:00 -07:00
Kelly Brazil
1baec0b420 add some streaming tests 2021-09-21 15:43:02 -07:00
Kelly Brazil
4f2a4e1dee skip blank lines and warning lines 2021-09-21 15:42:45 -07:00
Kelly Brazil
758d617668 doc update 2021-09-21 13:29:50 -07:00
Kelly Brazil
55322c37f5 formatting 2021-09-21 12:36:36 -07:00
Kelly Brazil
d19ea5552b add streaming ls parser tests 2021-09-21 12:33:05 -07:00
Kelly Brazil
130c3527c1 update docstrings 2021-09-21 12:32:34 -07:00
Kelly Brazil
3f221f4714 doc update 2021-09-20 13:21:20 -07:00
Kelly Brazil
d64c4cb390 add streaming parsers section 2021-09-20 13:04:26 -07:00
Kelly Brazil
448c56aa46 formatting 2021-09-20 13:04:14 -07:00
Kelly Brazil
9fbea15b6d rename state class to _state 2021-09-20 11:59:54 -07:00
Kelly Brazil
932060314b doc update 2021-09-20 11:51:27 -07:00
Kelly Brazil
5e68ae5009 import exception. tighten up os detection 2021-09-20 11:42:15 -07:00
Kelly Brazil
d03541beae add docstring examples. add exception raise when OS cannot be detected. 2021-09-20 11:24:59 -07:00
Kelly Brazil
516fa571d9 remove unused variable. use elif instead of if for linux vs. bsd detection 2021-09-19 21:41:35 -07:00
Kelly Brazil
a19c12096a initial working parser for both linux and bsd 2021-09-19 13:18:23 -07:00
Kelly Brazil
758f27945d change data_bytes and bytes to sent_bytes and response_bytes 2021-09-17 15:09:56 -07:00
Kelly Brazil
8b1e8d58df remove unneeded line 2021-09-17 14:44:49 -07:00
Kelly Brazil
b967489d08 complete linux coverage including summary 2021-09-17 14:42:30 -07:00
Kelly Brazil
870d0218be add unbuffer note 2021-09-17 10:34:05 -07:00
Kelly Brazil
84020bc2af change error_msg to error in -q result docs 2021-09-17 10:26:47 -07:00
Kelly Brazil
4efe5344e0 add links to HN and Reddit 2021-09-17 10:20:22 -07:00
Kelly Brazil
9182c54513 formatting 2021-09-17 08:24:56 -07:00
Kelly Brazil
28f0ab0b02 update streaming error messages 2021-09-17 08:21:13 -07:00
Kelly Brazil
90d1a30696 formatting 2021-09-17 08:05:23 -07:00
Kelly Brazil
130b3738cc shorten successful yield to a single line 2021-09-16 22:32:46 -07:00
Kelly Brazil
92c7357615 formatting 2021-09-16 22:04:44 -07:00
Kelly Brazil
c80f863334 simplify return condition formatting 2021-09-16 22:04:31 -07:00
Kelly Brazil
4642c20179 formatting 2021-09-16 21:55:40 -07:00
Kelly Brazil
5288eb22aa add info about streaming parser performance characteristics 2021-09-16 21:43:36 -07:00
Kelly Brazil
df8387a1a9 streaming parsers cannot be used with the magic syntax 2021-09-16 21:37:54 -07:00
Kelly Brazil
cc38c27f44 formatting 2021-09-16 21:33:57 -07:00
Kelly Brazil
64f5357d69 add streaming parsers section 2021-09-16 21:31:45 -07:00
Kelly Brazil
51debb5649 add vmstat parser and change from linebuffer to unbuffer 2021-09-16 20:45:01 -07:00
Kelly Brazil
b48d05a431 change from line buffer output to unbuffer output 2021-09-16 20:41:56 -07:00
Kelly Brazil
4e7f6b337d simplify yield statements 2021-09-16 20:26:56 -07:00
Kelly Brazil
a509d99caf add stream_success dictionary 2021-09-16 20:25:28 -07:00
Kelly Brazil
481e45fb64 limit parse error msg lenght 2021-09-14 06:02:55 -07:00
Kelly Brazil
e9038e1720 initial streaming ping docs 2021-09-13 21:15:26 -07:00
Kelly Brazil
8fd9e582bf doc update 2021-09-13 21:15:08 -07:00
Kelly Brazil
c1fd6f48a5 add stream_error docs 2021-09-13 21:14:56 -07:00
Kelly Brazil
af615c7f4b add line buffer output option 2021-09-13 21:14:38 -07:00
Kelly Brazil
bf0bc32d7a flush streamed text for better piping experience 2021-09-13 20:51:24 -07:00
Kelly Brazil
2d6b53e012 add pattern support. move unparsable line detection to standard streaming parser style 2021-09-13 19:50:51 -07:00
Kelly Brazil
51271fea0f somewhat working parser 2021-09-13 19:27:34 -07:00
Kelly Brazil
2deb473e0b initial streaming ping parser 2021-09-13 18:36:36 -07:00
Kelly Brazil
23eeb33b3d modify stream_error message 2021-09-13 18:36:19 -07:00
Kelly Brazil
f50dfaef45 use stream_error function for exceptions. raise on non -l ls output 2021-09-13 18:31:52 -07:00
Kelly Brazil
55bb71e9d4 add streaming ping parser. update streaming exception message 2021-09-13 18:30:20 -07:00
Kelly Brazil
dab9357d28 use stream_error function for exceptions 2021-09-13 18:29:49 -07:00
Kelly Brazil
27eb427245 add stream_error function 2021-09-13 18:29:10 -07:00
Kelly Brazil
260f3685d9 add streaming parser template 2021-09-13 15:06:02 -07:00
Kelly Brazil
76e78fc0c3 doc updates 2021-09-13 15:05:49 -07:00
Kelly Brazil
1ac944fa02 add -q option info to docstring 2021-09-13 12:13:14 -07:00
Kelly Brazil
986bc9b042 cleanup unused code 2021-09-13 12:10:02 -07:00
Kelly Brazil
5a7942069b add support for parent field 2021-09-13 10:56:05 -07:00
Kelly Brazil
f6c6fc13ac enhance error msg when streaming parser is used 2021-09-13 08:55:19 -07:00
Kelly Brazil
1d8cfae89f only print _meta object if -q or quiet flag is used. Also, add message to the end of exceptions informing of the -q option to ignore errors 2021-09-12 17:30:56 -07:00
Kelly Brazil
787df51239 remove \n from end of line in exception message 2021-09-12 16:42:47 -07:00
Kelly Brazil
5e7f302a9c Raise exceptions unless the -q or quiet flag are used 2021-09-12 16:35:46 -07:00
Kelly Brazil
3d10fd40b5 remove print flush for better performance. Roll json.JSONDecodeError into the parse try/except block 2021-09-12 16:27:00 -07:00
Kelly Brazil
57e3bf239c formatting for docs 2021-09-10 15:02:15 -07:00
Kelly Brazil
ccb09861e8 formatting for docs 2021-09-10 15:01:02 -07:00
Kelly Brazil
94551d75dd doc update 2021-09-10 14:27:50 -07:00
Kelly Brazil
6e21218425 working prototype of streaming ls parser 2021-09-10 14:14:10 -07:00
Kelly Brazil
ff0fda48fc Merge pull request #168 from kellyjonbrazil/master
Sync master to dev
2021-09-10 08:08:45 -07:00
Kelly Brazil
528aac7ad8 use subprocess in python example 2021-09-08 07:00:50 -07:00
Kelly Brazil
ab482e521d Merge pull request #163 from kellyjonbrazil/dev
Dev v1.16.2
2021-08-31 09:50:38 -07:00
Kelly Brazil
e08b61fa81 add schema note to sfdisk 2021-08-31 08:54:23 -07:00
Kelly Brazil
ce61bd1d2b add tests for -F fixes 2021-08-31 08:50:42 -07:00
Kelly Brazil
7b708f7518 Don't convert 'size' to int, except for legacy -d support. Change partition table detection logic to fix -F output 2021-08-31 08:39:54 -07:00
Kelly Brazil
89ca50c7fc add -l to sfdisk raw example 2021-08-30 21:56:36 -07:00
Kelly Brazil
fb54899dcc doc update 2021-08-30 21:53:40 -07:00
Kelly Brazil
0a625ad7dd remove unneeded lines 2021-08-30 21:52:55 -07:00
Kelly Brazil
d32e45efbe add sfdisk tests 2021-08-30 21:49:07 -07:00
Kelly Brazil
c77696bc78 version bump 2021-08-30 20:55:26 -07:00
Kelly Brazil
736fde9e78 add support for newer versions of sfdisk 2021-08-30 20:51:19 -07:00
Kelly Brazil
9c1ad92fed fix examples 2021-08-26 10:31:51 -07:00
Kelly Brazil
1a9fd2139d add "For new parsers:" 2021-08-26 10:29:13 -07:00
Kelly Brazil
7661e7f27a formatting 2021-08-26 10:27:11 -07:00
Kelly Brazil
f857b7fbf7 add custom parser folder info 2021-08-26 10:25:37 -07:00
Kelly Brazil
d94d12dbc5 add foo parser template info 2021-08-26 10:20:53 -07:00
Kelly Brazil
700916276a Merge pull request #159 from kellyjonbrazil/master
Sync Master to dev
2021-08-26 10:01:08 -07:00
Kelly Brazil
834e52369c update man page 2021-08-16 10:33:26 -07:00
Kelly Brazil
1ce53365de Merge pull request #156 from kellyjonbrazil/dev
Dev v1.16.1
2021-08-16 10:32:03 -07:00
Kelly Brazil
473f70668f Merge branch 'master' into dev
# Conflicts:
#	jc/man/jc.1.gz
#	man/jc.1
#	man/jc.1.gz
2021-08-16 10:28:11 -07:00
Kelly Brazil
0dbd2702f6 reformat doc_text for nicer indentation 2021-08-13 17:17:51 -07:00
Kelly Brazil
01e3764a9b fix join syntax 2021-08-13 16:03:46 -07:00
Kelly Brazil
ff9c81722a try/except for shlex.join since only available in python 3.8 2021-08-13 16:01:45 -07:00
Kelly Brazil
166aef7a02 version bump 2021-08-13 15:22:33 -07:00
Kelly Brazil
78caf7646b add stat fix 2021-08-13 15:19:41 -07:00
Kelly Brazil
1f99d40cec fix filename with spaces for osx/bsd 2021-08-13 15:19:31 -07:00
Kelly Brazil
4c2912d3d5 use shlex.join to quote run_command_str for better error messages 2021-08-13 15:19:17 -07:00
Kelly Brazil
45e6e06be5 add glob and process substitution fixes 2021-08-13 14:19:45 -07:00
Kelly Brazil
fdbe3e05f3 fix issue with globs not including filenames with spaces with magic syntax (introduced during switch to use subprocess to grab process exit code). No longer need to shlex quote arguments. 2021-08-13 14:19:26 -07:00
Kelly Brazil
7cc168f640 add comment 2021-08-12 16:55:07 -07:00
Kelly Brazil
ff2d609c9b add close_fds=False in subprocess.Popen() to allow process substitution in magic syntax. Also check for too many open files exception 2021-08-12 16:36:35 -07:00
Kelly Brazil
2689697b4c formatting 2021-07-22 17:03:00 -07:00
Kelly Brazil
f90a0ea8ab formatting 2021-07-22 12:20:48 -07:00
Kelly Brazil
caabe60f84 fix kv example 2021-07-22 12:20:31 -07:00
Kelly Brazil
2bef4ed603 package updates 2021-07-21 08:47:16 -07:00
Kelly Brazil
ee57be533b fix sfdisk example 2021-07-20 12:35:02 -05:00
Kelly Brazil
c5b7aaca25 Merge pull request #149 from kellyjonbrazil/dev
Dev v1.16.0
2021-07-20 10:19:14 -07:00
Kelly Brazil
7a1be905bb version bump 2021-07-20 12:15:29 -05:00
Kelly Brazil
5798495a11 add 1.15.7 to 1.16.0 changes 2021-07-20 12:13:33 -05:00
Kelly Brazil
46171e2202 add sfdisk example 2021-07-20 12:13:14 -05:00
Kelly Brazil
dd5c924ff5 add man page location change 2021-07-19 12:13:46 -07:00
Kelly Brazil
30c4ab2976 new man page location 2021-07-19 12:08:50 -07:00
Kelly Brazil
26ea4d47b3 version bump and deprecate /man/jc.1.gz and /jc/man/jc.1.gz 2021-07-19 12:04:25 -07:00
Kelly Brazil
2732cd175c include CHANGELOG in source distribution 2021-07-12 08:10:18 -07:00
Kelly Brazil
3e54b597be add timezone change for unit tests 2021-07-07 09:00:19 -07:00
Kelly Brazil
f10ebea209 update tests to set correct timezone on POSIX systems 2021-07-07 08:53:52 -07:00
Kelly Brazil
2c6f3993cb remove extra comma 2021-07-01 15:53:10 -07:00
Kelly Brazil
708a696920 remove extra lines 2021-07-01 15:51:38 -07:00
Kelly Brazil
20bbb5d331 remove extra lines 2021-07-01 15:50:55 -07:00
Kelly Brazil
223e785b54 rename variable 2021-06-30 17:07:43 -07:00
Kelly Brazil
3d78692c59 add sfdisk tests 2021-06-30 16:54:34 -07:00
Kelly Brazil
5321a15dcf update examples 2021-06-30 14:30:35 -07:00
Kelly Brazil
a452f8252a fix integer conversion 2021-06-30 14:27:12 -07:00
Kelly Brazil
49267f09ac change to root prompt in examples 2021-06-30 14:06:15 -07:00
Kelly Brazil
db47f35783 add working sfdisk parser 2021-06-30 12:38:36 -07:00
Kelly Brazil
d48abf312c Merge pull request #147 from kellyjonbrazil/master
sync to dev
2021-06-30 10:10:59 -07:00
Kelly Brazil
3b22ce4110 fix local plugin parser issue where parser has .py in the name but it is not at the end 2021-06-28 08:04:46 -07:00
Kelly Brazil
c521ca5bc9 change possible to available 2021-06-11 11:41:16 -07:00
Kelly Brazil
3ddc1c6659 add jello 2021-06-11 11:39:38 -07:00
Kelly Brazil
a8e19402b7 remove temporary fix 2021-06-09 08:33:48 -07:00
Kelly Brazil
0927902b30 temp fix for wrong url 2021-06-08 16:51:03 -07:00
Kelly Brazil
572548b42f Merge pull request #141 from kellyjonbrazil/dev
Dev v1.15.5
2021-05-27 17:00:54 -07:00
Kelly Brazil
ff7ab0a1ed doc updates for v1.15.5 2021-05-27 16:58:14 -07:00
Kelly Brazil
5db71b05cb add en_US.UTF-8 to LANG info 2021-05-25 09:47:24 -07:00
Kelly Brazil
f9b952885a add python 3.9.5 packaged info 2021-05-21 10:21:21 -07:00
Kelly Brazil
e7983bc0b2 version bump 2021-05-21 10:16:19 -07:00
Kelly Brazil
473a643142 add windows msi info 2021-05-21 10:16:08 -07:00
Kelly Brazil
14f3d442cb formatting 2021-05-21 09:46:51 -07:00
Kelly Brazil
d6f4ed9ab5 add long-form UTC test 2021-05-21 09:46:34 -07:00
Kelly Brazil
1b8d654444 add error message info 2021-05-20 15:49:18 -07:00
Kelly Brazil
6002af0dca add more error message detail to the user for ParseError and LibraryNotFound exceptions 2021-05-20 15:46:31 -07:00
Kelly Brazil
0924d822a3 add windows example 2021-05-20 15:36:27 -07:00
Kelly Brazil
72a37b9289 version bump 2021-05-19 16:23:34 -07:00
Kelly Brazil
5eef7bd769 use LibraryNotInstalled exception instead of exiting via sys.exit 2021-05-19 16:14:26 -07:00
Kelly Brazil
c6893e1bd5 add LibraryNotInstalled exception 2021-05-19 16:13:05 -07:00
Kelly Brazil
039f6612e4 Merge pull request #139 from kellyjonbrazil/master
sync branches
2021-05-18 10:29:02 -07:00
Kelly Brazil
95aec9c6f9 add info about Magic syntax not supporting shell builtins 2021-05-18 10:27:36 -07:00
Kelly Brazil
4e9652a8ec spelling 2021-05-17 14:36:20 -07:00
Kelly Brazil
773b7f4b1f add space before exit code table 2021-05-17 08:38:09 -07:00
Kelly Brazil
d17ffde9cd Merge pull request #138 from kellyjonbrazil/dev
Dev v1.15.4
2021-05-17 08:35:13 -07:00
Kelly Brazil
9c57c09c00 doc update for release 2021-05-17 08:24:31 -07:00
Kelly Brazil
4d730a9de5 add UTC fix 2021-05-16 20:57:17 -07:00
Kelly Brazil
fc57bcfce2 fix for when UTC is referenced as "Coordinated Universal Time" 2021-05-16 20:51:39 -07:00
Kelly Brazil
fa5571486c simplify json_out function 2021-05-16 20:33:03 -07:00
Kelly Brazil
9996c4fe23 update docs for shell builtins 2021-05-16 19:55:53 -07:00
Kelly Brazil
038d429024 doc updates 2021-05-16 19:44:10 -07:00
Kelly Brazil
9bf6facb0d remove magic command capability since dir is a shell builtin 2021-05-16 19:43:10 -07:00
Kelly Brazil
965717886e add exceptions module info 2021-05-16 19:30:00 -07:00
Kelly Brazil
e9bfc3dd29 add time format, dig compatibility, windows colors fix 2021-05-16 19:21:37 -07:00
Kelly Brazil
f46b33eacf add windows time format 2021-05-16 19:20:13 -07:00
Kelly Brazil
f475fe44df add new time format for systeminfo 2021-05-16 19:09:53 -07:00
Kelly Brazil
5fdbe2962d make dig compatible with all platforms 2021-05-16 17:48:56 -07:00
Kelly Brazil
ab291b9eef only force enable colors when running on windows 2021-05-16 17:48:40 -07:00
Kelly Brazil
fd411fd772 attempt to get colors working on windows 2021-05-16 17:43:05 -07:00
Kelly Brazil
b1e95a60a2 remove unnecessary comment 2021-05-13 08:42:27 -07:00
Kelly Brazil
bb1439f0d5 use ParseError exception from jc.exceptions module 2021-05-13 08:20:58 -07:00
Kelly Brazil
ba963d98a0 add exceptions module including ParseError 2021-05-13 08:20:35 -07:00
Kelly Brazil
83440ccb55 error message capitalization 2021-05-13 08:02:38 -07:00
Kelly Brazil
796f61bfa4 handle case where the user pipes data and uses magic syntax simultaneously 2021-05-12 17:01:09 -07:00
Kelly Brazil
070cac4ae1 remove commented line 2021-05-12 15:36:06 -07:00
Kelly Brazil
3ed84f9f42 reorganize main function. remove pass condition. 2021-05-12 15:19:11 -07:00
Kelly Brazil
a205afb6f3 set run_command_str if run_command is set 2021-05-12 13:44:15 -07:00
Kelly Brazil
a6d983dd8f move run_command_str variable 2021-05-12 13:38:08 -07:00
Kelly Brazil
b6c8d6d01d add exception handling for filenotfound or other subprocess.popen and json.dumps exceptions 2021-05-12 13:18:58 -07:00
Kelly Brazil
b5a5d5b133 set parser_name for magic syntax use 2021-05-12 11:36:27 -07:00
Kelly Brazil
da528e7814 move separators to a variable 2021-05-12 09:40:22 -07:00
Kelly Brazil
4acebf4f62 move variables 2021-05-12 08:48:49 -07:00
Kelly Brazil
4d40808d2b update comments 2021-05-12 08:27:39 -07:00
Kelly Brazil
c543f00bd3 simplify piped_output function 2021-05-11 14:30:46 -07:00
Kelly Brazil
947cf41dfa add exit code info 2021-05-11 12:42:21 -07:00
Kelly Brazil
8d8c58742e formatting 2021-05-11 11:32:08 -07:00
Kelly Brazil
995ecc9bfb add exit codes section 2021-05-11 11:11:17 -07:00
Kelly Brazil
21a15225eb add exit codes section 2021-05-11 10:59:26 -07:00
Kelly Brazil
48921d4584 ensure exit code never exceeds 255 2021-05-11 10:50:35 -07:00
Kelly Brazil
342db45edc fix combined exit codes 2021-05-11 10:36:55 -07:00
Kelly Brazil
5f88ecf844 add comments to magic_parser return 2021-05-10 21:23:23 -07:00
Kelly Brazil
a56aebfe70 remove side-effect comment since it is no longer relevant 2021-05-10 21:09:00 -07:00
Kelly Brazil
422bb744a8 update man pages 2021-05-10 21:03:30 -07:00
Kelly Brazil
c3b814a15f move imports to the top 2021-05-10 21:02:28 -07:00
Kelly Brazil
e4574047a0 update tests for magic_parser function 2021-05-10 20:49:44 -07:00
Kelly Brazil
0d7d7951f8 don't reset sys.argv anymore. check for 'valid_command' instead 2021-05-10 18:58:45 -07:00
Kelly Brazil
da904e4770 remove final \n from stderr string when printing 2021-05-10 18:50:59 -07:00
Kelly Brazil
19b540041a proof of concept for passing command exit codes when using magic syntax. Needs more testing 2021-05-10 18:31:30 -07:00
Kelly Brazil
f2ffb93eea formatting 2021-05-10 10:43:40 -07:00
Kelly Brazil
c0c0e05642 add dig +noall +answer support 2021-05-10 10:40:13 -07:00
Kelly Brazil
966978f17e add more unparsable line ping tests 2021-05-10 10:39:51 -07:00
Kelly Brazil
8ab08a5231 doc update 2021-05-10 10:13:52 -07:00
Kelly Brazil
48e534fa03 add +noall +answer test 2021-05-07 16:55:18 -07:00
Kelly Brazil
61851c1bd0 add support for +noall +answer 2021-05-07 16:42:09 -07:00
Kelly Brazil
3c51b2d83d add tests for unparsable lines on linux 2021-05-07 13:50:28 -07:00
Kelly Brazil
ee3a28528e Merge branch 'dev' of https://github.com/kellyjonbrazil/jc into dev
# Conflicts:
#	templates/readme_template
2021-05-05 10:03:58 -07:00
Kelly Brazil
916bcdae38 Merge pull request #136 from kellyjonbrazil/master
merge changes from master
2021-05-05 10:02:25 -07:00
Kelly Brazil
efb1d3e6b2 add blog title and minor formatting 2021-05-05 09:23:21 -07:00
Kelly Brazil
4e6ae66bac formatting 2021-05-05 09:20:47 -07:00
Kelly Brazil
5ee88e7b67 add use cases section 2021-05-05 09:18:45 -07:00
Kelly Brazil
c3b68903cb add use cases section 2021-05-05 09:17:11 -07:00
Kelly Brazil
fe1f1013a7 add use cases section 2021-05-05 09:16:05 -07:00
Kelly Brazil
fb14f5439f fix and tests for unknown or unparsable errors 2021-05-05 08:03:27 -07:00
Kelly Brazil
5ca0fc364e add unparsed_line to docs 2021-05-04 19:05:20 -07:00
Kelly Brazil
a1fe7037e5 add unparsed_line field if line cannot be parsed 2021-05-04 19:04:16 -07:00
Kelly Brazil
c2af7d113e add ping updates 2021-05-04 15:35:47 -07:00
Kelly Brazil
ff034e401d use try/except to make parser more resilient against unknown error types 2021-05-04 15:34:45 -07:00
Kelly Brazil
5abe095beb update ping docs 2021-05-03 15:26:16 -07:00
Kelly Brazil
33de5f01e6 version bump 2021-05-03 15:16:47 -07:00
Kelly Brazil
8ce155d843 add support for error replies in v4 ping on osx and bsd 2021-05-03 15:16:33 -07:00
Kelly Brazil
b921d5ec95 initial support for error replies in bsd/osx 2021-04-30 16:53:52 -07:00
Kelly Brazil
e21542aaa2 Merge pull request #135 from kellyjonbrazil/dev
Dev clarify packaged binaries in readme
2021-04-30 10:31:55 -07:00
Kelly Brazil
6150aae0ae clarify packaged binaries 2021-04-30 10:31:02 -07:00
Kelly Brazil
f27b35f371 Merge pull request #131 from kellyjonbrazil/master
sync branches
2021-04-28 15:28:35 -07:00
Kelly Brazil
d24f9a885d fix contributing link 2021-04-28 15:26:52 -07:00
Kelly Brazil
48dd82c8d1 trigger page build on github pages 2021-04-28 15:15:41 -07:00
Kelly Brazil
e57167ad1f empty commit 2021-04-28 12:23:31 -07:00
Kelly Brazil
ada9137642 Merge pull request #130 from kellyjonbrazil/dev
Dev link updates
2021-04-28 11:53:15 -07:00
Kelly Brazil
bd428a9fd7 fix link 2021-04-28 11:52:24 -07:00
Kelly Brazil
934941332f minor link updates 2021-04-28 11:50:10 -07:00
Kelly Brazil
0c209dbd10 Merge pull request #129 from kellyjonbrazil/dev
Dev update readme
2021-04-28 11:36:05 -07:00
Kelly Brazil
56e041aa26 add Practical JSON at the Command Line blog link 2021-04-28 11:34:51 -07:00
Kelly Brazil
cf9d48582e Merge pull request #128 from kellyjonbrazil/master
sync branches
2021-04-26 13:17:20 -07:00
Kelly Brazil
92e2252bee fix typo 2021-04-26 12:18:21 -07:00
Kelly Brazil
fd7861db11 Merge pull request #127 from kellyjonbrazil/dev
Dev v1.15.3
2021-04-26 12:12:02 -07:00
Kelly Brazil
35464bbbfb date update 2021-04-26 12:08:10 -07:00
Kelly Brazil
db8ddd7f0e fix for scenarios where the default port range didn't always display, or overrode existing port ranges. 2021-04-26 12:04:03 -07:00
Kelly Brazil
72207c54ee update ufw app info docs to support multiple apps (ufw app info all) 2021-04-26 10:02:02 -07:00
Kelly Brazil
a683f68003 change schema to a list of dictionaries to support ufw app info all use case 2021-04-26 10:00:44 -07:00
Kelly Brazil
8d2d3db3fa formatting 2021-04-25 21:10:21 -07:00
Kelly Brazil
eca785450d add caveats to readme and manpage 2021-04-25 21:06:47 -07:00
Kelly Brazil
5b40a97ce4 add caveats to man page 2021-04-25 20:55:43 -07:00
Kelly Brazil
66cb4e9bde update ufw parser docs 2021-04-25 20:49:35 -07:00
Kelly Brazil
d1f33645ca update ufw tests 2021-04-25 20:40:38 -07:00
Kelly Brazil
5eff65c326 update schema to support port lists and port range lists. Also support other transports than tcp and udp 2021-04-25 20:10:52 -07:00
Kelly Brazil
929c38715d formatting 2021-04-24 12:53:29 -07:00
Kelly Brazil
8c91a7b760 formatting 2021-04-24 12:52:26 -07:00
Kelly Brazil
14289ecd6c more timezone info 2021-04-24 12:50:40 -07:00
Kelly Brazil
b833c44783 add ufw-appinfo parser 2021-04-24 12:47:24 -07:00
Kelly Brazil
e23aa818ea add tests section and timezone info 2021-04-24 12:47:12 -07:00
Kelly Brazil
473d919c13 add another ufw test sample 2021-04-24 10:58:31 -07:00
Kelly Brazil
9f925d6ac9 doc update 2021-04-24 10:22:37 -07:00
Kelly Brazil
f6ca32b3a3 update ufw docs with a note on lists of ports 2021-04-24 10:22:19 -07:00
Kelly Brazil
4cbe84c3d6 add ufw-appinfo tests 2021-04-23 16:15:04 -07:00
Kelly Brazil
ffac5bf9d3 doc update 2021-04-23 16:14:53 -07:00
Kelly Brazil
9aa424f9f8 fix ufw example 2021-04-23 16:14:39 -07:00
Kelly Brazil
0a8495c68e update docs 2021-04-23 16:14:25 -07:00
Kelly Brazil
6aea066cf0 make normalized list appear only when data exists. set magic commands 2021-04-23 16:14:11 -07:00
Kelly Brazil
ff3c2d809e add ufw-appinfo to docs 2021-04-23 09:57:41 -07:00
Kelly Brazil
145059fc89 clean up output if sections are blank 2021-04-23 09:04:11 -07:00
Kelly Brazil
20e5c19de4 fix key error if tcp or udp don't exist 2021-04-23 08:30:34 -07:00
Kelly Brazil
4c98fd4b87 doc update 2021-04-23 08:26:00 -07:00
Kelly Brazil
125e54213e update schema and add normalized fields 2021-04-23 08:13:53 -07:00
Kelly Brazil
0152e0665f initial working ufw-appinfo parser 2021-04-22 16:52:01 -07:00
Kelly Brazil
0679bcbc56 fix ufw tests 2021-04-22 08:33:57 -07:00
Kelly Brazil
5500648aa0 fix ufw docs for int conversions and service behavior 2021-04-22 08:33:45 -07:00
Kelly Brazil
bb50caad4d fix prefix int conversions. don't reset _transport if service is really a list of ports 2021-04-22 08:16:42 -07:00
Kelly Brazil
7eef5d94d5 ufw doc update 2021-04-21 16:55:25 -07:00
Kelly Brazil
74f623f8d6 add support for rule comments and LIMIT and REJECT actions 2021-04-21 16:55:14 -07:00
Kelly Brazil
f638aca092 add deb package name fix 2021-04-21 10:10:36 -07:00
Kelly Brazil
da35eaf80a formatting 2021-04-21 09:10:10 -07:00
Kelly Brazil
ade0e8e8fc add ufw tests 2021-04-21 09:09:23 -07:00
Kelly Brazil
90076090f0 fix int conversions if 'rules' key does not exist 2021-04-21 09:09:09 -07:00
Kelly Brazil
23635def8b add ufw to docs 2021-04-21 07:51:32 -07:00
Kelly Brazil
4eeec087bd add ufw example 2021-04-21 07:49:49 -07:00
Kelly Brazil
7331961038 update docs with new examples that have to_service always existing. 2021-04-21 07:41:32 -07:00
Kelly Brazil
e4acb3d5b7 always make to/from_service None if ports are assigned 2021-04-21 07:08:50 -07:00
Kelly Brazil
c60549a994 change field name from to/from_subnet to to/from_ip_prefix 2021-04-20 22:08:12 -07:00
Kelly Brazil
d46fc8bbfa set to/from_transport to None if to/from_service is set 2021-04-20 21:58:52 -07:00
Kelly Brazil
b133d1f90d strip interface value 2021-04-20 21:52:39 -07:00
Kelly Brazil
5be615a97e add examples for docs 2021-04-20 21:45:13 -07:00
Kelly Brazil
ea1d820f96 convert integer fields 2021-04-20 21:29:49 -07:00
Kelly Brazil
47e262cf72 clean up fields 2021-04-20 21:21:42 -07:00
Kelly Brazil
eec673be90 working raw parser 2021-04-20 20:32:59 -07:00
Kelly Brazil
9a0fb2a7c8 parse major sections 2021-04-20 14:17:01 -07:00
Kelly Brazil
b5145d6c14 version bump to v1.15.3 2021-04-20 13:39:12 -07:00
Kelly Brazil
9747ca414d minor optimization to convert_to_int(). No longer runs through convert_to_float(), but uses standard float() function. 2021-04-20 10:50:20 -07:00
Kelly Brazil
312d465b61 update link 2021-04-19 14:18:12 -07:00
Kelly Brazil
7dcf87d24a formatting 2021-04-19 13:12:55 -07:00
Kelly Brazil
cf3cfd16a9 rename tests 2021-04-19 09:59:58 -07:00
Kelly Brazil
fcc7e52949 Merge pull request #123 from kellyjonbrazil/dev
Dev v1.15.2
2021-04-18 17:28:27 -07:00
Kelly Brazil
3ab9d48014 update changelog 2021-04-18 17:24:42 -07:00
Kelly Brazil
7eddf41c5f dont round up int conversions and fix tests 2021-04-18 17:21:08 -07:00
Kelly Brazil
27a196c938 doc update 2021-04-18 16:42:42 -07:00
Kelly Brazil
e4324f05fb fix indentation in doc 2021-04-18 16:42:34 -07:00
Kelly Brazil
d36b332bd7 use jc.utils for conversions 2021-04-18 16:33:47 -07:00
Kelly Brazil
1f034826f6 use jc.utils for conversions 2021-04-18 13:01:25 -07:00
Kelly Brazil
246c707c98 use jc.utils conversions 2021-04-18 11:46:42 -07:00
Kelly Brazil
b5d8968144 add convert_to_int function 2021-04-17 17:22:59 -07:00
Kelly Brazil
f7b9fbefdd add query_size info for dig 2021-04-17 17:22:44 -07:00
Kelly Brazil
b1fc453383 fix _IfconfigParser name 2021-04-17 17:22:30 -07:00
Kelly Brazil
7581c8d0f4 add query_size field. handle user-specified dig output better - especially when querying dnssec 2021-04-17 17:07:20 -07:00
Kelly Brazil
32bf8ad6f4 update dig docs 2021-04-17 15:02:45 -07:00
Kelly Brazil
b083bcc10f update man page 2021-04-16 16:30:17 -07:00
Kelly Brazil
4f6fdd120d use dig as example 2021-04-16 16:30:04 -07:00
Kelly Brazil
eb0038be24 update dig examples 2021-04-16 16:29:44 -07:00
Kelly Brazil
7ecdf819fa remove dig example from readme, 2021-04-16 16:29:27 -07:00
Kelly Brazil
c6aa4d0835 update docs with new dig parser examples 2021-04-16 16:19:20 -07:00
Kelly Brazil
7c584b89a6 add additional section 2021-04-16 16:04:06 -07:00
Kelly Brazil
c166c0bfda add opt_pseudosection section to output and fix existing tests 2021-04-16 15:22:22 -07:00
Kelly Brazil
a8dd3f7802 working dig axfr fixes 2021-04-16 13:11:02 -07:00
Kelly Brazil
3b0e2f03f3 clean up examples 2021-04-16 08:46:20 -07:00
Kelly Brazil
8390ae48c8 fix server entry when IPv6 address is in value (maxsplit on colons) 2021-04-15 16:53:03 -07:00
Kelly Brazil
2db82c0a7e add systeminfo example 2021-04-14 20:43:58 -07:00
Kelly Brazil
6147954075 update tests 2021-04-14 20:39:35 -07:00
Kelly Brazil
691df271fc add info docstring 2021-04-14 20:30:31 -07:00
Kelly Brazil
89f52b95f7 update systeminfo parser with updated timestamps, normalized blank fields, and new doc style 2021-04-14 20:20:46 -07:00
Kelly Brazil
146acc1bf6 rename functions to make them private 2021-04-14 16:46:16 -07:00
Kelly Brazil
c4a345f59a Merge pull request #106 from jon-rd/j/systeminfo
Add windows systeminfo command parser
2021-04-14 16:39:44 -07:00
Kelly Brazil
dfd2703f75 bump dev to v1.15.2 2021-04-14 16:39:05 -07:00
Jon Smith
325fab2de7 update documentation for parsed structures 2021-04-14 11:52:13 -05:00
Jon Smith
f3d00cf38a append mb to memory key names; adjust expected timestamps to utc tz 2021-04-14 11:38:50 -05:00
Jon Smith
14838f7f5d update schema with nic, hyperv, and process changes 2021-04-14 11:38:50 -05:00
Jon Smith
af74047b81 update schema based on processor/hotfix changes 2021-04-14 11:38:50 -05:00
Jon Smith
660c59129c Add parsing of processors/hotfixs 2021-04-14 11:38:50 -05:00
Jon Smith
89a88e186e Add systeminfo.md file 2021-04-14 11:38:50 -05:00
Jon Smith
f861cf95b9 Change to v0.5; add parser to cli.py; add to docgen 2021-04-14 11:38:50 -05:00
Jon Smith
ee8f06cbdb Add windows systeminfo command parser 2021-04-14 11:38:49 -05:00
Kelly Brazil
a2e8b3c7b6 Merge pull request #121 from kellyjonbrazil/master
Merge pull request #120 from kellyjonbrazil/dev
2021-04-13 16:40:43 -07:00
Kelly Brazil
6c83846075 Merge pull request #120 from kellyjonbrazil/dev
Dev v1.15.1
2021-04-13 14:59:17 -07:00
Kelly Brazil
e0681eebb9 Merge branch 'master' into dev 2021-04-13 14:57:44 -07:00
Kelly Brazil
e5732d1cea update changelog 2021-04-13 14:54:38 -07:00
Kelly Brazil
6e7ae3cd3f formatting of timedatectl docs 2021-04-13 14:51:46 -07:00
Kelly Brazil
f95632d1aa add install_date calculated fields 2021-04-13 14:49:57 -07:00
Kelly Brazil
2f8b7b26e5 update docs for v1.15.1 2021-04-13 14:35:17 -07:00
Kelly Brazil
10292f7502 Merge pull request #119 from kellyjonbrazil/dpkg_l-fix
add _l to module name
2021-04-12 13:15:40 -07:00
Kelly Brazil
aef54705f5 add _l to module name 2021-04-12 13:15:12 -07:00
Kelly Brazil
bba5980fa5 man page update 2021-04-12 13:13:18 -07:00
Kelly Brazil
977425abfb add _l to package name in docs 2021-04-12 13:12:08 -07:00
Kelly Brazil
37a3565a1b Merge pull request #118 from kellyjonbrazil/rpm-qi-doc-fix
fix rpm-qi docs
2021-04-12 13:06:30 -07:00
Kelly Brazil
13deb8bfb6 fix rpm-qi docs 2021-04-12 13:05:34 -07:00
Kelly Brazil
a3ed9d075a remove old parser doc 2021-04-12 13:04:22 -07:00
Kelly Brazil
fb0ced549e fix rpm-qi docs (used underscore instead of dash in name) 2021-04-12 13:01:17 -07:00
Kelly Brazil
7eb31bc7d2 update airport_s docs 2021-04-09 19:55:03 -07:00
Kelly Brazil
6a06a39142 use herestring instead of echo -e into jq 2021-04-09 16:36:20 -07:00
Kelly Brazil
bdcdaee6c5 Merge pull request #117 from kellyjonbrazil/doc_update
add new docs
2021-04-09 15:11:05 -07:00
Kelly Brazil
605353fdce add new docs 2021-04-09 15:10:38 -07:00
Kelly Brazil
490c9e1769 add more cli tests for magic command 2021-04-09 11:38:17 -07:00
Kelly Brazil
6ebebb659d update changelog 2021-04-09 11:10:08 -07:00
Kelly Brazil
0e70c5ee12 update documentation link 2021-04-09 11:04:17 -07:00
Kelly Brazil
cd531acf60 clean up comment 2021-04-09 11:02:19 -07:00
Kelly Brazil
908ac1f61c update docs - remove compatibility section since it is now automatically generated from info() 2021-04-09 10:56:43 -07:00
Kelly Brazil
f5c7e7e404 add updated docs with home link and parser info at the bottom 2021-04-09 10:36:42 -07:00
Kelly Brazil
001c700b5b add home link to the top of the md file 2021-04-09 10:36:03 -07:00
Kelly Brazil
9b41e9bef0 Add parser information header 2021-04-09 10:32:58 -07:00
Kelly Brazil
34bd6e32dc pull each parser as a json object into a bash array and iterate on it to add supplementary information like version, author, and compatibility 2021-04-09 10:26:34 -07:00
Kelly Brazil
c5d058490b move parser doc printing to its own function 2021-04-09 09:12:41 -07:00
Kelly Brazil
dd1ae6d9a7 add man page inside the pypi package for easier packaging in homebrew 2021-04-09 08:09:37 -07:00
Kelly Brazil
d8ea9bde82 doc update 2021-04-08 16:42:57 -07:00
Kelly Brazil
125edc9c90 bail out for -h, -a, and -v in magic() 2021-04-08 16:42:45 -07:00
Kelly Brazil
15ea43e394 add man file to package for easier packaging in homebrew 2021-04-08 16:28:05 -07:00
Kelly Brazil
b55b02687c doc update 2021-04-08 16:14:11 -07:00
Kelly Brazil
da611f0ac6 update docs 2021-04-08 15:53:06 -07:00
Kelly Brazil
b8b8dfead4 update docs 2021-04-08 15:52:49 -07:00
Kelly Brazil
4290a3cbd1 make IfconfigParser class private 2021-04-08 14:00:56 -07:00
Kelly Brazil
a5e2203cee update ifconfig doc 2021-04-08 12:45:08 -07:00
Kelly Brazil
e28c08b136 update documentation 2021-04-08 12:42:01 -07:00
Kelly Brazil
a4b6846f63 man update 2021-04-08 11:37:39 -07:00
Kelly Brazil
2bc8307861 Merge branch 'master' into dev
# Conflicts:
#	man/jc.1
2021-04-08 11:33:50 -07:00
Kelly Brazil
9b39917c79 update docstrings for new help functionality 2021-04-08 11:24:02 -07:00
Kelly Brazil
57c13cc0a3 add support for parser help 2021-04-08 10:54:15 -07:00
Kelly Brazil
b7355fd30d new docstring format for improved documentation 2021-04-08 10:20:24 -07:00
Kelly Brazil
93ae309e40 bump version to 1.15.1 2021-04-08 10:20:00 -07:00
Kelly Brazil
5d8f8365e2 gzip man page 2021-04-07 14:27:34 -07:00
Kelly Brazil
f26909eefb formatting 2021-04-07 11:18:33 -07:00
Kelly Brazil
55bfbb2797 formatting 2021-04-07 11:13:27 -07:00
Kelly Brazil
8970b8342a Merge pull request #115 from kellyjonbrazil/master
Sync master and dev
2021-04-07 09:34:45 -07:00
Kelly Brazil
5285e699c3 fix rpm-qi parser name 2021-04-07 08:07:50 -07:00
Kelly Brazil
275f3860d5 Merge pull request #114 from kellyjonbrazil/dev
Dev v1.15.0
2021-04-07 07:54:41 -07:00
Kelly Brazil
a73fdb7478 update dates 2021-04-07 07:50:17 -07:00
Kelly Brazil
f2d746403a typo fix 2021-04-06 20:30:56 -07:00
Kelly Brazil
b7dbf2c49b doc formatting 2021-04-06 18:53:50 -07:00
Kelly Brazil
21f3c97788 rename rpm_qai to rpm_qi 2021-04-06 18:38:04 -07:00
Kelly Brazil
14b727cc71 add rpm_qi tests 2021-04-06 18:34:08 -07:00
Kelly Brazil
abee226591 rename rpm_qia to rpm_qi 2021-04-06 18:32:47 -07:00
Kelly Brazil
293ad39f4b typo fix 2021-04-06 16:48:31 -07:00
Kelly Brazil
9244302581 rpm parser doc update 2021-04-06 15:07:39 -07:00
Kelly Brazil
753cac25fb only add description if it exists 2021-04-06 14:46:27 -07:00
Kelly Brazil
0548263e89 add rpm -qai parser 2021-04-06 14:39:39 -07:00
Kelly Brazil
53776a9bf8 note -a output is JSON 2021-04-06 11:36:10 -07:00
Kelly Brazil
cc7def9b76 add OSX finger tests 2021-04-06 11:29:30 -07:00
Kelly Brazil
11a4422c25 add centos 7.7 finger tests 2021-04-06 11:23:29 -07:00
Kelly Brazil
3a44785260 del details key if details are blank 2021-04-06 11:23:09 -07:00
Kelly Brazil
e0d430c26c update -r raw option info 2021-04-06 11:00:46 -07:00
Kelly Brazil
417b70020a add idle time fields to finger parser 2021-04-06 10:51:41 -07:00
Kelly Brazil
7b29c464b7 date updated 2021-04-06 10:04:02 -07:00
Kelly Brazil
26d5529d86 remove aix support, add note for -s support. schema update 2021-04-06 10:03:51 -07:00
Kelly Brazil
852103c478 tweak regex to support arbitrary 'detail' data 2021-04-06 10:02:46 -07:00
Kelly Brazil
26a115421b add finger parser 2021-04-05 17:16:38 -07:00
Kelly Brazil
755b941a9a doc update 2021-04-05 17:14:33 -07:00
Kelly Brazil
fd1ca82d86 add finger parser 2021-04-05 17:09:22 -07:00
Kelly Brazil
6fe175344f change examples link to github.io 2021-04-05 13:38:09 -07:00
Kelly Brazil
3590cda13a docs formatting 2021-04-05 12:07:52 -07:00
Kelly Brazil
2f1011dd85 readme update 2021-04-05 12:03:35 -07:00
Kelly Brazil
2b155261b3 use new github.io links for documentation 2021-04-05 12:01:53 -07:00
Kelly Brazil
02f4d606d0 add documentation links to README.md 2021-04-05 11:49:30 -07:00
Kelly Brazil
577811f00b Set theme jekyll-theme-cayman 2021-04-05 11:42:59 -07:00
Kelly Brazil
b4098d67a3 latest 2021-04-05 09:42:35 -07:00
Kelly Brazil
88bd7554ae add status messages 2021-04-05 09:42:25 -07:00
Kelly Brazil
b5ec16c5ca formatting 2021-04-05 09:23:20 -07:00
Kelly Brazil
68fcb60a14 add updatedocs script 2021-04-04 20:56:10 -07:00
Kelly Brazil
e4781d60ce update parser descriptions with backticks surrounding command names 2021-04-04 20:52:34 -07:00
Kelly Brazil
6201fb346a test backticks in description 2021-04-04 20:31:58 -07:00
Kelly Brazil
f88c8343f9 update iw-scan description for documentation 2021-04-04 20:30:53 -07:00
Kelly Brazil
25410d3316 create readmegen.py script. move jinja2 templates to templates folder 2021-04-04 20:28:54 -07:00
Kelly Brazil
4ff9952938 change OSX to macOS 2021-04-04 15:57:44 -07:00
Kelly Brazil
5e3f63a412 add license and copyright info. use variables instead of hard-coded values 2021-04-04 15:53:23 -07:00
Kelly Brazil
e1f57be69e add license info 2021-04-04 15:52:50 -07:00
Kelly Brazil
2c65d5eecc man page updates 2021-04-04 14:40:22 -07:00
Kelly Brazil
aa621f2f1e enhance man page 2021-04-04 14:29:37 -07:00
Kelly Brazil
ac932c6e59 update timestamp docs 2021-04-03 14:48:30 -07:00
Kelly Brazil
029f79da16 added info regarding updated dev scripts for automating doc generation 2021-04-02 21:52:08 -07:00
Kelly Brazil
153b2b4a7a use jc to help automate the generation of its own docs 2021-04-02 21:50:04 -07:00
Kelly Brazil
709b2fe4ee add -h and -v options 2021-04-02 18:08:46 -07:00
Kelly Brazil
09c1fccc58 manpage updates 2021-04-02 18:04:55 -07:00
Kelly Brazil
fd254d99b7 add manpage generator 2021-04-02 17:40:09 -07:00
Kelly Brazil
88bd2c1722 fix typo 2021-04-02 16:31:22 -07:00
Kelly Brazil
d03e2f0fc1 add parser schema guidelines 2021-04-02 15:01:21 -07:00
Kelly Brazil
3f12a393bd formatting 2021-04-02 13:25:23 -07:00
Kelly Brazil
8c21284c50 remove redundant license info 2021-04-02 13:23:26 -07:00
Kelly Brazil
e7d396c215 update issues link 2021-04-02 13:21:56 -07:00
Kelly Brazil
f238fac0eb add contributing guidelines 2021-04-02 13:19:47 -07:00
Kelly Brazil
017228f80d add tested on Windows 10 2021-04-02 12:14:26 -07:00
Kelly Brazil
286c5fa943 add dir parser 2021-04-02 12:12:43 -07:00
Kelly Brazil
74cfc13abe fixup dir parser tests 2021-04-02 12:10:05 -07:00
Kelly Brazil
0ee4a6c377 update schema and add epoch naive timestamp 2021-04-02 12:01:39 -07:00
Kelly Brazil
283433578d add dir parser 2021-04-02 12:01:23 -07:00
Kelly Brazil
9559c85057 add windows dir format 2021-04-02 12:01:05 -07:00
Kelly Brazil
c5c020f565 add /S option 2021-04-02 11:16:03 -07:00
Kelly Brazil
95ec79bceb Merge pull request #107 from rasheed-rd/add-dir-parser
Add windows dir command parser
2021-04-02 11:14:26 -07:00
Kelly Brazil
8f8be8aa33 add -1 option info 2021-04-02 11:14:06 -07:00
Rasheed Elsaleh
5b60c7445a Add support for /S and update documentation 2021-04-02 13:43:06 -04:00
Rasheed Elsaleh
d9dbcc8b52 Add parent dir to structure. Add test cases. Remove support for /Q 2021-04-02 13:13:05 -04:00
Kelly Brazil
79bc525970 add codes field to schema 2021-04-01 20:42:36 -07:00
Kelly Brazil
9dae1091dd typo fix 2021-04-01 20:41:05 -07:00
Kelly Brazil
74d3ac686a add dpkg-l tests 2021-04-01 20:37:12 -07:00
Kelly Brazil
cf3cc636ba add dpkg-l parser info 2021-04-01 20:25:56 -07:00
Kelly Brazil
a720441e1d add dpkg -l example 2021-04-01 20:24:19 -07:00
Kelly Brazil
0a7ed0959d rename err to error 2021-04-01 20:17:21 -07:00
Kelly Brazil
eb83c9b86d replace parse_datetime_to_timestamp with timestamp class 2021-04-01 20:13:40 -07:00
Kelly Brazil
5c0142dd19 add dpkg-l parser 2021-04-01 20:12:58 -07:00
Kelly Brazil
c326c8dc83 add TypeError to except block. add /usr/bin/time tests 2021-04-01 12:52:10 -07:00
Kelly Brazil
fc4082a03f remove old parse_datetime_to_timestamp function 2021-04-01 11:26:02 -07:00
Kelly Brazil
c8655565ff use new timestamp class 2021-04-01 11:23:24 -07:00
Kelly Brazil
638f879f16 use new timestamp class 2021-04-01 11:21:27 -07:00
Kelly Brazil
1d221bf7e6 use new timestamp class 2021-04-01 11:19:49 -07:00
Kelly Brazil
60ea71f0ef use new timestamp class 2021-04-01 11:18:03 -07:00
Kelly Brazil
d8bdd35a3f use new timestamp class 2021-04-01 11:17:53 -07:00
Kelly Brazil
7463891c53 use new timestamp class 2021-04-01 11:13:02 -07:00
Kelly Brazil
7537aec76f use jc.utils.timestamp instead of jc.utils.parse_datetime_to_timestamp() 2021-04-01 11:08:27 -07:00
Kelly Brazil
62234e39a8 use jc.utils.timestamp instead of jc.utils.parse_datetime_to_timestamp() 2021-04-01 11:08:20 -07:00
Kelly Brazil
be004b7b3f make parse_datetime_to_timestamp function a class called timestamp for easier use 2021-04-01 11:07:37 -07:00
Kelly Brazil
82539444b2 fix indentation for int and float conversions. add real_time field to schema 2021-03-31 20:48:44 -07:00
Kelly Brazil
a571d3cbaf fix typo 2021-03-31 20:41:04 -07:00
Kelly Brazil
a038c14c23 change microseconds to centiseconds 2021-03-31 20:39:03 -07:00
Kelly Brazil
25a85d874c update docs 2021-03-31 20:21:29 -07:00
Kelly Brazil
884c36ff42 add /usr/bin/time parser 2021-03-31 20:19:46 -07:00
Kelly Brazil
b98e72b8b4 add ls parser info 2021-03-30 21:33:23 -07:00
Kelly Brazil
05885c0096 add epoch and epoch_utc timestamps 2021-03-30 21:29:34 -07:00
Kelly Brazil
4c9761231a add when_epoch and when_epoch_utc fields 2021-03-30 20:41:10 -07:00
Kelly Brazil
656eaa1508 formatting 2021-03-30 16:43:53 -07:00
Kelly Brazil
1560dcddcf add acpi, upower parsers and -v version option 2021-03-30 16:43:02 -07:00
Kelly Brazil
08d4cd4870 add time calculations to acpi parser 2021-03-30 16:34:01 -07:00
Kelly Brazil
9767a50ced update who parser to add epoch naive timestamp 2021-03-30 11:59:44 -07:00
Kelly Brazil
cd86890ed1 add website to info and use variables for version info 2021-03-30 08:05:26 -07:00
Kelly Brazil
ba0dd3b9ca add parse_timedate_to_timestamp test for format 7300 2021-03-29 21:25:19 -07:00
Kelly Brazil
8d7fa07ffd unformat json 2021-03-29 21:20:19 -07:00
Kelly Brazil
cade1bfe6e update timedatectl tests for new epoch_utc field 2021-03-29 21:19:12 -07:00
Kelly Brazil
daec4ab0a7 add epoch_utc field to timedatectl parser 2021-03-29 21:16:40 -07:00
Kelly Brazil
3c96bc3196 version bump 2021-03-29 20:57:58 -07:00
Kelly Brazil
7f7d8d4bd6 update stat docs 2021-03-29 20:36:10 -07:00
Kelly Brazil
47263661a4 update stat example 2021-03-29 20:30:20 -07:00
Kelly Brazil
4c42a086d2 clean up debug code 2021-03-29 20:25:54 -07:00
Kelly Brazil
5d2541a5c4 remove auto c locale and use a manual format rule for windows and linux compatibility 2021-03-29 20:22:35 -07:00
Kelly Brazil
d91d170b49 try manual c locale format for windows 2021-03-29 20:16:05 -07:00
Kelly Brazil
6d1f4584a9 try manually setting time format for windows compatibility 2021-03-29 20:05:42 -07:00
Kelly Brazil
1d76d96bcf debug windows issue 2021-03-29 16:58:57 -07:00
Kelly Brazil
e8847c998c update stat tests 2021-03-29 16:35:26 -07:00
Kelly Brazil
da88e49bae add new examples 2021-03-29 15:36:16 -07:00
Kelly Brazil
65c3a12e54 simplify None data scenario 2021-03-29 15:32:04 -07:00
Kelly Brazil
d8d600cc36 add reference to -h for help 2021-03-29 14:51:48 -07:00
Kelly Brazil
507999b117 add stat command timestamp detection 2021-03-29 14:45:13 -07:00
Kelly Brazil
8ad164eb34 fix tests for compact output 2021-03-29 12:33:54 -07:00
Kelly Brazil
a507df140b add compact json info 2021-03-29 12:25:58 -07:00
Kelly Brazil
8912a99986 make default json output more compact 2021-03-29 12:25:48 -07:00
Kelly Brazil
1953f98828 add version info. add json now supports unicode output 2021-03-29 11:44:43 -07:00
Kelly Brazil
7515218ddd use jc.utils for all warning and error messages. simply error and warning formatting. 2021-03-29 11:42:01 -07:00
Kelly Brazil
36c1120136 formatting 2021-03-29 10:59:56 -07:00
Kelly Brazil
8fa0fe64d8 add -v to helptext. minor formatting 2021-03-29 10:52:02 -07:00
Kelly Brazil
c1a8201b14 add copyright 2021-03-29 10:24:58 -07:00
Kelly Brazil
398bbac48c simplify return value for parse_datetime_to_timestamp() 2021-03-29 10:23:52 -07:00
Kelly Brazil
ea71a42bbd formatting 2021-03-29 09:43:19 -07:00
Kelly Brazil
1c16d25b17 add version option (-v) and copyright information. add 'ensure_ascii=False' to json dumps to properly show UTF-8 copyright character 2021-03-29 09:41:15 -07:00
Kelly Brazil
9d12ded889 help description change 2021-03-26 16:32:17 -07:00
Kelly Brazil
5312701515 add - make all external python requirements optional 2021-03-26 16:29:10 -07:00
Kelly Brazil
808c7bc0a9 make xmltodict library optional 2021-03-26 16:14:35 -07:00
Kelly Brazil
4d394015f4 make ruamel.yaml library optional 2021-03-26 16:10:28 -07:00
Kelly Brazil
3638298af8 make pygments library optional 2021-03-26 15:54:45 -07:00
Kelly Brazil
5f00973e40 remove parenthesis to normalize text for naive timezone detection 2021-03-26 15:38:57 -07:00
Kelly Brazil
0f6e2c14fc simplify timestamp failure logic 2021-03-26 14:57:19 -07:00
Kelly Brazil
51813da619 add offset timezones. fix timestamp logic on conversion failure 2021-03-26 14:56:45 -07:00
Kelly Brazil
e7751322ea formatting 2021-03-26 14:55:47 -07:00
Kelly Brazil
26ef298437 change return to always include the entire object but all keys may be None if conversion fails 2021-03-26 14:55:16 -07:00
Kelly Brazil
badaf8ce73 comment formatting 2021-03-26 14:00:33 -07:00
Kelly Brazil
b123a62203 move locale change formats to the end of the list 2021-03-26 13:11:34 -07:00
Kelly Brazil
cfd77e4252 reset locale to None on exception 2021-03-26 13:01:12 -07:00
Kelly Brazil
38f814072e better normalization of datetime string. better UTC detection. More formats supported with detected locale. 2021-03-26 11:55:12 -07:00
Kelly Brazil
a0db7754e3 add nixos install info 2021-03-26 09:32:49 -07:00
Kelly Brazil
f07620afc7 move version to jc.__init__.py
add -h option for help instead of always showing on error
use jc.utils.error_message for the following errors: missing/incorrect arguments, parser not found, missing piped data
2021-03-26 09:28:03 -07:00
Kelly Brazil
c1b0d27752 remove old commented commands 2021-03-25 20:45:38 -07:00
Kelly Brazil
430a5108aa move all tests to github actions 2021-03-25 20:42:58 -07:00
Kelly Brazil
111ce92fc9 attempt all tests in github actions with timezone correction 2021-03-25 20:37:35 -07:00
Kelly Brazil
c851e8a58d force github action 2021-03-25 20:33:25 -07:00
Kelly Brazil
39f4bcd9b4 Change Windows timezone
use "Pacific Standard Time"
2021-03-25 20:30:13 -07:00
Kelly Brazil
4a610c4c81 force github action 2021-03-25 19:57:32 -07:00
Kelly Brazil
89ee11945d Change timezone provider
uses: szenius/set-timezone@v1.0
2021-03-25 19:55:21 -07:00
Kelly Brazil
dadb09b74a force github action 2021-03-25 19:52:43 -07:00
Kelly Brazil
1b1f638b97 Change timezone change provider
change to actions/set-timezone-action
2021-03-25 19:49:03 -07:00
Kelly Brazil
794fc4ed44 add parse_datetime_to_timestamp() tests 2021-03-25 19:43:16 -07:00
Kelly Brazil
72f735bf92 Set Timezone to America/Los_Angeles
Using zcong1993/setup-timezone
2021-03-25 19:42:02 -07:00
Kelly Brazil
912877f25a additional timezone info 2021-03-25 15:34:54 -07:00
Kelly Brazil
2772c5ae43 formatting 2021-03-25 15:10:07 -07:00
Rasheed Elsaleh
a7ad24d2cb Add dir parser
Add usage commands

Fix example options

update dir.md
2021-03-25 18:09:47 -04:00
Kelly Brazil
a364a6a9fa add note regarding calculated timestamps 2021-03-25 15:08:23 -07:00
Kelly Brazil
7b2dc86a8d update last example with new timestamp fields 2021-03-25 12:07:36 -07:00
Kelly Brazil
ad645636d0 update uptime docs 2021-03-25 11:43:30 -07:00
Kelly Brazil
2f2f297b29 update uptime fixtures with new fields 2021-03-25 11:35:21 -07:00
Kelly Brazil
099ae3fde0 fix issue when there is no data 2021-03-25 11:17:44 -07:00
Kelly Brazil
e9febe98ac add localtest partition lines for readability 2021-03-25 11:17:01 -07:00
Kelly Brazil
5fbd07cccf rewrite of uptime parser including new fields 2021-03-25 10:31:12 -07:00
Kelly Brazil
5fed4698c2 update docs and version number 2021-03-24 21:57:04 -07:00
Kelly Brazil
ed7eb0983a use parse_datetime_to_timestamp function instead of custom format string 2021-03-24 21:51:43 -07:00
Kelly Brazil
90c7e18e5f update date example 2021-03-24 21:50:32 -07:00
Kelly Brazil
953ab5c3bd make upower tests local only 2021-03-24 21:29:30 -07:00
Kelly Brazil
699c97d8a0 add last parser info 2021-03-24 21:24:47 -07:00
Kelly Brazil
e4ca0de92a add upower tests 2021-03-24 21:24:25 -07:00
Kelly Brazil
04745a36b8 doc update 2021-03-24 20:21:06 -07:00
Kelly Brazil
5936940532 rewrite of date parser using datetime library 2021-03-24 20:20:53 -07:00
Kelly Brazil
b3eb064b67 clarify format definition comments 2021-03-24 17:13:01 -07:00
Kelly Brazil
e4b41057e3 update upower fixture names 2021-03-24 17:02:17 -07:00
Kelly Brazil
1d41c46cc7 normalize datetime string to remove all timezones except UTC 2021-03-24 17:01:56 -07:00
Kelly Brazil
a5c444587b add before and after midnight date tests 2021-03-24 15:13:10 -07:00
Kelly Brazil
a56f471be9 update fixture to use UTC for better testing 2021-03-24 15:05:22 -07:00
Kelly Brazil
6a6b26ed8d fix 12 to 24 hour conversion for midnight cases 2021-03-24 15:04:39 -07:00
Kelly Brazil
f62446c152 rename variables. add another european time format 2021-03-24 15:04:09 -07:00
Kelly Brazil
56011f1f17 updated upower examples 2021-03-24 14:14:22 -07:00
Kelly Brazil
6d44091c80 refactor parse_datetime_to_timestamp() 2021-03-24 14:01:06 -07:00
Kelly Brazil
440c458eb4 no need for ternary clause 2021-03-24 12:57:19 -07:00
Kelly Brazil
798250af61 use jc.utils.parse_datetime_to_timestamp() function for timestamp creation 2021-03-24 12:49:53 -07:00
Kelly Brazil
c762de29c6 doc updates 2021-03-24 12:47:57 -07:00
Kelly Brazil
0701e65e97 add parse_datetime_to_timestamp() function 2021-03-24 12:36:54 -07:00
Kelly Brazil
209d54e8b5 add hour_24 to schema docs 2021-03-24 07:39:11 -07:00
Kelly Brazil
2b38462de7 update examples 2021-03-23 14:59:03 -07:00
Kelly Brazil
1e8e553316 add hour_24 field 2021-03-23 14:47:44 -07:00
Kelly Brazil
ab42e6bb15 formatting 2021-03-23 14:10:42 -07:00
Kelly Brazil
6802884540 ensure period is always uppercase in dict value. update period documentation 2021-03-23 14:04:36 -07:00
Kelly Brazil
7cb8577b96 correct epoch_utc calculation. Fix for 12 hour vs. 24 hour representation 2021-03-23 13:55:23 -07:00
Kelly Brazil
55810ccd1f set epoch_dt conversion again if not C locale 2021-03-22 22:10:35 -07:00
Kelly Brazil
f9921720cd revert to local testing for naive datetime objects 2021-03-22 22:01:07 -07:00
Kelly Brazil
cda1ebd271 try tzset() 2021-03-22 21:53:50 -07:00
Kelly Brazil
6901e4a23a try setting timezone env variable before tests to ensure it is the same on all test systems 2021-03-22 21:49:26 -07:00
Kelly Brazil
6bc21d3c73 fix date parser tests - local tests only since timezones may not match on github actions VMs 2021-03-22 21:05:39 -07:00
Kelly Brazil
1ef231e26a add date parser updates 2021-03-22 20:57:36 -07:00
Kelly Brazil
3cd43f0f98 formatting 2021-03-22 20:57:16 -07:00
Kelly Brazil
1565019966 fix weekday numbering to be ISO 8601 compliant. Add naive calculated epoch timestamp field 2021-03-22 20:56:57 -07:00
Kelly Brazil
0a4de2d3a1 add naive datetime calculation info to docs 2021-03-22 20:22:35 -07:00
Kelly Brazil
a058f6c174 added naive epoch calculation info to docs 2021-03-22 20:21:46 -07:00
Kelly Brazil
d8e5d03b01 naive updated_epoch timestamp calculation added 2021-03-22 20:21:12 -07:00
Kelly Brazil
9dc62eff2e remove epoch conversions 2021-03-21 15:43:37 -07:00
Kelly Brazil
d4fea17c57 use UTC when calculating epoch timestamp. reset time locale to default after changing 2021-03-21 14:03:36 -07:00
Kelly Brazil
3dd7a5b77e add upower docs 2021-03-19 11:00:50 -07:00
Kelly Brazil
d77c90a3ba fix quoted values in detail level. Add examples 2021-03-19 10:43:20 -07:00
Kelly Brazil
01f0c20df0 add sample using C locale timestamp 2021-03-18 16:59:46 -07:00
Kelly Brazil
aafbe576b3 working parser and processor 2021-03-18 16:59:19 -07:00
Kelly Brazil
bd68ad4034 don't modify detail_type value since it is no longer a key 2021-03-17 14:31:51 -07:00
Kelly Brazil
bfee017c13 made the schema more explicit by hardcoding more items. still working on the schema 2021-03-17 14:21:19 -07:00
Kelly Brazil
61f532cfd0 working history list 2021-03-17 13:30:47 -07:00
Kelly Brazil
58dbbb75b6 simplified logic 2021-03-17 13:10:52 -07:00
Kelly Brazil
8d88b91fcf move if statements and generalize the history detail detection 2021-03-17 12:49:48 -07:00
Kelly Brazil
ad39fc6029 working upower parser. history lines are ignored 2021-03-17 11:26:06 -07:00
Kelly Brazil
89f1fd96e6 add acpi tests 2021-03-16 12:12:01 -07:00
Kelly Brazil
bd425f2493 version bump to v1.15.0. Add acpi docs 2021-03-16 11:45:56 -07:00
Kelly Brazil
46962ff02a remove redundant lines 2021-03-12 16:45:15 -08:00
Kelly Brazil
e4cb88b051 remove unneeded line-state assignment 2021-03-12 12:47:59 -08:00
Kelly Brazil
32840703dc remove redundant code 2021-03-12 08:55:04 -08:00
Kelly Brazil
1f7aafd041 fix for full charge batter case. Clean up battery object logic 2021-03-12 08:45:32 -08:00
Kelly Brazil
7378d5dce4 remove comment 2021-03-11 21:06:24 -08:00
Kelly Brazil
84f76866cd working process function 2021-03-11 21:05:29 -08:00
Kelly Brazil
322da9ea6a working parser 2021-03-11 20:43:31 -08:00
Kelly Brazil
58645301ec add acpi command parser 2021-03-11 19:55:47 -08:00
Kelly Brazil
1e18dd30a8 Merge pull request #102 from kellyjonbrazil/dev
Dev v1.14.4
2021-03-05 11:50:37 -08:00
Kelly Brazil
cc6a19adcc fix typo in comments 2021-03-05 09:41:17 -08:00
Kelly Brazil
2a5588b177 packaging fix for yaml parser and pyoxidizer 2021-03-05 09:38:22 -08:00
Kelly Brazil
20f9b7f88b fix typo 2021-02-25 11:09:56 -08:00
Kelly Brazil
d7e32313cd fix typo 2021-02-25 11:09:14 -08:00
Kelly Brazil
fb5654d3c4 formatting 2021-02-11 11:27:54 -08:00
Kelly Brazil
258f1433b3 add locale info to readme 2021-02-11 11:27:01 -08:00
Kelly Brazil
fb723ae8bd Merge pull request #101 from kellyjonbrazil/dev
Dev v1.14.3
2021-02-10 11:01:57 -08:00
Kelly Brazil
283b89e37c simplify answer data logic 2021-02-10 10:55:53 -08:00
Kelly Brazil
f450f9eb8b add hciconfig tests 2021-02-10 10:47:56 -08:00
Kelly Brazil
b3f8cf99a4 work for both tabs and spaces 2021-02-10 08:03:36 -08:00
Kelly Brazil
4301ea8cae remove debug line 2021-02-09 16:12:36 -08:00
Kelly Brazil
c672d1c174 initial working hciconfig parser 2021-02-09 16:03:00 -08:00
Kelly Brazil
229e953a38 initial add of hciconfig parser 2021-02-09 13:26:24 -08:00
Kelly Brazil
87b506dc9b fix for spaces in dig answer data 2021-02-05 06:55:06 -08:00
Kelly Brazil
15c9002d9e simplify logic by taking out 'not' in JC_COLORS parsing 2021-01-08 11:56:56 -08:00
Kelly Brazil
042aaa61b9 minor updates 2021-01-08 08:23:29 -08:00
Kelly Brazil
ef856c6ba5 clarify -q option 2021-01-07 12:09:41 -08:00
Kelly Brazil
9cf5be73e3 typo fix 2021-01-06 16:19:47 -08:00
Kelly Brazil
63fc149e2a typo fix 2021-01-06 16:17:25 -08:00
Kelly Brazil
3c25839350 Merge pull request #98 from kellyjonbrazil/dev
Dev v1.14.1
2021-01-06 14:37:24 -08:00
Kelly Brazil
58246e33b7 update compatibility info and changelog date 2021-01-06 14:33:38 -08:00
Kelly Brazil
8b1407c706 pull env-specific tests from CI/CD and run locally only 2021-01-06 14:22:26 -08:00
Kelly Brazil
2fde4a4e22 doc updates 2021-01-06 12:07:58 -08:00
Kelly Brazil
60b9e97982 last parser enhancements: augment hostname with CONSOLE for GUI login, add convenience fields when -F is used: login_epoch, logout_epoch, duration_seconds, calculate duration to hours:minutes 2021-01-06 12:02:47 -08:00
Kelly Brazil
0adac79c0f Add last parser enhancements 2021-01-06 11:09:59 -08:00
Kelly Brazil
9f485b5981 change mac_address fieldname to bssid. Add credit to Phillip 2021-01-06 11:09:37 -08:00
Kelly Brazil
db17d21b8f Merge pull request #97 from pschmitt/iw_scan_fix_space_detection
iw_scan: Improve detection of lines starting with spaces
2021-01-06 10:42:30 -08:00
Philipp Schmitt
996d394e89 iw_scan: Improve detection of lines starting with spaces 2021-01-06 10:32:17 +01:00
Kelly Brazil
5885b960f9 doc updates 2021-01-05 22:12:13 -08:00
Kelly Brazil
79987b35f3 formatting 2021-01-05 22:07:22 -08:00
Kelly Brazil
661b3ef311 doc updates 2021-01-05 22:04:44 -08:00
Kelly Brazil
fb422726a8 update test to add 'down' condition 2021-01-05 21:55:06 -08:00
Kelly Brazil
4fb6f3ea59 add support for down in addition to crash 2021-01-05 21:51:30 -08:00
Kelly Brazil
f78fe771e1 add iw-scan tests 2021-01-05 21:38:51 -08:00
Kelly Brazil
567b887253 doc updates 2021-01-05 21:26:43 -08:00
Kelly Brazil
e516e6b946 fix country/environment fields and process int/float conversions 2021-01-05 21:17:40 -08:00
Kelly Brazil
62748676aa initial iw-scan parser 2021-01-05 20:44:22 -08:00
Kelly Brazil
7351c72e45 add fixes and tests for entries that contain 'crash' 2021-01-05 15:16:40 -08:00
Kelly Brazil
2b7405c5e2 doc updates 2021-01-05 13:58:38 -08:00
Kelly Brazil
e2c77cb935 add test for last -F output 2021-01-05 13:00:38 -08:00
Kelly Brazil
7ac621e4c9 add -F support 2021-01-05 12:29:29 -08:00
Kelly Brazil
d8b5d6c66c version bump to 1.14.1 2021-01-05 09:45:37 -08:00
Kelly Brazil
22b461eb4b Add period field for en_US.UTF-8 locale 2021-01-05 09:42:05 -08:00
Kelly Brazil
b37ee8555a changelog update 2021-01-04 18:02:07 -08:00
Kelly Brazil
1d0ad2f045 doc fixes 2021-01-04 18:01:16 -08:00
Kelly Brazil
ceccfb2c81 add test output for iw-scan and date on ubuntu 20.04 2021-01-04 17:05:26 -08:00
Kelly Brazil
03c02953cd add wc doc 2021-01-01 12:01:56 -08:00
Kelly Brazil
f254a0eaa1 version bump 2020-12-31 16:45:10 -08:00
Kelly Brazil
9e3b88727c Merge pull request #91 from kellyjonbrazil/dev
Dev v1.14.0
2020-12-31 16:40:36 -08:00
Kelly Brazil
b12217466e spelling 2020-12-31 16:37:47 -08:00
Kelly Brazil
8b9c932f9b update date 2020-12-31 16:37:14 -08:00
Kelly Brazil
5986ce03db add printenv info 2020-12-31 16:36:27 -08:00
Kelly Brazil
a7b0e936e4 add vdir and printenv info 2020-12-31 14:21:24 -08:00
Kelly Brazil
cb02211424 add wc tests 2020-12-31 14:19:45 -08:00
Kelly Brazil
bd443bf392 add printenv to env docs 2020-12-31 14:11:25 -08:00
Kelly Brazil
1f547edd36 add printenv to env docs 2020-12-31 14:10:56 -08:00
Kelly Brazil
e4bac3a493 add wc parser 2020-12-31 14:10:37 -08:00
Kelly Brazil
5e6bfa681a add vdir info 2020-12-31 13:18:53 -08:00
Kelly Brazil
276160125e add new commands to README 2020-12-30 14:04:49 -08:00
Kelly Brazil
d4ae5543f2 add hash tests 2020-12-30 13:11:13 -08:00
Kelly Brazil
55f360e267 add hash command parser 2020-12-30 12:58:52 -08:00
Kelly Brazil
fdedab2a0c description updates 2020-12-30 11:33:29 -08:00
Kelly Brazil
a9be42e303 specify parser warnings for quiet option 2020-12-30 11:28:42 -08:00
Kelly Brazil
6da9510e46 add cksum tests 2020-12-30 11:22:17 -08:00
Kelly Brazil
0431798178 add cksum parser 2020-12-30 11:02:02 -08:00
Kelly Brazil
62432f3c48 update hashsum description 2020-12-30 09:59:54 -08:00
Kelly Brazil
9fbbc30906 add supported commands to docs 2020-12-29 13:09:03 -08:00
Kelly Brazil
d1567d1f62 add hashsum documentation 2020-12-29 13:05:04 -08:00
Kelly Brazil
6ca1f5970b Merge branch 'dev' of https://github.com/kellyjonbrazil/jc into dev 2020-12-29 12:59:02 -08:00
Kelly Brazil
1c880b9e24 force git tests 2020-12-29 12:58:04 -08:00
Kelly Brazil
3b7d54c720 add python 3.9 2020-12-29 12:55:30 -08:00
Kelly Brazil
44a7406057 add hashsum tests 2020-12-29 12:51:43 -08:00
Kelly Brazil
8157dcfdb1 fix for files with spaces in the name 2020-12-29 12:25:20 -08:00
Kelly Brazil
28762aea15 add hashsum parser 2020-12-29 11:36:20 -08:00
Kelly Brazil
439871ea9f add ubuntu 2020-11-19 07:07:30 -08:00
Kelly Brazil
c9180b005c formatting 2020-08-30 11:58:42 -07:00
Kelly Brazil
b14e0725f8 add ansible plugin blog post link 2020-08-30 11:57:55 -07:00
Kelly Brazil
70fe3dcb4d formatting 2020-08-26 15:21:45 -07:00
Kelly Brazil
8c554604a4 formatting 2020-08-26 14:41:01 -07:00
Kelly Brazil
a0a35454bd add link to the web demo 2020-08-26 14:39:40 -07:00
Kelly Brazil
e8467e2af5 remove extra space 2020-08-20 10:57:13 -07:00
Kelly Brazil
7515deb566 add ansible install command 2020-08-20 10:39:34 -07:00
Kelly Brazil
ed9e52af24 spelling 2020-08-20 10:37:15 -07:00
Kelly Brazil
592a380410 add Ansible note 2020-08-20 10:35:49 -07:00
Kelly Brazil
1a458d2d5b update link 2020-08-11 07:00:07 -07:00
Kelly Brazil
0e4cf53b92 add parser docs link 2020-08-11 06:36:30 -07:00
Kelly Brazil
e2f06ccb33 formatting 2020-08-06 13:00:33 -07:00
Kelly Brazil
8abff004cd indentation fix 2020-08-06 12:59:30 -07:00
Kelly Brazil
c4a0e2e3fe fix indentation 2020-08-06 12:58:53 -07:00
Kelly Brazil
4f10f79c73 standardize doc 2020-08-06 12:55:24 -07:00
Kelly Brazil
69e7a560fd add output info to docs 2020-08-06 07:48:08 -07:00
Kelly Brazil
59b1055808 enhance docs 2020-08-05 16:51:58 -07:00
Kelly Brazil
6ed48c6289 enhance docs 2020-08-05 15:34:17 -07:00
Kelly Brazil
f2fb4d3f41 improve docs 2020-08-05 15:10:48 -07:00
Kelly Brazil
6aeea59ea8 doc updates 2020-08-05 15:08:42 -07:00
Kelly Brazil
d016f3bbb3 improve documentation 2020-08-05 15:07:33 -07:00
Kelly Brazil
7131c29718 add module usage info to docs 2020-08-05 13:32:59 -07:00
Kelly Brazil
7432442983 add usage 2020-08-05 13:31:52 -07:00
Kelly Brazil
5344883394 spelling/add ping parser update 2020-08-05 11:35:52 -07:00
Kelly Brazil
3fcd2f6c2e version bump 2020-08-05 11:34:29 -07:00
Kelly Brazil
f3d84bd5bf tighten crontab and crontab-u parser variable detection 2020-08-05 11:28:37 -07:00
Kelly Brazil
549780c232 add debian/apt-get info 2020-08-05 11:04:07 -07:00
Kelly Brazil
2a6da69b82 improve linux/bsd check 2020-08-05 09:58:01 -07:00
Kelly Brazil
5c538816cf ping parser fix for raspberry pi 2020-08-04 17:36:35 -07:00
Kelly Brazil
7b8b378a7d add pydoc-markdown version requirement 2020-08-03 12:39:18 -07:00
Kelly Brazil
e30a75e25c Merge pull request #76 from kellyjonbrazil/dev
Dev v1.13.2
2020-08-03 10:18:39 -07:00
Kelly Brazil
85ad5cfd0b date change 2020-08-03 10:14:13 -07:00
Kelly Brazil
88b9d5068c finish date parser 2020-08-03 09:26:37 -07:00
Kelly Brazil
f8c4948a09 remove comment 2020-07-31 16:52:48 -07:00
Kelly Brazil
412322447f add month_num and weekday_num fields 2020-07-31 16:51:05 -07:00
Kelly Brazil
d4f289e40f documentation fixup 2020-07-31 14:47:06 -07:00
Kelly Brazil
e1f3feb8f5 cover empty data case in process 2020-07-31 14:45:30 -07:00
Kelly Brazil
37d3bc699c add date parser 2020-07-31 14:39:02 -07:00
Kelly Brazil
672fd18016 date bump 2020-07-31 12:59:44 -07:00
Kelly Brazil
bc2c23a2a0 version bump 2020-07-31 12:58:58 -07:00
Kelly Brazil
865f7e7812 add kv parser to man page 2020-07-31 12:58:11 -07:00
Kelly Brazil
720212b552 fixup traceroute example with new behavior 2020-07-31 11:02:24 -07:00
Kelly Brazil
d3be61f608 version bump 2020-07-31 10:59:46 -07:00
Kelly Brazil
13418b16b8 doc update 2020-07-31 10:56:51 -07:00
Kelly Brazil
42d2017cd6 traceroute updates: handle missing header row, add annotations, don't print timeouts as probes 2020-07-31 10:53:47 -07:00
Kelly Brazil
4345e76ead change to use --kv for key/value files 2020-07-30 16:49:38 -07:00
Kelly Brazil
741431322b update tests for kv parser 2020-07-30 16:45:36 -07:00
Kelly Brazil
980beaaf41 fix docgen issue 2020-07-30 16:21:03 -07:00
Kelly Brazil
2205034e09 add kv parser 2020-07-30 16:20:51 -07:00
Kelly Brazil
82b9c87a66 update docs 2020-07-30 16:20:24 -07:00
Kelly Brazil
dda517a937 shorten more examples 2020-07-29 14:36:20 -07:00
Kelly Brazil
4e6d283b9e shorten netstat example 2020-07-29 14:27:13 -07:00
Kelly Brazil
55acab05aa change name to CHANGELOG 2020-07-29 11:55:16 -07:00
Kelly Brazil
ed38a18d23 remove more examples 2020-07-29 11:49:00 -07:00
Kelly Brazil
95b3c11203 remove more examples 2020-07-29 11:43:22 -07:00
Kelly Brazil
dce318f4fd remove examples to reduce file size 2020-07-29 11:40:47 -07:00
Kelly Brazil
85127f0fb8 move examples to root 2020-07-29 11:34:43 -07:00
Kelly Brazil
fb45058244 add examples file 2020-07-29 11:32:18 -07:00
Kelly Brazil
45bb5ae389 spelling 2020-07-28 11:03:41 -07:00
Kelly Brazil
339238ab36 version bump and add route -6 tests 2020-07-27 20:37:33 -07:00
Kelly Brazil
032cda8b3d Merge pull request #74 from kellyjonbrazil/dev
Dev v1.13.0
2020-07-27 19:12:21 -07:00
Kelly Brazil
6badd3fb1e add parser count test 2020-07-27 19:02:23 -07:00
Kelly Brazil
724d825745 add tracepath parser 2020-07-27 19:02:11 -07:00
Kelly Brazil
ff1e32ad2e version bump 2020-07-27 16:49:34 -07:00
Kelly Brazil
a5f97febd3 update traceroute, tracepath, and uname tests 2020-07-27 16:47:41 -07:00
Kelly Brazil
5baa6cc865 add route parser update 2020-07-27 15:44:13 -07:00
Kelly Brazil
7a4f30b843 fix for iface issue 2020-07-27 15:37:44 -07:00
Kelly Brazil
b2c385dc4f change 'if' to 'iface' 2020-07-27 15:30:09 -07:00
Kelly Brazil
5d5da8d33f more fixes for ipv6 fix 2020-07-27 15:27:11 -07:00
Kelly Brazil
e604571578 fix next_hop fix 2020-07-27 15:20:51 -07:00
Kelly Brazil
f9dacc3f95 fixup for ipv6 2020-07-27 15:18:13 -07:00
Kelly Brazil
6086920332 update ParseError message 2020-07-27 15:13:32 -07:00
Kelly Brazil
f52f3163bc add tracepath example 2020-07-27 13:57:58 -07:00
Kelly Brazil
d18ff73e88 update author info 2020-07-27 13:51:51 -07:00
Kelly Brazil
1e5d602cae working tracepath parser 2020-07-27 13:48:46 -07:00
Kelly Brazil
12912521ec doc update 2020-07-27 11:04:27 -07:00
Kelly Brazil
842ea3a94b add tracepath parser skeleton 2020-07-27 11:02:13 -07:00
Kelly Brazil
a8560dbc15 add tracepath 2020-07-27 11:01:57 -07:00
Kelly Brazil
a65e27540a update docs 2020-07-27 11:01:45 -07:00
Kelly Brazil
c3c5ed11e6 change name from tr to trparse 2020-07-27 10:33:40 -07:00
Kelly Brazil
ce24149335 formatting 2020-07-27 10:33:25 -07:00
Kelly Brazil
0314ca8c48 add trparse acknowledgement 2020-07-27 10:33:15 -07:00
Kelly Brazil
ebd8ee49a9 add key/value info to ini example 2020-07-27 10:28:15 -07:00
Kelly Brazil
38d10c9781 add ping and traceroute examples 2020-07-27 09:29:30 -07:00
Kelly Brazil
360106c24d add tracepath 2020-07-27 09:23:01 -07:00
Kelly Brazil
ca470a5d02 add tracepath fixtures 2020-07-27 09:20:00 -07:00
Kelly Brazil
57f66e6b1d add exception with hint to use "uname -a" 2020-07-27 09:19:48 -07:00
Kelly Brazil
e774f67924 turn off interpolation and coerce None to '' 2020-07-24 16:53:17 -07:00
Kelly Brazil
ac10e576c1 spelling 2020-07-24 16:29:27 -07:00
Kelly Brazil
bcae0a99cd add key/value to ini description 2020-07-24 16:23:45 -07:00
Kelly Brazil
c73c2ff879 add ping, traceroute, and ini update 2020-07-24 16:23:30 -07:00
Kelly Brazil
c39b1a3356 add ping, traceroute and update ini description 2020-07-24 16:17:51 -07:00
Kelly Brazil
125dc2d9e0 add info about key/value files to doc 2020-07-24 16:17:16 -07:00
Kelly Brazil
b7d4ddc7ce add tests for key/value files 2020-07-24 16:16:54 -07:00
Kelly Brazil
f5e546c6fa add support for simple key/value pairs 2020-07-24 16:16:24 -07:00
Kelly Brazil
928e39cd10 add generic traceroute tests 2020-07-24 14:16:41 -07:00
Kelly Brazil
d0b7ea68a0 check for key in dictionary 2020-07-24 13:47:47 -07:00
Kelly Brazil
8444690133 add traceroute 2020-07-24 13:47:29 -07:00
Kelly Brazil
c03c42d767 add traceroute tests 2020-07-24 13:47:23 -07:00
Kelly Brazil
ab67688a00 add test skeleton 2020-07-23 16:45:09 -07:00
Kelly Brazil
5dcb7166da add traceroute doc 2020-07-23 16:44:57 -07:00
Kelly Brazil
14697b86d7 add MIT license 2020-07-23 15:48:08 -07:00
Kelly Brazil
4f4b6276d4 update docstring 2020-07-23 15:46:22 -07:00
Kelly Brazil
7bc497e129 updated process() function to set integers and floats 2020-07-23 15:42:33 -07:00
Kelly Brazil
68a37a6a5a remove unused function load() 2020-07-23 12:48:33 -07:00
Kelly Brazil
6f5cd1d7c5 change to use f-string 2020-07-23 12:03:21 -07:00
Kelly Brazil
126b1b121c add traceroute6 example 2020-07-23 11:31:56 -07:00
Kelly Brazil
2341e456a0 use ParseError instead of generic Exception 2020-07-23 11:31:35 -07:00
Kelly Brazil
72d80e95bb remove unused regex patterns 2020-07-23 10:52:40 -07:00
Kelly Brazil
f5ec82440c simplify regex patterns 2020-07-23 10:19:56 -07:00
Kelly Brazil
c8e526ead3 fixes for bsd-style ipv6 output 2020-07-22 17:23:24 -07:00
Kelly Brazil
066adfb764 handle warning lines in the traceroute output 2020-07-22 15:02:02 -07:00
Kelly Brazil
5b444d4717 add traceroute parser 2020-07-22 12:19:27 -07:00
Kelly Brazil
69c95adc8d add osx ipv6 ping dup test 2020-07-22 09:06:11 -07:00
Kelly Brazil
2b0e0d8f5c add ipv6 dup test 2020-07-21 17:34:30 -07:00
Kelly Brazil
778d1bacbf update docs to add "duplicates" fields 2020-07-21 15:16:39 -07:00
Kelly Brazil
7e1b041016 add duplicate replies tests 2020-07-21 15:12:43 -07:00
Kelly Brazil
313b9b329c update fixtures for added 'duplicate' fields 2020-07-21 15:05:54 -07:00
Kelly Brazil
6830062256 add support for duplicate replies 2020-07-21 14:47:25 -07:00
Kelly Brazil
323072c982 add source_ip to schema doc 2020-07-21 09:02:44 -07:00
Kelly Brazil
8719d96bdd change description 2020-07-20 16:54:43 -07:00
Kelly Brazil
dd5d318ab5 version bump and add ping command 2020-07-20 16:25:20 -07:00
Kelly Brazil
d6dc7f5e65 add osx ping tests 2020-07-20 16:11:18 -07:00
Kelly Brazil
c203664eb5 freebsd ping tests 2020-07-20 15:46:27 -07:00
Kelly Brazil
19ecf1fa19 add Fedora32 tests 2020-07-20 14:35:41 -07:00
Kelly Brazil
b8deb0426c add ubuntu ping tests 2020-07-20 13:51:39 -07:00
Kelly Brazil
3b8371f020 add centos ping tests 2020-07-20 12:49:05 -07:00
Kelly Brazil
20bb1cdf39 add TypeError to except for None values 2020-07-20 11:53:06 -07:00
Kelly Brazil
301daa48d0 update documentation 2020-07-19 15:30:54 -07:00
Kelly Brazil
8421ec8803 remove cygwin compatibility 2020-07-19 15:19:47 -07:00
Kelly Brazil
74211eb012 add examples 2020-07-19 15:16:04 -07:00
Kelly Brazil
60bd42f298 add process() logic 2020-07-19 15:13:52 -07:00
Kelly Brazil
14bdd74526 add ping test fixtures 2020-07-19 14:46:02 -07:00
Kelly Brazil
fb0f3eda04 add ping commands 2020-07-19 14:45:50 -07:00
Kelly Brazil
91ee6e6701 add osx ping test fixtures 2020-07-19 14:18:56 -07:00
Kelly Brazil
51f4e6927c add support for pattern in osx/bsd 2020-07-19 14:18:40 -07:00
Kelly Brazil
94988d8667 add fedora ping fixtures 2020-07-19 13:50:40 -07:00
Kelly Brazil
fe36f5a98c add fixtures for ping 2020-07-19 12:56:53 -07:00
Kelly Brazil
f9eb18b927 change 'request_timeout' field to 'type', fix compatibility, other formatting fixes 2020-07-19 12:56:34 -07:00
Kelly Brazil
cc60f36748 add ping parser 2020-07-18 12:35:46 -07:00
Kelly Brazil
604ade791f add ping parser 2020-07-17 15:57:07 -07:00
Kelly Brazil
690ac52a91 add man page 2020-07-13 07:18:48 -07:00
Kelly Brazil
34ed772775 version bump 2020-07-11 09:46:47 -07:00
Kelly Brazil
d5ab95571f fix tests when using older versions of pygments 2020-07-11 09:44:08 -07:00
Kelly Brazil
ffb3a0ee5f Merge pull request #73 from kellyjonbrazil/dev
Dev v1.12.0
2020-07-10 16:34:56 -07:00
Kelly Brazil
94b12b57aa spelling 2020-07-10 16:30:08 -07:00
Kelly Brazil
6d149e8457 version bump 2020-07-10 16:25:03 -07:00
Kelly Brazil
1ad89c90d8 add pacman 2020-07-10 15:58:02 -07:00
Kelly Brazil
fb71c7b020 function name spelling 2020-07-10 15:49:35 -07:00
Kelly Brazil
28ed17ad3b add parser_count test to test_cli_about_jc 2020-07-10 15:45:21 -07:00
Kelly Brazil
0c2a4e2bf7 add cli tests 2020-07-10 15:35:05 -07:00
Kelly Brazil
62bec30de2 add json_out tests 2020-07-10 14:44:50 -07:00
Kelly Brazil
3fced77e4e add set_env_colors tests 2020-07-10 12:23:48 -07:00
Kelly Brazil
a09d1d8b76 move environment variable assignment to main() to simplify tests 2020-07-10 12:23:25 -07:00
Kelly Brazil
8f4243fbd8 formatting 2020-07-10 10:54:34 -07:00
Kelly Brazil
47aaf20549 add sysctl command parser 2020-07-10 10:50:51 -07:00
Kelly Brazil
0c5289ea50 add sysctl tests 2020-07-10 10:47:23 -07:00
Kelly Brazil
3e53323514 don't filter out empty lines 2020-07-10 09:58:56 -07:00
Kelly Brazil
a5ee9861b9 update fixtures 2020-07-10 09:28:32 -07:00
Kelly Brazil
feb8ca7654 spelling 2020-07-10 09:28:20 -07:00
Kelly Brazil
a7abe4473b spelling 2020-07-10 09:03:04 -07:00
Kelly Brazil
780b9b61de specify IndexError exception in try/except block 2020-07-10 08:30:31 -07:00
Kelly Brazil
19ace36ffa add fixtures 2020-07-10 08:21:30 -07:00
Kelly Brazil
5fff8afc9f add fixes for freebsd where values can be on separate lines under the key 2020-07-10 08:21:15 -07:00
Kelly Brazil
4ad230c927 doc update and add test fixtures 2020-07-09 16:35:36 -07:00
Kelly Brazil
dd98eb1ec8 append duplicate key values to original key instead of adding unique keys 2020-07-09 16:25:41 -07:00
Kelly Brazil
c6baf42e72 doc updates 2020-07-09 16:18:33 -07:00
Kelly Brazil
e2bac97d56 fix for multiple identical keys in sysctl output 2020-07-09 14:51:15 -07:00
Kelly Brazil
d112ee94d0 use try/except and add support for floats in process() 2020-07-09 14:26:35 -07:00
Kelly Brazil
27b21b2faf formatting and docstring updates 2020-07-09 11:11:29 -07:00
Kelly Brazil
8c96d5cd20 reduce pygments version requirement 2020-07-09 10:59:36 -07:00
Kelly Brazil
c29ed3fd69 formatting of quotation marks and docstrings 2020-07-09 10:54:49 -07:00
Kelly Brazil
cedf603f12 minor formatting 2020-07-09 09:59:00 -07:00
Kelly Brazil
279161c36f Merge pull request #72 from duelafn/pygments-2.3
Support older pygments
2020-07-09 09:48:58 -07:00
Dean Serenevy
ce0b43d919 Remove dependency on 3rd party packaging library 2020-07-09 12:44:41 -04:00
Dean Serenevy
ddafa5bf06 Support older pygments 2020-07-09 11:39:34 -04:00
Kelly Brazil
bc7116c31b fix JC_COLORS env bug and simplify set_env_colors() 2020-07-09 08:30:10 -07:00
Kelly Brazil
53b7092721 remove side-effects from functions and print in main() 2020-07-08 16:40:28 -07:00
Kelly Brazil
beb9174b1b add sysctl parser 2020-07-08 15:42:06 -07:00
Kelly Brazil
aea41ed341 move verbose_debug enable earlier in code to catch more issues. add sysctl and version bump 2020-07-08 15:41:46 -07:00
Kelly Brazil
d789494cb1 change type check to use isinstance 2020-07-08 05:59:19 -07:00
Kelly Brazil
608e7b4cff add license info 2020-07-06 10:52:12 -07:00
Kelly Brazil
4ee199c02a use tracebackplus instead of cgitb since cgitb is depricated 2020-07-06 10:41:01 -07:00
Kelly Brazil
fbf47d4085 add arch linux 2020-07-01 13:28:58 -07:00
Kelly Brazil
5a238e4b42 remove updates-testing from fedora command 2020-07-01 09:11:32 -07:00
Kelly Brazil
f852b8246a wrap warning message 2020-06-30 11:50:37 -07:00
Kelly Brazil
88140d929a wrap error message in code 2020-06-30 11:37:33 -07:00
Kelly Brazil
45f7268240 add -dd to error message 2020-06-30 11:34:08 -07:00
Kelly Brazil
3a3c8e4d4a move verbose_debug under debug check 2020-06-30 11:31:08 -07:00
Kelly Brazil
c1ac183a04 simplify debug option 2020-06-30 11:26:09 -07:00
Kelly Brazil
18bb779ee5 formatting: double quotes to single quotes 2020-06-30 09:39:05 -07:00
Kelly Brazil
8b6612fe79 move JC_COLORS parsing error message 2020-06-30 07:56:34 -07:00
Kelly Brazil
fde0bc8534 improve package install info 2020-06-27 18:53:19 -07:00
Kelly Brazil
e661a78939 Merge pull request #71 from wigust/guix
add guix package info
2020-06-27 18:43:02 -07:00
Oleg Pykhalov
847e346602 add guix package info 2020-06-27 13:01:56 +03:00
Kelly Brazil
b969751688 add other references 2020-06-26 09:53:57 -07:00
Kelly Brazil
ad6f2ba03a formatting 2020-06-25 21:16:52 -07:00
Kelly Brazil
63c6a5edc0 formatting 2020-06-25 21:12:30 -07:00
Kelly Brazil
9f4cf9dd5e formatting 2020-06-25 21:11:21 -07:00
Kelly Brazil
51331b6dc0 formatting 2020-06-25 13:01:10 -07:00
Kelly Brazil
efb6761033 formatting 2020-06-25 12:59:56 -07:00
Kelly Brazil
6a4f737a0f update json syntax highlighting 2020-06-25 12:56:06 -07:00
Kelly Brazil
be6864b778 add syntax highlighting tags 2020-06-25 12:28:23 -07:00
Kelly Brazil
de3b91a36c add -dd option 2020-06-25 07:38:39 -07:00
Kelly Brazil
ef5482c3b5 add verbose debug option 2020-06-25 07:29:28 -07:00
Kelly Brazil
d20b795137 Merge pull request #70 from kellyjonbrazil/dev
Dev v1.11.7
2020-06-22 11:28:23 -07:00
Kelly Brazil
8a134065df update fixtures for last chain fix 2020-06-22 11:23:37 -07:00
Kelly Brazil
22aee1bfa4 version bump 2020-06-22 11:23:15 -07:00
Kelly Brazil
b282820fd6 fix to include the final chain in output 2020-06-22 11:09:09 -07:00
Kelly Brazil
3ee098306d version bump 2020-06-22 10:48:51 -07:00
Kelly Brazil
09e8f379a6 iptables code optimizations 2020-06-22 10:47:34 -07:00
Kelly Brazil
69018cdb3a fix date 2020-06-14 17:39:14 -07:00
Kelly Brazil
d0d7254c6a add docstring 2020-06-14 17:23:10 -07:00
Kelly Brazil
cc0f0971d7 Improve and standardize empty data check for all parsers 2020-06-14 17:17:40 -07:00
Kelly Brazil
2af61730f0 Merge pull request #68 from kellyjonbrazil/dev
Dev v1.11.5
2020-06-12 12:34:34 -07:00
Kelly Brazil
83f41b83dc version bump 2020-06-12 12:30:19 -07:00
Kelly Brazil
1fb84fce88 fix for no data 2020-06-12 12:25:07 -07:00
Kelly Brazil
a8837e1244 remove --upgrade from pip install 2020-06-12 07:57:40 -07:00
Kelly Brazil
04d2eec558 fix for no data 2020-06-11 17:59:06 -07:00
Kelly Brazil
1b57ec92f0 fix for no data 2020-06-11 17:52:03 -07:00
Kelly Brazil
4d88595404 enhance empty data check 2020-06-11 17:16:11 -07:00
Kelly Brazil
52b1272a3a enhance empty data check 2020-06-11 17:13:45 -07:00
Kelly Brazil
d2ccad6a83 fix for no data 2020-06-11 17:09:51 -07:00
Kelly Brazil
cad6dde4ac fix for no data 2020-06-10 17:54:06 -07:00
Kelly Brazil
06811c3539 add test for no data 2020-06-10 17:41:54 -07:00
Kelly Brazil
0cb23c2b21 add fix for no data 2020-06-10 17:40:18 -07:00
Kelly Brazil
ac4688dca2 add test for no data 2020-06-10 17:35:40 -07:00
Kelly Brazil
326c3b4670 add test for no data 2020-06-10 17:34:22 -07:00
Kelly Brazil
9b29d0c268 add test for no data 2020-06-10 17:32:39 -07:00
Kelly Brazil
e0013c3871 add test for no data 2020-06-10 17:31:14 -07:00
Kelly Brazil
a75744075b add no data test 2020-06-10 17:29:41 -07:00
Kelly Brazil
525aec1a02 fix for no data 2020-06-10 17:27:46 -07:00
Kelly Brazil
0bf9a7a072 add test for no data 2020-06-10 17:22:59 -07:00
Kelly Brazil
d8f2f4c95b fix for no data 2020-06-10 17:20:09 -07:00
Kelly Brazil
35d733b44f fix for no data 2020-06-10 17:10:53 -07:00
Kelly Brazil
9179b4175c add nodata tests 2020-06-10 16:40:11 -07:00
Kelly Brazil
bb07d78c78 add nodata fix 2020-06-10 16:39:49 -07:00
Kelly Brazil
07b179cd7f Merge pull request #67 from kellyjonbrazil/Dev
Dev v1.11.4
2020-06-10 06:07:42 -07:00
Kelly Brazil
054422d837 add test for empty directory 2020-06-10 06:04:50 -07:00
Kelly Brazil
3e052d1810 version bump 2020-06-10 05:53:20 -07:00
Kelly Brazil
c8e72805cf fix error on empty directory 2020-06-10 05:51:12 -07:00
Kelly Brazil
12a80e7db0 add fedora package info 2020-06-09 15:13:53 -07:00
Kelly Brazil
ee7ff9a09d Merge pull request #66 from kellyjonbrazil/dev
Dev v1.11.3
2020-06-09 11:22:39 -07:00
Kelly Brazil
f6478fb636 version bump 2020-06-09 11:18:47 -07:00
Kelly Brazil
811a0b0495 add info regarding the local parser plugin files 2020-06-08 10:54:42 -07:00
Kelly Brazil
aeb48edf72 use $LOCALAPPDATA variable for windows 2020-06-08 10:48:58 -07:00
Kelly Brazil
b1e94f0df7 heading formatting 2020-06-08 10:44:09 -07:00
Kelly Brazil
60050e3c0f fix linux/unix directory and add note about the XDG specification followed 2020-06-08 10:42:45 -07:00
Kelly Brazil
39ef09aa5b add local parser plugin feature 2020-06-07 13:30:22 -07:00
Kelly Brazil
8377d43116 formatting 2020-06-07 13:26:03 -07:00
Kelly Brazil
54e4c447ab clean up formatting 2020-06-07 12:52:16 -07:00
Kelly Brazil
937a9fa9cf vendorize appdirs module 2020-06-07 12:41:50 -07:00
Kelly Brazil
808ff6cf0e more acknowledgments updates 2020-06-07 12:29:10 -07:00
Kelly Brazil
7f5c649a95 update acknowledgments 2020-06-07 12:23:28 -07:00
Kelly Brazil
b72727dec9 update custom parsers info 2020-06-07 12:13:40 -07:00
Kelly Brazil
3fc88bfb33 Merge pull request #65 from duelafn/local-parsers
Load custom parsers from <user_data_dir>/jc/jcparsers
2020-06-07 12:04:44 -07:00
Dean Serenevy
9f2279d586 Load custom parsers from <user_data_dir>/jc/jcparsers 2020-06-06 14:42:27 -04:00
Kelly Brazil
346a14cb9b change osx_device to unix_device 2020-05-30 20:44:14 -07:00
Kelly Brazil
dac00d17ff add nixos test 2020-05-30 20:33:50 -07:00
Kelly Brazil
9ca7cd4060 update docs 2020-05-30 20:33:39 -07:00
Kelly Brazil
aa31628970 update docs 2020-05-30 20:33:00 -07:00
Kelly Brazil
bed694fcf5 version bump 2020-05-30 20:13:21 -07:00
Kelly Brazil
4b4af69fa1 fix date 2020-05-30 20:12:51 -07:00
Kelly Brazil
9d96190a5b Merge pull request #64 from kellyjonbrazil/dev
Dev v1.11.2
2020-05-30 20:08:32 -07:00
Kelly Brazil
fa44d48c09 freebsd fixes, tests, and fixtures 2020-05-30 19:50:38 -07:00
Kelly Brazil
4ef961c278 add freebsd test and fixtures 2020-05-30 19:18:01 -07:00
Kelly Brazil
292a837d5c add tests and fixtures for freebsd12 2020-05-30 18:54:09 -07:00
Kelly Brazil
aa7b915d84 version bump 2020-05-30 18:53:46 -07:00
Kelly Brazil
c46fe73236 add last fixes for freebsd 2020-05-30 18:53:35 -07:00
Kelly Brazil
039b2c129c freebsd fixes 2020-05-30 18:42:26 -07:00
Kelly Brazil
8f2e5e4808 fix compatible logic 2020-05-30 17:46:09 -07:00
Kelly Brazil
c4da8e4f78 add nixos and freebsd to tested. update new arp fields 2020-05-30 17:05:41 -07:00
Kelly Brazil
bcab9078a4 add w parser fix 2020-05-30 17:02:09 -07:00
Kelly Brazil
b3c6c1ea92 strip whitespace in string fields and add tests 2020-05-30 17:01:59 -07:00
Kelly Brazil
a3af8662bd add permanent field 2020-05-30 16:26:07 -07:00
Kelly Brazil
35940d0bc8 add freebsd permanent and expires fields 2020-05-30 16:25:53 -07:00
Kelly Brazil
26994cdcb7 add freebsd compatibility info 2020-05-30 15:51:54 -07:00
Kelly Brazil
017159a829 add freebsd nestat tests and fixtures 2020-05-30 15:51:06 -07:00
Kelly Brazil
b4e9c85e08 fixup -T freebsd output and add whitespace stripping to parse_post 2020-05-30 15:50:45 -07:00
Kelly Brazil
189146cd84 add more ints. remove whitespace strip code and move to freebsd_osx module 2020-05-30 15:50:07 -07:00
Kelly Brazil
af34153ffa version bump 2020-05-30 15:48:56 -07:00
Kelly Brazil
bf2ff3ffbb fix compatibility search for platform names that append the version number (e.g. freebsd12) 2020-05-30 15:48:29 -07:00
Kelly Brazil
6423c9efd6 integer and float updates 2020-05-29 15:48:51 -07:00
Kelly Brazil
58ab0d4ece strip whitespace from string fields 2020-05-29 15:14:44 -07:00
Kelly Brazil
83a738bf4d update fixtures for osx_flags and osx_inode name change to unix_flags and unix_inode 2020-05-29 14:16:11 -07:00
Kelly Brazil
3640671fc6 rename module 2020-05-29 14:15:28 -07:00
Kelly Brazil
1da623b30e add items 2020-05-29 14:14:48 -07:00
Kelly Brazil
b10ca64646 change osx_inode and osx_flags to unix_inode and unix_flags. Also rename netstat_osx module to netstat_freebsd_osx 2020-05-29 14:14:37 -07:00
Kelly Brazil
2128763ee6 fix osx version from 16.4 to 14.6 2020-05-29 13:25:19 -07:00
Kelly Brazil
a27e7ed39c test updates for added route_flags_pretty and flags_pretty fields 2020-05-29 13:24:52 -07:00
Kelly Brazil
f07b7eaa47 add flags_pretty 2020-05-29 12:55:16 -07:00
Kelly Brazil
6ce18de84c add route_flags_pretty 2020-05-29 12:51:04 -07:00
Kelly Brazil
8631b756e7 add freebsd test files 2020-05-29 12:05:46 -07:00
Kelly Brazil
7414d98412 add freebsd compatibility 2020-05-29 12:05:34 -07:00
Kelly Brazil
d7b19892e8 add freebsd support for netstat -i 2020-05-29 12:04:58 -07:00
Kelly Brazil
96df396eaf formatting 2020-05-29 07:35:25 -07:00
Kelly Brazil
2f6f640317 spelling 2020-05-27 17:11:20 -07:00
Kelly Brazil
c4a0a50f3a add nix-env 2020-05-27 17:08:54 -07:00
Kelly Brazil
658f8a3842 add zypper and ports info 2020-05-27 14:58:16 -07:00
Kelly Brazil
bfb876a1e3 formatting 2020-05-27 09:52:13 -07:00
Kelly Brazil
90c34b1f4e fix dmidecode example 2020-05-26 17:31:56 -07:00
Kelly Brazil
3f9164ea77 bold formatting 2020-05-23 21:11:17 -07:00
Kelly Brazil
7fd6fecbf5 formatting 2020-05-23 21:09:49 -07:00
Kelly Brazil
8029f72363 change osx_flags from integer to string 2020-05-23 21:09:40 -07:00
Kelly Brazil
c7fdce5d3b Merge pull request #62 from kellyjonbrazil/dev
Dev v1.11.0
2020-05-22 16:37:50 -07:00
Kelly Brazil
84f48aa369 version bump 2020-05-22 16:30:22 -07:00
Kelly Brazil
2e9a0a9c12 add features 2020-05-22 16:21:55 -07:00
Kelly Brazil
c1f6f2b950 osx fixes and tests 2020-05-22 16:21:40 -07:00
Kelly Brazil
ede21bca13 add OSX support for stat 2020-05-22 16:05:04 -07:00
Kelly Brazil
8dd9a9f9cb add netstat -i tests 2020-05-22 15:12:10 -07:00
Kelly Brazil
04f92cd133 add linux support for netstat -i 2020-05-22 14:04:11 -07:00
Kelly Brazil
8be8d2393b add netstat -i support for OSX 2020-05-22 13:38:25 -07:00
Kelly Brazil
0a879681be add netstat -r to docs 2020-05-22 12:56:27 -07:00
Kelly Brazil
2ca1587a49 add linux netstat -r tests 2020-05-22 12:44:51 -07:00
Kelly Brazil
ec2cd2d708 add netstat -r support for linux 2020-05-22 12:00:26 -07:00
Kelly Brazil
5d0dbece93 add netstat -r functionality for OSX 2020-05-22 11:09:41 -07:00
Kelly Brazil
df1e4b414b remove unused folder 2020-05-22 08:00:18 -07:00
Kelly Brazil
40760991e7 update copyright date 2020-05-22 07:51:47 -07:00
Kelly Brazil
464f5f86cf update description 2020-05-22 07:50:22 -07:00
Kelly Brazil
7b09e9fccd set empty values to Null and update fixtures 2020-05-21 17:01:17 -07:00
Kelly Brazil
6cba7d4298 remove linux from description 2020-05-21 11:10:00 -07:00
Kelly Brazil
9730f62e49 fixup name field and update test fixtures 2020-05-21 09:44:28 -07:00
Kelly Brazil
e0c1c87f54 formatting 2020-05-21 09:07:01 -07:00
Kelly Brazil
931b3d2b83 formatting 2020-05-20 19:56:28 -07:00
Kelly Brazil
e5d561baee add multipath condition for osx detection 2020-05-20 17:31:51 -07:00
Kelly Brazil
2867593e7a changelog update 2020-05-20 17:28:44 -07:00
Kelly Brazil
dd52fee563 osx netstat tests and fixtures 2020-05-20 17:25:25 -07:00
Kelly Brazil
8e1f885827 fix filtered netstat views 2020-05-20 16:43:53 -07:00
Kelly Brazil
2d39a58f90 doc update 2020-05-20 16:14:03 -07:00
Kelly Brazil
9c4fa2ae26 integer conversions and icmp fix 2020-05-20 15:39:47 -07:00
Kelly Brazil
de52d84e82 fix udp state and udp46 entries 2020-05-20 12:02:32 -07:00
Kelly Brazil
ce9b55059a organize files 2020-05-20 11:24:38 -07:00
Kelly Brazil
bcd370a6a0 code cleanup 2020-05-20 08:19:45 -07:00
Kelly Brazil
c8216850ab code cleanup 2020-05-20 07:19:24 -07:00
Kelly Brazil
f5feedb90b fix comments 2020-05-19 17:38:14 -07:00
Kelly Brazil
a4371cd187 support netstat -A 2020-05-19 17:36:16 -07:00
Kelly Brazil
9d5ba4c834 formatting 2020-05-19 17:14:04 -07:00
Kelly Brazil
1639dee1bb fix parse_post 2020-05-19 17:13:03 -07:00
Kelly Brazil
9363f430f2 use list extend method to simplify code 2020-05-19 16:26:41 -07:00
Kelly Brazil
9192a09073 parse all sections 2020-05-19 16:26:04 -07:00
Kelly Brazil
b915eb9755 initial osx parser 2020-05-19 15:15:08 -07:00
Kelly Brazil
1cfcc2b592 tighten up line test logic when counting tabs 2020-05-14 09:58:16 -07:00
Kelly Brazil
7138dd02b7 cleanup variables after adding to item 2020-05-14 09:51:10 -07:00
Kelly Brazil
b4276643b7 add dmidecode tests and fixtures 2020-05-14 09:43:13 -07:00
Kelly Brazil
2ef00763bf fix first item 2020-05-14 09:33:45 -07:00
Kelly Brazil
54364928fc fix oddities like hybrid single/multiline data and items containing multiple records 2020-05-14 08:57:23 -07:00
Kelly Brazil
09b3b4932b add dmidecode output fixtures 2020-05-13 10:51:38 -07:00
Kelly Brazil
29d6670119 convert integers 2020-05-13 10:18:49 -07:00
Kelly Brazil
2f654b5f1a doc update 2020-05-13 10:13:27 -07:00
Kelly Brazil
e53b9f5992 add caveats to documentation 2020-05-13 10:12:40 -07:00
Kelly Brazil
addb234e61 add dmidecode doc 2020-05-13 09:44:20 -07:00
Kelly Brazil
76eca3b659 add dmidecode 2020-05-13 09:43:35 -07:00
Kelly Brazil
f90dec4c0e add examples to documentation 2020-05-13 09:43:23 -07:00
Kelly Brazil
8900a59d4c simplify logic by removing redundant block 2020-05-13 09:31:12 -07:00
Kelly Brazil
6685138200 fix for missing multi-line values that come immediately after a previous multi-line value 2020-05-13 09:25:02 -07:00
Kelly Brazil
4d3e65b980 fix missing values 2020-05-13 09:00:32 -07:00
Kelly Brazil
e9282bb546 add dmidecode parser 2020-05-13 08:22:52 -07:00
Kelly Brazil
f5627a4594 version bump 2020-05-11 11:03:02 -07:00
Kelly Brazil
81ffdb2510 remove shebang for Fedora packaging 2020-05-11 10:54:26 -07:00
Kelly Brazil
4c00a99850 version bump 2020-05-11 10:37:14 -07:00
Kelly Brazil
2bfcb45b28 make cli.py executable 2020-05-11 10:32:42 -07:00
Kelly Brazil
ab0c10e791 remove execute permissions 2020-05-11 10:27:16 -07:00
Kelly Brazil
2c1935115d Merge pull request #61 from kellyjonbrazil/dev
Dev v1.10.10
2020-05-09 11:47:05 -07:00
Kelly Brazil
d98e43dc78 add netstat item 2020-05-09 11:42:56 -07:00
Kelly Brazil
9348988d64 add netstat test for Fedora32 2020-05-09 11:41:30 -07:00
Kelly Brazil
1285c66467 netstat with bluetooth section 2020-05-09 11:36:23 -07:00
Kelly Brazil
b7191bbc13 handle bluetooth section (ignore for now) 2020-05-09 11:36:03 -07:00
Kelly Brazil
98b97509f7 version bump 2020-05-09 11:25:13 -07:00
Kelly Brazil
2b2b570490 add tests for 'gone - no logout' 2020-05-09 11:22:26 -07:00
Kelly Brazil
cce2d1ff29 add condition for 'gone - no logout' 2020-05-09 11:22:01 -07:00
Kelly Brazil
b79600c572 version bump 2020-05-09 11:01:48 -07:00
Kelly Brazil
140f1a8543 test fixes for issue #60 2020-05-09 11:00:04 -07:00
Kelly Brazil
e34657cfde fix issue #60 that was skipping the first file in some instances using -R without -l 2020-05-08 15:26:11 -07:00
Kelly Brazil
99070fa607 version bump 2020-05-08 10:51:13 -07:00
Kelly Brazil
2b46785b1f add MIT license to vendorized IfconfigParser class 2020-05-08 10:49:30 -07:00
Kelly Brazil
c72562524b fully remove tests from packaging 2020-05-08 09:30:31 -07:00
Kelly Brazil
b7dd6441c7 version bump 2020-05-08 08:20:33 -07:00
Kelly Brazil
31fcc2f755 remove manifest.in - no longer needed due to removing tests 2020-05-08 08:20:21 -07:00
Kelly Brazil
b391aa14bc add license_file to metadata 2020-05-08 08:19:51 -07:00
Kelly Brazil
d3c45debbb remove tests and add license file 2020-05-08 08:19:31 -07:00
Kelly Brazil
5b08469b87 Merge pull request #57 from kellyjonbrazil/dev
Dev v1.10.7
2020-05-01 15:55:50 -07:00
Kelly Brazil
4a77ec63a4 add IfconfigParser class 2020-05-01 14:57:50 -07:00
Kelly Brazil
d13606b6dc modify dependencies for easier packaging into Fedora 2020-05-01 14:37:23 -07:00
Kelly Brazil
05291c93bb vendorize ifconfig-parser module for easier packaging in Fedora 2020-05-01 14:36:54 -07:00
Kelly Brazil
8cf00a208e change text to strings 2020-04-29 15:57:55 -07:00
Kelly Brazil
06d73c8876 formatting 2020-04-23 07:06:44 -07:00
Kelly Brazil
649c646ea2 add brew install option 2020-04-22 16:08:34 -07:00
Kelly Brazil
b7756d9250 version bump 2020-04-20 16:33:26 -07:00
Kelly Brazil
1cd2cd954c remove references to homebrew/shim to allow tests to pass in homebrew packaging ci/cd 2020-04-20 16:31:22 -07:00
Kelly Brazil
72020b8da9 move packages info to jc-packages github page 2020-04-17 10:20:25 -07:00
Kelly Brazil
cf9720b749 update install info 2020-04-16 14:03:31 -07:00
Kelly Brazil
967b9db7f9 spelling 2020-04-15 21:27:22 -07:00
Kelly Brazil
bb3acb1182 formatting 2020-04-15 21:25:06 -07:00
Kelly Brazil
560c7f7e6d formatting 2020-04-15 21:23:55 -07:00
Kelly Brazil
79b2841764 add new binary package install info 2020-04-15 21:22:43 -07:00
Kelly Brazil
a06a89cbd1 version bump 2020-04-14 11:15:24 -07:00
Kelly Brazil
431bd969eb use sys.exit(0) instead of exit() 2020-04-14 11:10:31 -07:00
Kelly Brazil
c87b722aec spelling 2020-04-12 13:23:58 -07:00
Kelly Brazil
3688b8b014 Merge pull request #56 from kellyjonbrazil/dev
Dev v1.10.4
2020-04-12 13:21:38 -07:00
Kelly Brazil
07b8d9e0c0 version bump 2020-04-12 13:18:28 -07:00
Kelly Brazil
7454b53e39 formatting 2020-04-12 13:13:28 -07:00
Kelly Brazil
3d6a76024d update with JC_COLORS info 2020-04-12 13:10:57 -07:00
Kelly Brazil
421b980957 JC_COLORS working 2020-04-12 13:03:09 -07:00
Kelly Brazil
4a22e27d6a add set_env_colors function 2020-04-12 12:43:51 -07:00
Kelly Brazil
99f7842dee fix brek on pipe error 2020-04-09 13:38:33 -07:00
Kelly Brazil
7f869b4b18 change colors to ansi and match jello style 2020-04-09 07:31:21 -07:00
Kelly Brazil
9665f4ee84 add pypi badge 2020-04-07 08:44:15 -07:00
Kelly Brazil
606904d48b Merge pull request #53 from kellyjonbrazil/dev
Dev v1.10.1
2020-04-04 17:28:21 -07:00
Kelly Brazil
3f5279b97c version bump to 1.10.1 2020-04-04 17:25:55 -07:00
Kelly Brazil
f5ec21e6ac use in instead of find() 2020-04-04 17:19:32 -07:00
Kelly Brazil
578a284465 use in instead of find() 2020-04-04 17:18:39 -07:00
Kelly Brazil
422e392d9d use in instead of find() 2020-04-04 17:17:43 -07:00
Kelly Brazil
54dfffd34a use in instead of find() 2020-04-04 17:16:25 -07:00
Kelly Brazil
cffba64d2b use in and startswith() instead of find() 2020-04-04 17:15:03 -07:00
Kelly Brazil
56a0c12a59 use in instead of find() 2020-04-04 17:12:22 -07:00
Kelly Brazil
c174d3de18 use in and startswith() instead of find() 2020-04-04 17:10:46 -07:00
Kelly Brazil
a9c59ef9fc fix logic to not for ' type ' in cleandata[0] 2020-04-04 17:07:38 -07:00
Kelly Brazil
abdb9b2673 use in instead of find() 2020-04-04 17:05:17 -07:00
Kelly Brazil
548aaab626 remove old commented code 2020-04-04 17:04:20 -07:00
Kelly Brazil
20571c87ae us in instead of find() 2020-04-04 17:01:56 -07:00
Kelly Brazil
19e49200de version bump 2020-04-04 16:59:48 -07:00
Kelly Brazil
d32f5c67a9 use startswith() instead of find() 2020-04-04 16:59:03 -07:00
Kelly Brazil
b83b626435 use startswith() instead of find() 2020-04-04 16:57:23 -07:00
Kelly Brazil
ab2c1b25ec use startswith() and in instead of find() 2020-04-04 16:56:11 -07:00
Kelly Brazil
f2d46313a4 use startswith() instead of find() 2020-04-04 16:53:55 -07:00
Kelly Brazil
87e4796a6c use in instead of .find() 2020-04-04 16:52:45 -07:00
Kelly Brazil
0014a5c2f4 us startswith() and in instead of .find() 2020-04-04 16:51:36 -07:00
Kelly Brazil
7af56e0dad use startswith() and in instead of find() 2020-04-04 16:50:05 -07:00
Kelly Brazil
a5ae6e3c01 use startswith() instead of find() 2020-04-04 16:48:16 -07:00
Kelly Brazil
fe1a0d1faf use in instead of .find() 2020-04-04 16:46:09 -07:00
Kelly Brazil
302f05cdda prettify style block 2020-04-03 14:50:20 -07:00
Kelly Brazil
c0044be7b0 rename color grey to gray 2020-04-03 14:48:19 -07:00
Kelly Brazil
0110078807 update badge 2020-04-03 14:47:08 -07:00
Kelly Brazil
42eacb45f8 rename to Tests 2020-04-03 14:45:04 -07:00
Kelly Brazil
a43e2e1991 add -m option info 2020-04-02 17:40:06 -07:00
Kelly Brazil
c8b721d4f6 version bump to 1.10.0 2020-04-02 17:35:35 -07:00
Kelly Brazil
d0bfddc3d9 add color and -m monochrome option 2020-04-02 17:29:25 -07:00
Kelly Brazil
6b925a16c8 add tests badge 2020-04-02 10:55:32 -07:00
Kelly Brazil
89ebd9fc22 add axfr info to schema 2020-03-27 07:31:08 -07:00
Kelly Brazil
6b4ba66231 Merge pull request #52 from kellyjonbrazil/dev
Dev v1.9.3
2020-03-26 17:15:13 -07:00
Kelly Brazil
5b697dc381 add more dig tests 2020-03-26 17:09:29 -07:00
Kelly Brazil
9ba73c95d1 add tests 2020-03-26 16:45:29 -07:00
Kelly Brazil
93aa390447 version bump to v1.9.3 2020-03-26 16:30:17 -07:00
Kelly Brazil
3cfb8945dd use startswith() instead of find 2020-03-26 16:29:59 -07:00
Kelly Brazil
cd8d38f2a1 add axfr support 2020-03-26 16:22:53 -07:00
Kelly Brazil
8ec8cd6294 Merge pull request #50 from kellyjonbrazil/dev
Dev v1.9.2
2020-03-12 17:09:04 -07:00
Kelly Brazil
c028113561 version bump to v1.9.2 2020-03-12 17:06:55 -07:00
Kelly Brazil
5f22e1c803 fix and test for osx arp entries without ifscope 2020-03-12 17:02:26 -07:00
Kelly Brazil
d3351787e5 change osx detection 2020-03-12 16:52:33 -07:00
Kelly Brazil
e5bea9ae3b version bump 2020-03-12 08:52:01 -07:00
Kelly Brazil
93c710abe9 Merge pull request #49 from kellyjonbrazil/dev
Dev v1.9.1
2020-03-12 08:23:10 -07:00
Kelly Brazil
c29e7cfe5c version bump to 1.9.1 2020-03-12 08:17:28 -07:00
Kelly Brazil
cb5c1ba00d add tests for fix to make the file parser splitting more robust 2020-03-11 17:04:48 -07:00
Kelly Brazil
9a012b94e1 make splitting more robust 2020-03-11 15:40:34 -07:00
Kelly Brazil
400f5a44ec Merge pull request #48 from kellyjonbrazil/dev
Dev v1.9.0
2020-03-11 13:37:22 -07:00
Kelly Brazil
a2ab5bab91 version bump to v1.9.0 2020-03-11 13:32:58 -07:00
Kelly Brazil
fc8ab27361 bugfix for misaligned columns and additional test for ntpq #31 2020-03-11 13:24:55 -07:00
Kelly Brazil
59f19d33a5 add file command tests for #41 2020-03-11 12:39:59 -07:00
Kelly Brazil
dfc9618115 add file parser for issue #41 2020-03-11 12:20:58 -07:00
Kelly Brazil
8e02e5c75a fix issue with getting options with some commands #47 2020-03-11 09:21:14 -07:00
Kelly Brazil
970493ab93 add magic commands 2020-03-11 06:22:54 -07:00
Kelly Brazil
64d78956eb update acknowledgment 2020-03-10 22:18:26 -07:00
Kelly Brazil
40c05346f4 re-adding optimizations from https://github.com/philippeitis 2020-03-10 22:16:40 -07:00
Kelly Brazil
e9b0bc1409 doc update 2020-03-10 22:03:54 -07:00
Kelly Brazil
798e6bb7d9 tests passing for airport -s. issue #46 2020-03-10 22:03:44 -07:00
Kelly Brazil
12a370deed add airport -s parser for issue #46 2020-03-10 21:51:02 -07:00
Kelly Brazil
553bfbe1a0 tests passing for airport -I. Issue #46 2020-03-10 21:02:17 -07:00
Kelly Brazil
52494321fc fixes and docs for airport parser issue #46 2020-03-10 20:55:07 -07:00
Kelly Brazil
c6c9e06496 added airport command parser 2020-03-10 20:35:52 -07:00
Kelly Brazil
e3a6c05a58 timedatectl fixes, tests, and fixtures for issue #42 2020-03-10 20:26:53 -07:00
Kelly Brazil
391d06f68d change selection_state to state 2020-03-10 20:16:41 -07:00
Kelly Brazil
99804ea06e added timedatectl status parser 2020-03-10 18:37:55 -07:00
Kelly Brazil
51935deb2a timedatectl test fixtures 2020-03-10 18:00:47 -07:00
Kelly Brazil
b24d0c3a47 ntpq docs 2020-03-10 18:00:26 -07:00
Kelly Brazil
762a886d6f add ntpq tests 2020-03-10 15:17:25 -07:00
Kelly Brazil
2c3e9ddfe4 add ntpq parser for issue #31 2020-03-10 14:18:55 -07:00
Kelly Brazil
c7cd2b63c8 delete unused test file 2020-03-09 11:46:17 -07:00
Kelly Brazil
f0528ea831 Merge pull request #45 from kellyjonbrazil/dev
Dev v1.8.1
2020-03-08 14:54:13 -07:00
Kelly Brazil
5bc5596f60 version bump to 1.8.1 2020-03-08 14:49:23 -07:00
Kelly Brazil
2c27ac46be add ls test fixtures 2020-03-08 14:43:51 -07:00
Kelly Brazil
caad840153 Merge pull request #44 from philippeitis/patch-5
Move core magic() logic into seperate function for testability, minor tweaks
2020-03-08 14:19:37 -07:00
philippeitis
65bd7e2904 Merge pull request #1 from kellyjonbrazil/pr/44
Merge changes
2020-03-08 14:10:35 -07:00
Kelly Brazil
c3d7d7db12 removed whitespace 2020-03-08 14:03:08 -07:00
Kelly Brazil
5605310362 added tests, removed os import, changed to 'assertEqual' 2020-03-08 14:02:54 -07:00
philippeitis
17b6efe82e Create basic tests for generate_magic_commands() 2020-03-08 13:35:01 -07:00
philippeitis
a032ae56ae Pass args to generate_magic_command() to allow testing. 2020-03-08 13:26:15 -07:00
philippeitis
eab2f4b056 Move core magic() logic into seperate function for testability, minor tweaks.
We only care about the command when testing magic() - by moving that out, we can easily test the command. I modified the code to return a boolean signalling that the command is valid, and the command itself to maintain the original functionality.

I also made some small tweaks (removed a list() call, fixed a possible bug with no arguments., moved magic_dict instantiation past the fast path checks to avoid making a dict if not needed.)
2020-03-08 13:20:38 -07:00
Kelly Brazil
aff86ae6c7 reimpliment magic() based on the dictionary approach suggested by philippeitis 2020-03-08 12:58:26 -07:00
Kelly Brazil
7ece9ddc1a version bump ls 2020-03-07 17:26:42 -08:00
Kelly Brazil
7cd048e839 changelog update 2020-03-07 17:25:10 -08:00
Kelly Brazil
1e22f610a3 fix for osx - doesn't print 'total xx' line if empty directory (issue #40) 2020-03-07 17:22:08 -08:00
Kelly Brazil
5249c972ae add to changelog 2020-03-06 12:09:20 -08:00
Kelly Brazil
fd45f856a0 import jc.utils instead of jc 2020-03-06 12:09:09 -08:00
Kelly Brazil
c8ab40cd33 ignore .github folder 2020-03-05 09:19:58 -08:00
Kelly Brazil
b2c872925b add utf-8 encoding for testing on Windows 2020-03-04 19:47:03 -08:00
Kelly Brazil
f48e229202 utf-8 open for windows tests 2020-03-04 19:40:32 -08:00
Kelly Brazil
799fec92c3 utf-8 for windows support 2020-03-04 19:33:45 -08:00
Kelly Brazil
87a41c2fca add utf-8 to open function 2020-03-04 19:30:30 -08:00
Kelly Brazil
7f85de0c46 add windows-latest 2020-03-04 19:28:21 -08:00
Kelly Brazil
13661b1993 Merge pull request #37 from philippeitis/continuous_integration
Enable Continuous Integration with GitHub Actions.
2020-03-04 16:54:26 -08:00
philippeitis
51d5c3892d Remove Windows tests, due to lack of support. 2020-03-04 16:21:06 -08:00
philippeitis
e4eab4641a Change line in blkid.py to trigger CI 2020-03-04 16:17:58 -08:00
philippeitis
9b148e0ba3 Add requirements.txt 2020-03-04 16:16:19 -08:00
philippeitis
de28932650 Consolidate dictionary into creation, trigger CI 2020-03-04 16:14:03 -08:00
Kelly Brazil
5f798d603e version bump and ack to philippeitis 2020-03-04 16:11:14 -08:00
Kelly Brazil
a0757b2dd3 optimize line parsing 2020-03-04 16:07:53 -08:00
philippeitis
498d51b4e8 Enable Continuous Integration with GitHub Actions.
This automatically runs unit tests on various operating systems and Python versions when Python files are modified to ensure that functionality remains correct.
2020-03-04 16:07:32 -08:00
Kelly Brazil
b06b6bae3f Merge pull request #36 from philippeitis/patch-3
Simplify process() in history.py, avoid list allocation in parse()
2020-03-04 16:04:05 -08:00
Kelly Brazil
b5eaff2137 Merge pull request #35 from kellyjonbrazil/revert-34-patch-3
Revert "Simplify process() in history.py, avoid list allocation in parse()"
2020-03-04 15:33:13 -08:00
Kelly Brazil
c01bcd3734 Revert "Simplify process() in history.py, avoid list allocation in parse()" 2020-03-04 15:32:23 -08:00
Kelly Brazil
d75c4068ca Merge pull request #34 from philippeitis/patch-3
Simplify process() in history.py, avoid list allocation in parse()
2020-03-04 15:31:55 -08:00
Kelly Brazil
6aa2d5a3d2 Merge pull request #33 from philippeitis/patch-2
Handle case where only options are passed.
2020-03-04 15:28:09 -08:00
philippeitis
065276805f Simplify process() in history.py, avoid list allocation in parse() 2020-03-04 13:35:31 -08:00
philippeitis
a63408c8cf Handle case where only options are passed. 2020-03-04 13:16:35 -08:00
Kelly Brazil
69576f6bfa minor sytax fixes 2020-03-04 12:03:40 -08:00
Kelly Brazil
19845624e2 Merge pull request #32 from philippeitis/patch-1
Simplify main(), magic() methods.
2020-03-04 11:59:29 -08:00
philippeitis
22ff2964e9 Simplify main(), magic() methods. 2020-03-04 10:33:42 -08:00
Kelly Brazil
d96b3a65a9 formatting 2020-03-04 08:30:52 -08:00
Kelly Brazil
4989445ef4 Merge pull request #30 from kellyjonbrazil/dev
Dev v1.8.0
2020-03-03 11:46:09 -08:00
Kelly Brazil
6770892acd add release notes link 2020-03-03 11:37:59 -08:00
Kelly Brazil
d4eba8740f release date 3/3 2020-03-03 11:08:52 -08:00
Kelly Brazil
9f60760560 add group and gshadow tests 2020-03-03 10:54:27 -08:00
Kelly Brazil
0a8f8ac934 add group and gshadow parsers 2020-03-03 09:55:43 -08:00
Kelly Brazil
6ae24c8244 add group and gshadow test fixtures 2020-03-03 09:55:17 -08:00
Kelly Brazil
d3679082a8 add group and gshadow parsers 2020-03-03 09:36:16 -08:00
Kelly Brazil
fb08b42dca change 'group_list' to 'members' 2020-03-03 09:32:56 -08:00
Kelly Brazil
4aeaa9f42a add /etc/gshadow parser 2020-03-03 09:32:25 -08:00
Kelly Brazil
5f5693da04 spelling fix 2020-03-03 09:07:28 -08:00
Kelly Brazil
5eb0f61727 add /etc/group file parser 2020-03-03 09:07:09 -08:00
Kelly Brazil
958e998991 formatting 2020-03-02 17:15:05 -08:00
Kelly Brazil
b78c1509f6 try/except dialect detection 2020-03-02 15:06:25 -08:00
Kelly Brazil
ce184d4d57 add csv parser tests 2020-03-02 15:05:56 -08:00
Kelly Brazil
b4c3714ced removed [OPTIONS] PARSER syntax. still works but prefer the PARSER [OPTIONS] syntax for better performance 2020-03-02 14:10:15 -08:00
Kelly Brazil
5b7dfa0438 formatting 2020-03-02 14:07:56 -08:00
Kelly Brazil
391a388476 doc update 2020-03-02 14:07:29 -08:00
Kelly Brazil
d9c4e2ed4c add csv file parser 2020-03-02 14:03:58 -08:00
Kelly Brazil
0c42db38b1 doc update 2020-03-02 10:30:12 -08:00
Kelly Brazil
2f9be8bf33 simplify usage 2020-03-02 08:32:42 -08:00
Kelly Brazil
e8c00155e8 add -b to warning message 2020-03-02 07:43:45 -08:00
Kelly Brazil
cc88fdd9ee update example 2020-03-01 21:17:50 -08:00
Kelly Brazil
d9de11ef1d add another who example 2020-03-01 21:16:57 -08:00
Kelly Brazil
0ceda97d09 who parser tests 2020-03-01 19:03:27 -08:00
Kelly Brazil
d0dec92ba8 add who test fixtures 2020-03-01 18:57:51 -08:00
Kelly Brazil
d420c008d8 fix for pts lines with no user info 2020-03-01 17:52:14 -08:00
Kelly Brazil
f0b32db433 who doc update 2020-03-01 17:39:02 -08:00
Kelly Brazil
bc838eda59 fix output for non-extended 2020-03-01 17:38:51 -08:00
Kelly Brazil
afe55b6af0 add who parser 2020-03-01 17:07:28 -08:00
Kelly Brazil
dd3a3ac302 doc update and process pid integers 2020-03-01 17:04:06 -08:00
Kelly Brazil
f9982a7947 fixes for from and comment fields 2020-03-01 16:49:52 -08:00
Kelly Brazil
07c1be9e9a add who command parser 2020-03-01 16:30:04 -08:00
Kelly Brazil
f832b88755 add passwd and shadow tests 2020-03-01 10:17:47 -08:00
Kelly Brazil
0fac757efc add passwd and shadow parsers 2020-02-29 12:25:41 -08:00
Kelly Brazil
fc15742065 passwd and shadow test fixtures 2020-02-29 12:25:22 -08:00
Kelly Brazil
6f2466a131 update readme with /etc/passwd and /etc/shadow file parsers 2020-02-29 11:56:12 -08:00
Kelly Brazil
4b90e22f0a doc update 2020-02-29 11:50:46 -08:00
Kelly Brazil
c493568785 doc fix 2020-02-29 11:46:38 -08:00
Kelly Brazil
1cdf004b77 add /etc/shadow parser 2020-02-29 11:46:24 -08:00
Kelly Brazil
a4ea504261 add /etc/passwd parser 2020-02-29 11:33:14 -08:00
Kelly Brazil
4c2c234c3b add last and lastb tests 2020-02-28 15:15:24 -08:00
Kelly Brazil
3d4c0f3e89 add blkid tests 2020-02-28 14:50:29 -08:00
Kelly Brazil
52fad02903 doc update 2020-02-28 13:31:38 -08:00
Kelly Brazil
9dcabc057c support multi device udev output 2020-02-28 10:57:14 -08:00
Kelly Brazil
db8c1079dd use maxsplit=1 in case there are multiple '=' delimiters 2020-02-28 09:54:07 -08:00
Kelly Brazil
8f954673ab use shlex split for values within quotations that have spaces 2020-02-28 09:07:36 -08:00
Kelly Brazil
79522d1c7d doc fixes 2020-02-28 08:51:48 -08:00
Kelly Brazil
a18bf03079 use raw strings for regular expressions 2020-02-28 08:50:35 -08:00
Kelly Brazil
c02b6b5d82 doc updates 2020-02-27 21:21:19 -08:00
Kelly Brazil
f99b423284 doc update 2020-02-27 21:04:24 -08:00
Kelly Brazil
d7d9d45d4f add missing comma 2020-02-27 20:59:09 -08:00
Kelly Brazil
90065ec0cd add more integers 2020-02-27 20:57:22 -08:00
Kelly Brazil
51157ebb86 another devname fix 2020-02-27 20:49:14 -08:00
Kelly Brazil
96d95c79ca devname fix 2020-02-27 20:47:07 -08:00
Kelly Brazil
e5da34c233 check if devname key exists before renaming 2020-02-27 20:41:06 -08:00
Kelly Brazil
f09d657f77 rename devname to device 2020-02-27 20:36:19 -08:00
Kelly Brazil
0f4b0189f5 process integer values 2020-02-27 20:31:17 -08:00
Kelly Brazil
4666042abb add blkid parser 2020-02-27 20:21:02 -08:00
Kelly Brazil
027d544c2b add last and lastb parser 2020-02-27 16:08:56 -08:00
Kelly Brazil
f1967d0138 system_boot fix 2020-02-27 16:08:39 -08:00
Kelly Brazil
c1d896027d fix system_boot tty 2020-02-27 15:58:12 -08:00
Kelly Brazil
5c2d2a6618 process function and docs 2020-02-27 15:44:36 -08:00
Kelly Brazil
997b269b0b btmp fix 2020-02-27 15:26:09 -08:00
Kelly Brazil
61257e7525 add last and lastb parser 2020-02-27 15:14:43 -08:00
Kelly Brazil
53ee2c3631 Merge pull request #29 from kellyjonbrazil/dev
Dev v1.7.5
2020-02-27 10:59:14 -08:00
Kelly Brazil
8bfa0bddec version bump to 1.7.5 2020-02-27 10:50:05 -08:00
Kelly Brazil
ad61e6bc81 add ls tests for filenames with newline characters 2020-02-27 10:48:09 -08:00
Kelly Brazil
873b5ba8ac move examples to bottom 2020-02-27 09:36:57 -08:00
Kelly Brazil
6ae50054e2 readme update 2020-02-24 20:30:44 -08:00
Kelly Brazil
22a35f41bf move variables to top 2020-02-24 17:50:56 -08:00
Kelly Brazil
961696c963 add a warning if newlines are detected in naked ls 2020-02-24 17:47:31 -08:00
Kelly Brazil
c7b7f1a5dc fix for files with newlines in naked ls 2020-02-24 17:24:56 -08:00
Kelly Brazil
b5a0d650b1 ls output with newlines 2020-02-24 17:01:33 -08:00
Kelly Brazil
573b279464 fixup for filenames that start with a newline character 2020-02-24 17:01:12 -08:00
Kelly Brazil
116e07f161 fixes for multiple consecutive newlines and trailing newlines in filenames 2020-02-24 16:38:29 -08:00
Kelly Brazil
964868c8af add support for newlines in filenames (only with ls -l) 2020-02-24 15:19:43 -08:00
Kelly Brazil
c8dac32df8 readme update 2020-02-24 13:05:35 -08:00
Kelly Brazil
72a0016bd8 use link to anchor for Parsers 2020-02-20 15:38:45 -08:00
Kelly Brazil
2ad3167434 update doc url 2020-02-19 07:12:43 -08:00
Kelly Brazil
ddabfaa05c Merge pull request #25 from kellyjonbrazil/dev
Dev v1.7.4
2020-02-19 07:05:29 -08:00
Kelly Brazil
f857523ca7 bump to version 1.7.4 2020-02-19 07:02:50 -08:00
Kelly Brazil
00d53858e8 add note about aliases not being supported 2020-02-17 22:57:15 -08:00
Kelly Brazil
c008167e66 add time-style=full-iso option to doc 2020-02-17 22:48:44 -08:00
Kelly Brazil
102344a041 formatting 2020-02-17 22:32:07 -08:00
Kelly Brazil
c865298ef3 remove unnecessary enumerate in for loop 2020-02-17 22:29:39 -08:00
Kelly Brazil
6ac03faf93 Revert "add ubuntu and centos default ls aliases to magic_commands"
This reverts commit 49c2701743.
2020-02-17 18:58:07 -08:00
Kelly Brazil
49c2701743 add ubuntu and centos default ls aliases to magic_commands 2020-02-17 18:55:03 -08:00
Kelly Brazil
d1a271b08e add new ls tests for recursive and multiple directories with glob 2020-02-17 18:33:55 -08:00
Kelly Brazil
7388ad19b9 bump to v1.8.0 2020-02-17 17:31:15 -08:00
Kelly Brazil
2e63cb5fad version bump ls to 1.1 2020-02-17 17:16:34 -08:00
Kelly Brazil
e7f14d02b1 update ls to allow multi directory (glob and -R). Adds 'parent' key if found 2020-02-17 17:14:27 -08:00
Kelly Brazil
873771d05a formatting 2020-02-17 09:16:32 -08:00
Kelly Brazil
d7de122e36 prettify link 2020-02-14 09:44:24 -08:00
Kelly Brazil
4ef0434f53 formatting update 2020-02-14 09:43:02 -08:00
Kelly Brazil
1aa2c99259 removed history from magic syntax 2020-02-13 22:10:22 -08:00
Kelly Brazil
c2450b27b0 Merge pull request #22 from kellyjonbrazil/dev
Dev 1.7.3
2020-02-13 21:26:18 -05:00
Kelly Brazil
14d6d8b84f version bump to 1.7.3 2020-02-13 18:24:53 -08:00
Kelly Brazil
f0e3846c03 formatting 2020-02-13 18:20:22 -08:00
Kelly Brazil
6ba64f1128 usage update 2020-02-13 18:19:19 -08:00
Kelly Brazil
13bcdbc6c9 doc update 2020-02-13 17:50:51 -08:00
Kelly Brazil
cfba62db20 correct parser search in magic() 2020-02-13 17:48:21 -08:00
Kelly Brazil
18fb69e36e docs/parsers link 2020-02-13 17:29:45 -08:00
Kelly Brazil
474eb0f3fd doc updates 2020-02-13 17:24:10 -08:00
Kelly Brazil
7f47b53370 add alternate magic syntax 2020-02-13 17:20:00 -08:00
Kelly Brazil
dc2907d3ce doc update 2020-02-13 16:58:25 -08:00
Kelly Brazil
1af85811e0 remove magic_command info 2020-02-13 16:57:57 -08:00
Kelly Brazil
1c1b19a478 doc update 2020-02-13 16:57:30 -08:00
Kelly Brazil
66942d64ba changelog update 2020-02-13 16:56:48 -08:00
Kelly Brazil
2fb6ae08d7 fix shlex usage 2020-02-13 12:17:41 -08:00
Kelly Brazil
bf8811e03e add comments 2020-02-13 10:25:41 -05:00
Kelly Brazil
c8b502c571 remove unnecessary join and add comments 2020-02-13 10:14:32 -05:00
Kelly Brazil
81c11a975c added docstrings 2020-02-13 10:08:43 -05:00
Kelly Brazil
0d370eb403 doc update 2020-02-13 10:03:11 -05:00
Kelly Brazil
7492c3f1e3 changelog update 2020-02-13 09:48:42 -05:00
Kelly Brazil
515a8a84b7 add "command" to description 2020-02-13 09:47:40 -05:00
Kelly Brazil
dd6680efb2 allow condensed options (-prdq is equivalent to -p -r -d -q) 2020-02-13 09:47:16 -05:00
Kelly Brazil
a7158373cd comment update 2020-02-12 00:16:17 -05:00
Kelly Brazil
6d50ec7199 add try/except to fix bare jc command condition 2020-02-12 00:11:48 -05:00
Kelly Brazil
95dbf98e8e allow options in magic syntax 2020-02-11 19:14:51 -08:00
Kelly Brazil
d49323e4eb add magic_commands list to info 2020-02-11 18:09:21 -08:00
Kelly Brazil
08c1e2aec9 add magic syntax 2020-02-11 18:08:59 -08:00
Kelly Brazil
a2c137df2e better magic command syntax logic using introspection information from parser modules 2020-02-11 18:08:37 -08:00
Kelly Brazil
fe27dcdb8f proof of concept for magic syntax (e.g. jc ls -al) 2020-02-11 12:16:23 -08:00
Kelly Brazil
028e136161 bump to 1.7.2: add test fixtures to package 2020-02-08 12:46:42 -08:00
Kelly Brazil
9a85a0a4d5 fix doc 2020-02-08 12:46:14 -08:00
Kelly Brazil
3a1cbc4d50 move info class to top 2020-02-05 22:26:47 -08:00
Kelly Brazil
77d334f7f3 Merge pull request #19 from kellyjonbrazil/dev-1.7.1
Dev v1.7.1
2020-02-05 16:59:52 -08:00
Kelly Brazil
53cdf863ac changelog update 2020-02-05 16:53:17 -08:00
Kelly Brazil
7b7e7fe0fe changelog update 2020-02-05 16:50:55 -08:00
Kelly Brazil
0c03132847 fix error codes using sys.exit() 2020-02-05 16:18:58 -08:00
Kelly Brazil
3b81f7e2a1 exit code on ctrl-c exit 2020-02-05 16:12:09 -08:00
Kelly Brazil
3d76437b43 doc fix 2020-02-05 16:00:23 -08:00
Kelly Brazil
4bc54c78ce fix compatibility list 2020-02-05 16:00:10 -08:00
Kelly Brazil
3d303a96b9 crontab bug fix and tests 2020-02-05 15:52:39 -08:00
Kelly Brazil
33c99d031d fix line clobbering bug 2020-02-05 15:12:59 -08:00
Kelly Brazil
caf7e9f69a fix line clobbering bug and add user field to shortcuts 2020-02-05 15:11:51 -08:00
Kelly Brazil
9449f1f5d5 crontab bugfix: inserting header row was clobbering the first data row 2020-02-05 14:44:49 -08:00
Kelly Brazil
6bad164b5e simplify by removing unnecessary getattr calls 2020-02-05 14:10:22 -08:00
Kelly Brazil
bb5ba7ddb1 add indent variable to helptext 2020-02-05 13:57:34 -08:00
Kelly Brazil
8b2e01d540 doc update 2020-02-05 13:50:12 -08:00
Kelly Brazil
ff1159b1de exit codes on error 2020-02-05 11:45:17 -08:00
Kelly Brazil
a2fd3202a0 description formatting change 2020-02-05 11:34:33 -08:00
Kelly Brazil
7b53715b91 change description 2020-02-05 11:08:58 -08:00
Kelly Brazil
e05fc0a510 change padding of helptext 2020-02-05 11:08:47 -08:00
Kelly Brazil
43604c33f6 doc update 2020-02-05 10:59:51 -08:00
Kelly Brazil
eb67c484ff add crontab-u to parsers list 2020-02-05 10:58:26 -08:00
Kelly Brazil
a7b7bdd467 load parser modules 'just in time' so we don't need to load all modules at startup 2020-02-05 10:55:08 -08:00
Kelly Brazil
ab06989a18 description updates 2020-02-04 21:46:52 -08:00
Kelly Brazil
657b722f94 ini to INI 2020-02-04 21:44:10 -08:00
Kelly Brazil
dd2aecad27 description update 2020-02-04 21:37:07 -08:00
Kelly Brazil
c82c5c5c64 changelog update 2020-02-04 21:34:57 -08:00
Kelly Brazil
a1761cd68f id tests 2020-02-04 21:25:33 -08:00
Kelly Brazil
d618a7f583 doc update 2020-02-04 21:17:03 -08:00
Kelly Brazil
831a42f660 id formatting 2020-02-04 21:12:32 -08:00
Kelly Brazil
3b36022e5a add id parser 2020-02-04 21:09:42 -08:00
Kelly Brazil
d01dfa25f1 changelog updates 2020-02-04 15:22:36 -08:00
Kelly Brazil
395a99037b crontab-u and history doc updates 2020-02-04 14:36:03 -08:00
Kelly Brazil
025986c51d change history 'line' to integer 2020-02-04 14:31:28 -08:00
Kelly Brazil
c56b83093f doc update 2020-02-04 14:19:33 -08:00
Kelly Brazil
7c712a4133 doc update 2020-02-04 14:18:14 -08:00
Kelly Brazil
9a0cfe6dfa minor formatting 2020-02-04 14:18:01 -08:00
Kelly Brazil
a116cdbcec tests for crontab-u 2020-02-04 14:11:34 -08:00
Kelly Brazil
f2d616c98e add crontab with user parser 2020-02-04 14:02:27 -08:00
Kelly Brazil
42cbd1777d add xml and yaml tests 2020-02-04 13:53:45 -08:00
Kelly Brazil
ebf375aac0 add ini tests 2020-02-04 12:18:31 -08:00
Kelly Brazil
1f9050267e add ini, xml, and yaml test files 2020-02-04 12:02:18 -08:00
Kelly Brazil
d7f9707a15 minor formatting 2020-02-04 11:18:32 -08:00
Kelly Brazil
ab589ee3ed add __version__ variable 2020-02-04 11:18:15 -08:00
Kelly Brazil
c84ec0361f xml example update 2020-02-03 22:25:30 -08:00
Kelly Brazil
47d2f8968a doc update 2020-02-03 22:21:40 -08:00
Kelly Brazil
019c480bcc update acknowledgments 2020-02-03 22:17:13 -08:00
Kelly Brazil
547c6d3d59 add xml parser 2020-02-03 22:13:06 -08:00
Kelly Brazil
b5ebf8b76a add ruamel.yaml ack 2020-02-03 21:41:53 -08:00
Kelly Brazil
c690e328f2 add examples 2020-02-03 21:38:21 -08:00
Kelly Brazil
cbb92c1a95 add ini and yaml 2020-02-03 21:38:08 -08:00
Kelly Brazil
beb41997c9 doc update 2020-02-03 21:28:11 -08:00
Kelly Brazil
755a6faf11 clean up multi-document support 2020-02-03 21:22:30 -08:00
Kelly Brazil
021f8350a3 update doc 2020-02-03 19:11:36 -08:00
Kelly Brazil
76583dcd2f add ini file parser 2020-02-03 19:07:31 -08:00
Kelly Brazil
bf033239a7 doc update 2020-02-03 16:20:38 -08:00
Kelly Brazil
eb37fccd37 doc update 2020-02-03 16:17:29 -08:00
Kelly Brazil
d04ad45331 setup for 1.7.1 2020-02-03 16:12:45 -08:00
Kelly Brazil
db157b8ca7 add yaml file parser 2020-02-03 16:12:32 -08:00
Kelly Brazil
68f277bb20 add __version__ 2020-02-03 16:11:58 -08:00
Kelly Brazil
4de8f42664 Merge pull request #17 from kellyjonbrazil/dev
Dev v1.6.1
2019-12-17 12:11:13 -08:00
Kelly Brazil
4f11855935 update version info 2019-12-17 12:09:24 -08:00
Kelly Brazil
2b9a5fcc32 update version 2019-12-17 12:05:40 -08:00
Kelly Brazil
224948d1f2 pip list and pip show tests 2019-12-17 11:44:43 -08:00
Kelly Brazil
36f2812d5a add support for legacy output 2019-12-17 10:58:00 -08:00
Kelly Brazil
be06aa2b31 update parse() Return info 2019-12-17 10:09:19 -08:00
Kelly Brazil
41f8e3aba2 update Return info 2019-12-17 09:56:09 -08:00
Kelly Brazil
093c0df897 schema info 2019-12-17 09:38:50 -08:00
Kelly Brazil
37afc7dc8a updte todo and compatibility 2019-12-17 09:35:27 -08:00
Kelly Brazil
efbf354960 doc update for pip show 2019-12-17 09:24:08 -08:00
Kelly Brazil
5e39fe0d80 pip show parser working 2019-12-17 09:20:26 -08:00
Kelly Brazil
47328dc659 add pip-show parser 2019-12-16 19:09:14 -08:00
Kelly Brazil
addeef50ba initial pip show parser add 2019-12-16 19:07:51 -08:00
Kelly Brazil
ad338cc5b5 schema doc update 2019-12-16 18:58:33 -08:00
Kelly Brazil
202bc8201e doc update 2019-12-16 18:54:19 -08:00
Kelly Brazil
5ff99de405 add argument to parser info 2019-12-16 18:40:08 -08:00
Kelly Brazil
86ebe2cf9c initial add of pip list parser 2019-12-16 18:36:13 -08:00
Kelly Brazil
facf0b399c add osx to campatible 2019-12-16 18:09:29 -08:00
Kelly Brazil
33db7b0bcb add crontab tests 2019-12-16 18:09:00 -08:00
Kelly Brazil
663d07bca1 add crontab 2019-12-16 17:52:09 -08:00
Kelly Brazil
ba04e4997f update docs 2019-12-16 17:51:11 -08:00
Kelly Brazil
c4fee1b658 add crontab parser 2019-12-16 17:50:52 -08:00
Kelly Brazil
99b92a15bb support shortcut schedules 2019-12-16 17:45:34 -08:00
Kelly Brazil
b076ab5b57 initial crontab parser 2019-12-16 17:01:53 -08:00
Kelly Brazil
687759f75d alphabetize du entry 2019-12-16 14:31:21 -08:00
Kelly Brazil
9eaac7f3af add du 2019-12-16 14:30:06 -08:00
Kelly Brazil
4c24e00cfc add osx-11 and ubuntu tests 2019-12-16 14:27:55 -08:00
Kelly Brazil
beb17011b0 du tests and docs 2019-12-16 13:57:42 -08:00
Kelly Brazil
e882bf55bc initial add du parser 2019-12-16 13:52:42 -08:00
Kelly Brazil
3a3016adb6 add parser_count to about 2019-12-16 11:52:18 -08:00
Kelly Brazil
1e8b68153a add osx uname tests 2019-12-16 11:12:45 -08:00
Kelly Brazil
9335cf65fb add uname osx support 2019-12-16 11:02:02 -08:00
Kelly Brazil
83f35256ae add OSX support 2019-12-16 11:01:43 -08:00
Kelly Brazil
4283333948 version bump 2019-12-16 10:03:47 -08:00
Kelly Brazil
b8f902796b shorten changelog 2019-12-16 10:03:34 -08:00
Kelly Brazil
8f99ab295c info update 2019-12-16 09:08:47 -08:00
Kelly Brazil
882310e268 add name to about parser info 2019-12-16 09:04:52 -08:00
Kelly Brazil
56bce95214 about code cleanup 2019-12-16 09:00:16 -08:00
Kelly Brazil
c13ecbec29 clean up parser info 2019-12-16 08:59:41 -08:00
Kelly Brazil
0ffaaa6e73 clean up about code 2019-12-16 08:18:37 -08:00
Kelly Brazil
75eff3adea remove whitespace 2019-12-14 23:56:40 -08:00
Kelly Brazil
bf5f80476c use real parser name in error message 2019-12-14 23:56:22 -08:00
Kelly Brazil
9aaf0fbb2f doc updates 2019-12-14 23:35:42 -08:00
Kelly Brazil
8f01ef7953 add -a option info 2019-12-14 23:27:56 -08:00
Kelly Brazil
da1d087452 add parser version info 2019-12-14 23:21:47 -08:00
Kelly Brazil
e16bc7e882 add about information to parsers 2019-12-14 23:15:15 -08:00
Kelly Brazil
fe9bdd4811 add info class 2019-12-13 20:01:51 -08:00
Kelly Brazil
17b6f3f6d6 add osx tests 2019-12-13 14:36:21 -08:00
Kelly Brazil
90a6baf0ee add osx tests 2019-12-13 14:30:12 -08:00
Kelly Brazil
f0e73d0e72 add osx tests 2019-12-13 10:50:01 -08:00
Kelly Brazil
a762882f1c fixture updates 2019-12-13 08:58:23 -08:00
Kelly Brazil
4c1bc59236 doc updates 2019-12-12 17:05:40 -08:00
Kelly Brazil
f2962083f8 add osx support for mount parser 2019-12-12 17:04:40 -08:00
Kelly Brazil
a0b22a5bcf help text formatting 2019-12-12 16:14:46 -08:00
Kelly Brazil
dcf393354c doc fix 2019-12-12 16:10:30 -08:00
Kelly Brazil
5f771656e3 use universal parser 2019-12-12 16:07:52 -08:00
Kelly Brazil
f376aab793 doc update 2019-12-12 15:59:36 -08:00
Kelly Brazil
3c96464217 osx fixes and tests 2019-12-12 15:59:24 -08:00
Kelly Brazil
c9892833a1 formatting change 2019-12-12 15:58:40 -08:00
Kelly Brazil
127c98affc changelog update 2019-12-12 15:58:24 -08:00
Kelly Brazil
8687a772f5 use universal parser 2019-12-12 15:33:34 -08:00
Kelly Brazil
b1162b14d4 use universal parser 2019-12-12 15:22:21 -08:00
Kelly Brazil
8a8ee35707 use universal parser 2019-12-12 15:01:42 -08:00
Kelly Brazil
5e109a3665 add du 2019-12-12 14:12:36 -08:00
Kelly Brazil
11db478430 update changelog 2019-12-12 14:12:21 -08:00
Kelly Brazil
a85377014d use universal parser 2019-12-12 14:11:59 -08:00
Kelly Brazil
3aea86234d fix osx-10.11.6 tests 2019-12-12 11:23:49 -08:00
Kelly Brazil
916ec6ed6b fix osx ls tests 2019-12-12 10:11:24 -08:00
Kelly Brazil
9dca6ba539 doc formatting change 2019-12-12 09:47:14 -08:00
Kelly Brazil
0ebb89f561 doc update 2019-12-12 09:41:56 -08:00
Kelly Brazil
e237867e24 doc formatting 2019-12-12 09:41:25 -08:00
Kelly Brazil
78fa44fd9a add compatibility to docs 2019-12-12 09:35:42 -08:00
Kelly Brazil
d615fa3b93 add compatibility to docs 2019-12-12 09:21:20 -08:00
Kelly Brazil
ce134dc332 Add OSX tests for ls 2019-12-12 09:09:57 -08:00
Kelly Brazil
a56e4dc752 use universal simple table parser 2019-12-11 17:27:48 -08:00
Kelly Brazil
d221b4aa29 changelog update 2019-12-11 17:19:38 -08:00
Kelly Brazil
d2cba6ad2f add compatibility info 2019-12-11 17:18:21 -08:00
Kelly Brazil
84b3c30b52 add osx tests 2019-12-11 17:18:04 -08:00
Kelly Brazil
68eeec19a8 doc update 2019-12-11 16:39:30 -08:00
Kelly Brazil
c6d1528a2e use _ instead of - 2019-12-11 16:37:13 -08:00
Kelly Brazil
50a6b256b8 new universal parsers to limit code duplication 2019-12-09 14:01:47 -08:00
Kelly Brazil
bbba1fe477 update df to use universal sparse table parser for osx compatibility 2019-12-09 14:01:29 -08:00
Kelly Brazil
46b827da6b add osx compatibility 2019-12-06 13:22:51 -08:00
Kelly Brazil
5e8c28a30a comment fix 2019-12-06 11:47:42 -08:00
Kelly Brazil
e5d3903164 update ifconfig doc 2019-12-06 11:46:09 -08:00
Kelly Brazil
23975c9c9e fixup osx subnet mask and convert state to an array 2019-12-06 11:44:57 -08:00
Kelly Brazil
1e0dab8355 ifconfig fixture updates 2019-12-06 10:53:49 -08:00
Kelly Brazil
5f4c10ffd5 doc update 2019-12-06 10:39:11 -08:00
Kelly Brazil
6f3d2b4b56 require ifconfig-parser v0.0.5 for mac and bytes support 2019-12-06 10:30:01 -08:00
Kelly Brazil
fea8ace844 add OSX compatibility 2019-12-06 10:27:11 -08:00
Kelly Brazil
6633d9262c Set theme jekyll-theme-cayman 2019-11-30 13:52:24 -08:00
Kelly Brazil
7d54137140 link update 2019-11-28 11:51:54 -08:00
Kelly Brazil
2fcda6f248 add motivation to readme 2019-11-25 18:34:21 -08:00
Kelly Brazil
9c1b8bacf9 Merge pull request #16 from kellyjonbrazil/dev
Dev v1.5.1
2019-11-17 11:55:06 -08:00
Kelly Brazil
4867655eb2 add line-numbers tests 2019-11-17 11:49:36 -08:00
Kelly Brazil
47410d1a95 version bump 2019-11-17 11:05:46 -08:00
Kelly Brazil
5fa49f5e67 changelog update 2019-11-17 11:00:16 -08:00
Kelly Brazil
36c53827fa add systemctl tests 2019-11-17 10:56:55 -08:00
Kelly Brazil
51631aef5b add systemctl tests 2019-11-17 10:31:58 -08:00
Kelly Brazil
a0298ac8a3 add fstab tests 2019-11-17 10:26:48 -08:00
Kelly Brazil
98c0188821 formatting fix 2019-11-15 19:27:51 -08:00
Kelly Brazil
ab1dabe3e4 doc update 2019-11-15 19:26:22 -08:00
Kelly Brazil
94bdb11fdf remove systemctl from TODO 2019-11-15 19:24:32 -08:00
Kelly Brazil
b6727d68ba add systemctl parsers 2019-11-15 19:18:31 -08:00
Kelly Brazil
89bad7fc2b remove systemctl list-machines parser 2019-11-15 19:13:53 -08:00
Kelly Brazil
c0b8b810a2 add systemctl list parsers 2019-11-15 19:07:42 -08:00
Kelly Brazil
31eb65acd1 doc fix 2019-11-15 19:05:49 -08:00
Kelly Brazil
513bbeb464 add break on footer condition 2019-11-15 19:02:57 -08:00
Kelly Brazil
3a52fb725a add systemctl list-jobs parser 2019-11-15 18:58:17 -08:00
Kelly Brazil
5affd44499 add systemctl_lj, lm, ls, and luf 2019-11-15 18:36:12 -08:00
Kelly Brazil
5dbc6e806c add systemctl_luf parser 2019-11-15 12:28:28 -08:00
Kelly Brazil
59ae31f3f3 add systemctl parser 2019-11-15 11:58:17 -08:00
Kelly Brazil
230e921c2e remove fstab from TODO 2019-11-15 10:36:58 -08:00
Kelly Brazil
a7c3d88b08 update example and docs 2019-11-15 10:01:29 -08:00
Kelly Brazil
9b453bcb84 remove commented code block 2019-11-15 09:57:25 -08:00
Kelly Brazil
ce43c782f6 fstab update 2019-11-15 09:32:12 -08:00
Kelly Brazil
cb16faaf4d helptext update 2019-11-15 09:31:28 -08:00
Kelly Brazil
3f1d3ff6d8 add examples 2019-11-15 09:29:54 -08:00
Kelly Brazil
6f67eecd5e add fstab parser 2019-11-15 09:22:07 -08:00
Kelly Brazil
e75c819190 changelog update 2019-11-15 08:51:53 -08:00
Kelly Brazil
601e68d104 doc update 2019-11-15 08:40:13 -08:00
Kelly Brazil
8285ecfd1e enhance test file with comments 2019-11-15 08:40:01 -08:00
Kelly Brazil
8726de902e add hosts parser 2019-11-14 22:04:59 -08:00
Kelly Brazil
4133585274 add hosts tests 2019-11-14 22:04:48 -08:00
Kelly Brazil
ad913b1417 add hosts docs 2019-11-14 21:59:06 -08:00
Kelly Brazil
7113e5a844 filter out comments at the end of the line 2019-11-14 21:55:08 -08:00
Kelly Brazil
a3a8369dc0 add docs 2019-11-14 21:36:02 -08:00
Kelly Brazil
64016b8ef0 add hosts parser 2019-11-14 21:31:25 -08:00
Kelly Brazil
1cb49d60c8 remove sar and sadf 2019-11-14 21:21:15 -08:00
Kelly Brazil
c858adfd12 remove stat from todo 2019-11-14 21:11:05 -08:00
Kelly Brazil
08d68327c7 add stat tests 2019-11-14 21:08:09 -08:00
Kelly Brazil
0d7c6c5664 doc fix and add continue lines 2019-11-14 20:57:49 -08:00
Kelly Brazil
8bfa41dbf4 change values to null if - 2019-11-14 17:36:29 -08:00
Kelly Brazil
7e2fa48ed4 update changelog 2019-11-14 17:24:51 -08:00
Kelly Brazil
340635cad5 fix stats doc 2019-11-14 17:23:44 -08:00
Kelly Brazil
8f77d1de09 add stat docs 2019-11-14 17:21:56 -08:00
Kelly Brazil
7dcf1b25ff add link_to field 2019-11-14 17:20:13 -08:00
Kelly Brazil
9b73538106 set compatibility to linux only 2019-11-14 16:44:12 -08:00
Kelly Brazil
3bf8c8c6db pep8 fixes 2019-11-14 16:40:52 -08:00
Kelly Brazil
04a1ff2ca7 pep8 fixes 2019-11-14 16:36:00 -08:00
Kelly Brazil
64647d230a pep8 cleanup 2019-11-14 16:32:11 -08:00
Kelly Brazil
c2a67e1b70 add stat parser 2019-11-14 16:31:52 -08:00
Kelly Brazil
edb9a7c76e add stat parser 2019-11-14 15:26:36 -08:00
Kelly Brazil
a407f5b678 minor update 2019-11-14 14:01:04 -08:00
Kelly Brazil
e5b4987acb doc update 2019-11-14 14:00:06 -08:00
Kelly Brazil
ba8cc18eeb add ss tests 2019-11-14 13:56:09 -08:00
Kelly Brazil
d2c7316e00 update command options info 2019-11-14 13:43:07 -08:00
Kelly Brazil
609aa14d24 spelling fix 2019-11-14 13:38:52 -08:00
Kelly Brazil
ef1ad4c700 doc update 2019-11-14 13:37:55 -08:00
Kelly Brazil
a0e2732152 add ss example 2019-11-14 09:46:10 -08:00
Kelly Brazil
9b5d3e3be1 update doc 2019-11-14 09:42:44 -08:00
Kelly Brazil
2663ef31fb fix field names per ss documentation 2019-11-14 09:38:19 -08:00
Kelly Brazil
a4cdd3378e add compatibility info 2019-11-13 08:17:41 -08:00
Kelly Brazil
2f805da24d add colon to parameter in docs 2019-11-13 08:04:40 -08:00
Kelly Brazil
79152a946d initialize network_list and socket_list variables 2019-11-13 07:46:14 -08:00
Kelly Brazil
de37bb37d0 add ss docs 2019-11-13 07:45:37 -08:00
Kelly Brazil
f783e44e5c doc fix 2019-11-12 18:58:58 -08:00
Kelly Brazil
af82f2c991 update raw format note 2019-11-12 18:56:42 -08:00
Kelly Brazil
46774daf9d doc update 2019-11-12 18:51:21 -08:00
Kelly Brazil
648306b785 process ss data 2019-11-12 18:04:40 -08:00
Kelly Brazil
b7a4f205b8 parser fixes 2019-11-12 17:10:06 -08:00
Kelly Brazil
fdb168b43a add ss parser 2019-11-12 16:34:42 -08:00
Kelly Brazil
b6f65c93c4 ps doc update 2019-11-12 15:05:21 -08:00
Kelly Brazil
3f4838f17a remove cli.md 2019-11-12 14:22:49 -08:00
Kelly Brazil
eef0dee2aa doc update 2019-11-12 14:20:59 -08:00
Kelly Brazil
e17388d3b2 doc update 2019-11-12 14:19:40 -08:00
Kelly Brazil
7e6a1bc719 doc update 2019-11-12 14:15:22 -08:00
Kelly Brazil
37738a2ea2 update contributions 2019-11-12 14:10:26 -08:00
Kelly Brazil
c5834a57db add todo section 2019-11-12 13:35:32 -08:00
Kelly Brazil
91b9373f38 new examples 2019-11-12 13:05:19 -08:00
Kelly Brazil
ce0bb5b816 formatting fix 2019-11-12 11:52:16 -08:00
Kelly Brazil
f330ff0eff wrap example text 2019-11-12 11:49:14 -08:00
Kelly Brazil
4b02700414 update simple examples 2019-11-12 11:46:52 -08:00
Kelly Brazil
ee30180376 fix note 2019-11-12 11:39:33 -08:00
Kelly Brazil
338e0ff15c add schema note 2019-11-12 11:38:50 -08:00
Kelly Brazil
3ac75305df update process() doc 2019-11-12 11:28:10 -08:00
Kelly Brazil
3bdcf44afb doc update 2019-11-12 11:22:17 -08:00
Kelly Brazil
e3f4ffede5 doc update 2019-11-12 11:18:00 -08:00
Kelly Brazil
f0c8725d43 doc update 2019-11-12 11:17:33 -08:00
Kelly Brazil
5473bc4eb6 doc update 2019-11-12 11:12:41 -08:00
Kelly Brazil
b9bd9422bf doc update 2019-11-12 07:19:01 -08:00
Kelly Brazil
cb5729a070 add options to docs 2019-11-12 07:18:27 -08:00
Kelly Brazil
f0b1ab4233 doc update 2019-11-12 07:08:35 -08:00
Kelly Brazil
b15386e849 doc update 2019-11-12 07:07:43 -08:00
Kelly Brazil
d2a2c8da35 doc updates 2019-11-12 07:03:02 -08:00
Kelly Brazil
7251548cbb documentation updates 2019-11-12 07:01:36 -08:00
Kelly Brazil
146e29f7cb update docs 2019-11-11 18:30:46 -08:00
Kelly Brazil
363fd3eab4 move parser_name to except block 2019-11-11 16:27:28 -08:00
Kelly Brazil
4083dd4260 add -d option 2019-11-11 16:16:41 -08:00
Kelly Brazil
b2b74547ba add netstat-sudo-aeep tests 2019-11-11 15:53:42 -08:00
Kelly Brazil
dddb0baabf use \u2063 instead of \u2026 2019-11-11 15:53:22 -08:00
Kelly Brazil
84b4f67ef9 new json output 2019-11-11 14:34:36 -08:00
Kelly Brazil
3a089138b8 add int and float changes 2019-11-11 14:31:27 -08:00
Kelly Brazil
3ff0305c8e add lsblk tests 2019-11-11 13:00:17 -08:00
Kelly Brazil
761edc3c6c remove unused parse_pairs function 2019-11-11 12:43:27 -08:00
Kelly Brazil
3351c81f64 add documentation 2019-11-11 12:40:16 -08:00
Kelly Brazil
3dfc6f67d7 change empty values to Null 2019-11-11 12:00:23 -08:00
Kelly Brazil
1546ec3bd1 fixes for right justified columns 2019-11-11 11:53:16 -08:00
Kelly Brazil
2a953011f7 rewrite of lsblk parser to use a custom delimiter 2019-11-10 15:18:53 -08:00
Kelly Brazil
d2f755de9d updates tests 2019-11-08 17:08:41 -08:00
Kelly Brazil
f363334639 update tests 2019-11-08 16:21:09 -08:00
Kelly Brazil
750197e485 new tests 2019-11-08 16:04:19 -08:00
Kelly Brazil
36b349e4ed json output files 2019-11-08 16:03:41 -08:00
Kelly Brazil
b5f1e94fe2 fix for space before '-' in program_name 2019-11-08 16:03:14 -08:00
Kelly Brazil
6a504fb0e1 add exception type 2019-11-08 16:02:44 -08:00
Kelly Brazil
e02bad2240 update documentation 2019-11-08 12:22:41 -08:00
Kelly Brazil
1d4043a3b6 add template parser 2019-11-08 12:14:09 -08:00
Kelly Brazil
039e034829 fix parsing issues in program_name when spaces are in the name 2019-11-08 11:47:58 -08:00
Kelly Brazil
d828de4f4f update documentation 2019-11-08 09:07:05 -08:00
Kelly Brazil
098000bb10 fix blank 'from' column issue 2019-11-08 09:04:03 -08:00
Kelly Brazil
b41165eff5 process w data 2019-11-07 19:13:15 -08:00
Kelly Brazil
6ad7891b2b process uptime data 2019-11-07 18:54:52 -08:00
Kelly Brazil
7213831559 add process boilerplate 2019-11-07 18:47:01 -08:00
Kelly Brazil
10eedd82e4 changelog update 2019-11-07 18:34:06 -08:00
Kelly Brazil
a55493da0f process route data 2019-11-07 18:33:51 -08:00
Kelly Brazil
89973f4162 doc updates and tty fix 2019-11-07 15:33:12 -08:00
Kelly Brazil
4802222ad5 process ps data 2019-11-07 15:24:03 -08:00
Kelly Brazil
bcd28f06f8 prep ps for process 2019-11-07 15:09:57 -08:00
Kelly Brazil
e17a47a7fa fix typo 2019-11-07 14:51:05 -08:00
Kelly Brazil
cad2e16c7a document examples 2019-11-07 14:49:21 -08:00
Kelly Brazil
5da5d278da process netstat data 2019-11-07 14:43:42 -08:00
Kelly Brazil
81b6776e57 remove old netstat parser 2019-11-07 13:58:55 -08:00
Kelly Brazil
5ecb6bd58b doc updates 2019-11-07 13:58:37 -08:00
Kelly Brazil
21b56096c5 finalize parse_post 2019-11-07 13:53:23 -08:00
Kelly Brazil
8c78f95973 clean up trailing spaces on entries 2019-11-07 12:13:25 -08:00
Kelly Brazil
94a88bb566 post_parse flags and program_name 2019-11-07 10:52:02 -08:00
Kelly Brazil
579124475b simplify parser_map code 2019-11-07 09:02:27 -08:00
Kelly Brazil
5da83e0200 fix found variable error 2019-11-07 08:23:11 -08:00
Kelly Brazil
a90a76d004 move out old netstat parser 2019-11-07 08:15:19 -08:00
Kelly Brazil
bdfa959123 fix compatibility code 2019-11-07 08:07:43 -08:00
Kelly Brazil
4380594275 remove cli functions from utils 2019-11-07 08:04:32 -08:00
Kelly Brazil
88bf252c0d rename jc.py to cli.py 2019-11-07 08:04:07 -08:00
Kelly Brazil
a5efd8adce rename jc.py to cli.py 2019-11-07 08:03:45 -08:00
Kelly Brazil
2ee392eeff add quiet mode 2019-11-06 21:09:09 -08:00
Kelly Brazil
9c1d893e16 move utils to own module and add quiet mode 2019-11-06 21:07:25 -08:00
Kelly Brazil
88dcb90c83 changelog update 2019-11-06 21:05:25 -08:00
Kelly Brazil
a3bcabc89c mvp of netstat raw_data parser 2019-11-06 20:35:10 -08:00
Kelly Brazil
dafbf9fdcf process lsmod data 2019-11-06 19:17:01 -08:00
Kelly Brazil
680cb2b2ca doc update 2019-11-06 09:56:59 -06:00
Kelly Brazil
54818a06e0 change bool variable names 2019-11-06 09:21:55 -06:00
Kelly Brazil
88f4c5b5a9 remove TypeError from exception check 2019-11-06 08:47:54 -06:00
Kelly Brazil
2bb7409887 process lsblk data 2019-11-05 23:10:49 -06:00
Kelly Brazil
c780aac3ab add compatibility function 2019-11-05 22:42:48 -06:00
Kelly Brazil
5010aaec28 put exit() back 2019-11-05 17:25:20 -06:00
Kelly Brazil
066e93cb07 move exit() to errormessage() 2019-11-05 17:23:46 -06:00
Kelly Brazil
0bd2faa7f7 beautify compatibility list 2019-11-05 17:17:07 -06:00
Kelly Brazil
e2f926453b add install script 2019-11-05 17:08:41 -06:00
Kelly Brazil
b953b79f9c add compatibility 2019-11-05 17:04:18 -06:00
Kelly Brazil
7f99677806 compatibility function call 2019-11-05 17:00:36 -06:00
Kelly Brazil
721b546659 finish schema 2019-11-05 15:14:52 -06:00
Kelly Brazil
2de5e41269 fix for more columns and build schema 2019-11-05 15:07:40 -06:00
Kelly Brazil
dfe0f6e99b process ls data 2019-11-05 08:30:32 -08:00
Kelly Brazil
8873b1bc69 clean up process code 2019-11-05 08:07:39 -08:00
Kelly Brazil
9ff9470700 refactor helptext() function 2019-11-05 07:21:58 -08:00
Kelly Brazil
2c58fca530 process jobs data 2019-11-04 17:07:11 -08:00
Kelly Brazil
9e5cd90da7 process iptables data 2019-11-04 16:59:14 -08:00
Kelly Brazil
7ee0d49424 process ifconfig data 2019-11-04 15:54:34 -08:00
Kelly Brazil
a9058ee21e doc formatting 2019-11-04 15:19:50 -08:00
Kelly Brazil
fcf0aac87d add history processing 2019-11-04 15:19:35 -08:00
Kelly Brazil
daec5f0681 process free data 2019-11-04 15:11:18 -08:00
Kelly Brazil
5b2491d5ae process env data 2019-11-04 15:03:16 -08:00
Kelly Brazil
d9b41ac73b doc formatting 2019-11-04 13:52:45 -08:00
Kelly Brazil
7168ffddf8 process dig output 2019-11-04 13:47:27 -08:00
Kelly Brazil
a855344bec document schema 2019-11-04 13:05:56 -08:00
Kelly Brazil
d8b3b59fae add schema and rename 'avail' to 'available' 2019-11-04 13:02:54 -08:00
Kelly Brazil
4b7d7840d3 add -r option 2019-11-04 12:50:37 -08:00
Kelly Brazil
58a094a9b4 changelog update 2019-11-04 12:40:19 -08:00
Kelly Brazil
65adbb4189 doc update 2019-11-04 12:40:05 -08:00
Kelly Brazil
f7350959c9 df fix for changing header names when -h used 2019-11-04 12:39:43 -08:00
Kelly Brazil
8934a7d832 fix dictionary iteration 2019-11-04 11:10:58 -08:00
Kelly Brazil
669a424fd6 fix process function 2019-11-04 11:02:02 -08:00
Kelly Brazil
591a65c2bd process df data 2019-11-04 10:56:33 -08:00
Kelly Brazil
a78fb89078 add raw and processed output 2019-11-04 09:32:29 -08:00
Kelly Brazil
8979dab2a5 add raw mode 2019-11-04 09:32:09 -08:00
Kelly Brazil
0a891f0add bump python required version 2019-11-04 08:09:19 -08:00
Kelly Brazil
c220e35b14 cleanup helptext 2019-11-04 08:06:50 -08:00
Kelly Brazil
f26c5818bd refactor helptext 2019-11-04 07:57:47 -08:00
Kelly Brazil
e712cd3fc4 netstat2 skeleton 2019-11-01 22:29:08 -07:00
Kelly Brazil
0309c9ac67 setup cleanup 2019-11-01 08:55:52 -07:00
Kelly Brazil
9a9eb4120a setup updates 2019-11-01 08:53:53 -07:00
Kelly Brazil
d1927456b0 Merge pull request #6 from kellyjonbrazil/dev
Dev v1.1.1
2019-10-31 08:06:01 -07:00
Kelly Brazil
a3d9213a1e add date 2019-10-31 07:59:03 -07:00
Kelly Brazil
3365c03a1e add tests 2019-10-31 07:58:44 -07:00
Kelly Brazil
4f6c87389b add dig test files 2019-10-31 07:27:31 -07:00
Kelly Brazil
41a2a9adac remove unnecessary if statement 2019-10-31 07:27:12 -07:00
Kelly Brazil
74dae2905b dig parser mvp 2019-10-30 17:23:35 -07:00
Kelly Brazil
d1f64214de add authority parsing 2019-10-30 17:18:14 -07:00
Kelly Brazil
d3e1aa20a8 fix when line 2019-10-30 17:03:35 -07:00
Kelly Brazil
72cae95777 dig fixes 2019-10-30 16:59:56 -07:00
Kelly Brazil
219bc8130f dig parser skeleton 2019-10-30 15:36:13 -07:00
Kelly Brazil
e8c1a554c0 testfile updates 2019-10-30 13:52:53 -07:00
Kelly Brazil
087a60bc2a documentation updates 2019-10-30 13:52:31 -07:00
Kelly Brazil
9c9823c3b8 add arp testfiles 2019-10-30 13:29:06 -07:00
Kelly Brazil
cf8d13030b add arp 2019-10-30 13:22:12 -07:00
Kelly Brazil
1eff69c187 add documentation 2019-10-30 13:21:05 -07:00
Kelly Brazil
b10fb77d71 fixup arp parser 2019-10-30 13:12:53 -07:00
Kelly Brazil
87cee8b230 add arp parser 2019-10-30 13:00:05 -07:00
Kelly Brazil
83ab10d628 documentation update 2019-10-30 12:50:05 -07:00
Kelly Brazil
d58a6e1d1d readme update 2019-10-29 14:19:04 -07:00
Kelly Brazil
cb46ca5c27 readme update 2019-10-29 10:27:42 -07:00
Kelly Brazil
5528d979f0 version bump 2019-10-29 09:16:03 -07:00
Kelly Brazil
ee94a038a6 add tests 2019-10-29 08:58:52 -07:00
Kelly Brazil
1d658f7a9f add tests 2019-10-29 08:45:11 -07:00
Kelly Brazil
392cb44f9b initial add of tests and fixtures 2019-10-29 07:55:26 -07:00
Kelly Brazil
579bef079c move global output variable inside function 2019-10-29 07:54:59 -07:00
Kelly Brazil
0691cfcab3 changelog fix 2019-10-26 18:49:43 -07:00
Kelly Brazil
db29c7c186 documentation fixes 2019-10-26 18:49:13 -07:00
Kelly Brazil
fb1e036375 formatting 2019-10-25 20:27:03 -07:00
1596 changed files with 564182 additions and 2648 deletions

37
.github/workflows/pythonapp.yml vendored Normal file
View File

@@ -0,0 +1,37 @@
name: Tests
on:
push:
paths:
- "**/*.py"
pull_request:
paths:
- "**/*.py"
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v2
- name: "Set up timezone to America/Los_Angeles"
uses: szenius/set-timezone@v1.0
with:
timezoneLinux: "America/Los_Angeles"
timezoneMacos: "America/Los_Angeles"
timezoneWindows: "Pacific Standard Time"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
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

4
.gitignore vendored
View File

@@ -3,4 +3,6 @@ __pycache__
dist/
build/
*.egg-info/
jc/parsers.old/
.github/
.vscode/
_config.yml

505
CHANGELOG Normal file
View File

@@ -0,0 +1,505 @@
jc changelog
20220425 v1.18.7
- Add git log command parser
- Add update-alternatives --query parser
- Add update-alternatives --get-selections parser
- Fix key/value and ini parsers to allow duplicate keys
- Fix yaml file parser for files including timestamp objects
- Fix UnicodeDecodeError on some systems where LANG=C is set and unicode
characters are in the output
- Update xrandr parser: add a 'rotation' field
- Fix failing tests by moving template files
- Add python interpreter version and path to -v and -a output
20220325 v1.18.6
- Add pidstat command parser tested on linux
- Add pidstat command streaming parser tested on linux
- Add mpstat command parser tested on linux
- Add mpstat command streaming parser tested on linux
- Add single-line ASCII and Unicode table parser
- Add multi-line ASCII and Unicode table parser
- Add documentation option to parser_info() and all_parser_info()
20220305 v1.18.5
- Fix date parser to ensure AM/PM period string is always uppercase
20220304 v1.18.4
- Add nmcli command parser tested on linux
- Enhance parse error messages at the cli
- Add standard and streaming parser list functions to the public API
- Enhance python developer documentation formatting
20220214 v1.18.3
- Add rsync command and log file parser tested on linux and macOS
- Add rsync command and log file streaming parser tested on linux and macOS
- Add xrandr command parser tested on linux
- Enhance timestamp performance with caching and format hints
- Refactor ignore_exceptions functionality in streaming parsers
- Fix man page in packages
20220127 v1.18.2
- Fix for plugin parsers with underscores in the name
- Add type hints to public API functions
- Add plugin attribute to plugin parser metadata
- Add C locale hint to parsing error messages
- Refactor more cli code into lib
20220121 v1.18.1
- Minor fix for MacOS binary
20220121 v1.18.0
- Add high-level parse API for built-in and plugin parsers
- Add python module developer documentation
- Enhance magic syntax exception messages
- Enhance documentation formatting
20220106 v1.17.7
- Add stat command streaming parser tested on linux and macOS
20220103 v1.17.6
- Add jar-manifest file parser (for MANIFEST.MF files)
- Fix CSV parsers for some files that include doublequotes
20211221 v1.17.5
- Add zipinfo parser tested on linux and macOS
20211207 v1.17.4
- Add support for the NO_COLOR environment variable to set mono (http://no-color.org/)
- Add -C option to force color output even when using pipes (overrides -m and NO_COLOR)
20211202 v1.17.3
- Update parsers to exit with error if non-string input is detected (raise TypeError)
- Update streaming parsers to exit with error if non-iterable input is detected (raise TypeError)
- Simplify quiet-checking in parsers
- Add iostat parser tested on linux
- Add iostat streaming parser tested on linux
20211117 v1.17.2
- Fix ping parser to add Alpine linux support
- Fix netstat parser for older versions of netstat on linux
- Fix df parser for cases where the filesystem field overflows the column length
20211030 v1.17.1
- Fix file parser for gzip files
- Fix uname parser for cases where the 'processor' and/or 'hardware_platform' fields are missing on linux
- Fix uname parser on FreeBSD
- Add lsusb parser tested on linux
- Add CSV file streaming parser
- Add testing for Python 3.10.0
20210923 v1.17.0
- Note to Package Maintainers: please see note at 20210720 v1.16.0
- Add wrapping of warning and error messages
- Add vmstat parser tested on linux
- Add support for streaming parsers
- Add ls command streaming parser tested on linux, macOS, and freeBSD
- Add ping command streaming parser tested on linux, macOS, and freeBSD
- Add vmstat command streaming parser tested on linux
- Add -u option to allow unbuffered output
20210830 v1.16.2
- Note to Package Maintainers: please see note at 20210720 v1.16.0
- Update sfdisk parser to support the -F option and newer versions of sfdisk
20210813 v1.16.1
- Note to Package Maintainers: please see note at 20210720 v1.16.0
- Fix issue with process substitution with the magic syntax
- Fix issue with globs not including filenames with spaces with magic syntax
- Fix stat parser to properly handle filenames with spaces on macOS/BSD
20210720 v1.16.0
- Note to Package Maintainers:
TL;DR: `/man/jc.1.gz` and `/jc/man/jc.1.gz` are deprecated and only `/man/jc.1` should be used.
The Man page in the PyPi source packages will be moving from `/jc/man/jc.1.gz` to `/man/jc.1`
in version 1.17.0. For now the Man pages will be available in both locations, but be aware that
the Man page at `/jc/man/jc.1.gz` is now considered deprecated.
Also, starting in v1.17.0, the Man page will no longer be compressed in the source package,
therefore `/man/jc.1.gz` should also be considered deprecated and will no longer be available
after v1.17.0. Please use `/man/jc.1` and compress downstream if you would like.
- Include CHANGELOG in source distribution
- Fix Man page location in source packages
- Add sfdisk command parser tested on linux
- Update unit test files to change the timezone when needed (POSIX only)
- Binaries and DEB/RPM/MSI packages now include Python 3.9.5 interpreter
20210628 v1.15.6
- Fix issue to only load local plugin parsers that have filenames that end in .py
20210520 v1.15.5
- Fix issue where help and about information would not display if a 3rd party parser library was missing. (e.g. xmltodict)
- Add more error message detail when encountering ParseError and LibraryNotFound exceptions
20210517 v1.15.4
- Update ping parser to support error responses in OSX and BSD
- Update ping parser to be more resilient against parsing errors for unknown error types
- Update dig parser to support `+noall +answer` use case
- Update dig parser compatibility to all platforms
- Fix colors in Windows terminals (cmd.exe and PowerShell)
- Fix epoch calculations when UTC is referenced as "Coordinated Universal Time"
- Add Windows time format for systeminfo output
- Add exceptions module to standardize parser exceptions
- JC no longer swallows exit codes when using the "magic" syntax. See the Exit Codes section of the README and man page for details
20210426 v1.15.3
- Add ufw status command parser tested on linux
- Add ufw-appinfo command parser tested on linux
- Fix deb package name to conform to standard
- Add Caveats section to readme and manpage
20210418 v1.15.2
- Add systeminfo parser tested on Windows
- Update dig parser to fix an issue with IPv6 addresses in the server field
- Update dig parser to fix an issue when axfr entries contain a semicolon
- Update dig parser to add support for Additional Section and Opt Pseudosection
- Update dig parser to add query_size field
- Use dig parser as the main example in readme, documentation, and man page
- Standardize int, float, and boolean conversion rules with functions in jc.utils
20210413 v1.15.1
- New feature to show parser documentation interactively with -h --parser_name
for example: $ jc -h --arp
- Add man page to pypi package for easier packaging in homebrew
- Update rpm-qi parser to add two calculated timestamp fields: install_date_epoch and install_date_epoch_utc
- Clean up documentation and autogenerate the Parser Information section from metadata
20210407 v1.15.0
- Add acpi command parser tested on linux
- Add upower command parser tested on linux
- Add /usr/bin/time command parser tested on linux and macOS
- Add dpkg -l command parser tested on linux
- Add rpm -qi command parser tested on linux
- Add finger command parser tested on linux and macOS
- Add dir command parser tested on Windows 10
- Update date parser: complete rewrite (v2.0) providing many enhancements:
- Make weekday numbering ISO 8601 compliant
- Add a calculated naive timestamp field
- Add a calculated UTC timestamp field (only if date output is in UTC)
- Add several fields, including: hour_24, utc_offset, day_of_year, week_of_year, iso, and timezone_aware
- Update uptime parser to add uptime_days, uptime_hours, uptime_minutes, uptime_total_seconds, time_hour,
time_minute, and time_second fields
- Update last parser to use new timestamp function
- Update stat parser to add access_time_epoch, access_time_epoch_utc, modify_time_epoch, modify_time_epoch_utc,
change_time_epoch, change_time_epoch_utc, birth_time_epoch, birth_time_epoch_utc fields
- Update timedatectl parser to add epoch_utc field
- Update who parser to add epoch field
- Update dig parser to add when_epoch and when_epoch_utc fields
- Update ls parser to add epoch and epoch_utc fields
- Add -h option to display the help text. Piping errors no longer show the help text.
- Add -v option to display version information.
- Add contributing information to project root
- Make all external python library dependencies optional: pygments, ruamel.yaml, xmltodict
- JSON output now supports unencoded unicode characters
- JSON output is now more compact unless the -p (pretty) option is used
- Developer scripts added and enhanced to automate documentation and man page creation
- Enhanced man page
20210305 v1.14.4
- Packaging fix only for binaries and RPMs hosted on https://github.com/kellyjonbrazil/jc-packaging.
Packages from PyPi and OS repositories are not affected. This fixes an issue that kept the YAML
parser from initializing.
20210210 v1.14.3
- Add hciconfig parser tested on linux
- Update dig parser to simplify answer data logic
20210205 v1.14.2
- Update dig parser to fix cases where there are spaces in the answer data (e.g. TXT records)
20210106 v1.14.1
- Add iw-scan parser tested on linux (beta)
- Update date parser for Ubuntu 20.04 support
- Update last parser for last -F support
- Update last parser to add convenience fields and augment data for easier parsing
- Update man page
- Minor documentation updates
20201231 v1.14.0
- Add hashsum parser tested on linux, macos
- Add hash parser tested on linux, macos
- Add cksum parser tested on linux, macos
- Add wc parser tested on linux, macos
- Add printenv support under env parser
- Add vdir support under ls parser
- Add python 3.9 to github automation tests
20200805 v1.13.4
- Update crontab and crontab-u parsers to tighten up variable detection
- Update ping parser to tighten linux/bsd detection
20200804 v1.13.3
- Update ping parser for Raspberry Pi compatibility
20200803 v1.13.2
- Add key/value file parser (wrapper for ini parser)
- Add date command parser
- Update traceroute parser to more gracefully handle missing header row
- Update traceroute parser to handle annotations
- Update traceroute parser to only return successful probes
20200727 v1.13.1
- Add route -6 tests
20200727 v1.13.0
- Add ping and ping6 command parser tested on linux, macos, and freebsd
- Add traceroute and traceroute6 command parser tested on linux, macos, and freebsd
- Add tracepath command parser tested on linux
- Update ini parser to support files only containing key/value pairs
- Update uname parser exception with a hint to use "uname -a"
- Update route parser to support IPv6 tables
20200711 v1.12.1
- Fix tests when using older version of pygments library
20200710 v1.12.0
- Add sysctl command parser tested on linux, macOS, and freebsd
- Update the cli code to allow older versions of the pygments library (2.3.0) for debian packaging
- Code cleanup on the cli
- Add tests for the cli
- Vendorize cgitb as tracebackplus for verbose debug messages
20200625 v1.11.8
- Add verbose debug option using -dd argument
20200622 v1.11.7
- Fix iptables parser issue which would not output the last chain
20200614 v1.11.6
- Improve and standardize empty data check for all parsers
20200612 v1.11.5
- Update airport_s parser to fix error on parsing empty data
- Update arp parser to fix error on parsing empty data
- Update blkid parser to fix error on parsing empty data
- Update crontab parser to fix error on parsing empty data
- Update crontab_u parser to fix error on parsing empty data
- Update df parser to fix error on parsing empty data
- Update free parser to fix error on parsing empty data
- Update lsblk parser to fix error on parsing empty data
- Update lsmod parser to fix error on parsing empty data
- Update mount parser to fix error on parsing empty data
- Update netstat parser to fix error on parsing empty data
- Update ntpq parser to fix error on parsing empty data
- Update ps parser to fix error on parsing empty data
- Update route parser to fix error on parsing empty data
- Update systemctl parser to fix error on parsing empty data
- Update systemctl_lj parser to fix error on parsing empty data
- Update systemctl_ls parser to fix error on parsing empty data
- Update systemctl_luf parser to fix error on parsing empty data
- Update uptime parser to fix error on parsing empty data
- Update w parser to fix error on parsing empty data
- Update xml parser to fix error on parsing empty data
- Add tests to all parsers for no data condition
- Update ss parser to fix integer fields
20200610 v1.11.4
- Update ls parser to fix error on parsing an empty directory
20200609 v1.11.3
- Add local parser plugin feature (contributed by Dean Serenevy)
20200530 v1.11.2
- Update netstat parser to add freebsd support
- Update netstat parser to add route_flags_pretty field
- Update netstat parser to change osx_inode field name to unix_inode
- Update netstat parser to change osx_flags field name to unix_flags
- Update netstat parser to strip whitespace from state field
- Update route parser to add flags_pretty field
- Update arp parser to add permanent field (freebsd and osx)
- Update arp parser to add expires field (freebsd)
- Update w parser to strip whitespace from what field
- Update last parser to fix FreeBSD issues
- Update stat parser to change osx_flags field name to unix_flags
- Update stat parser to add unix_device field for freebsd and osx
- Fix freebsd compatibility message for df, fstab, mount, ntpq, stat, and uname parsers
- Fix compatibility message for platforms that include the version number at the end (e.g. freebsd12)
20200523 v1.11.1
- Update stat command parser to change osx_flags field to string
20200522 v1.11.0
- Add dmidecode command parser
- Update stat command parser to add OSX support
- Update netstat command parser to add OSX support
- Update netstat command parser to add -r (route) functionality for linux and OSX
- Update netstat command parser to add -i (interface) functionality for linux and OSX
20200511 v1.10.12
- Remove shebang from jc/cli.py for Fedora packaging
20200511 v1.10.11
- Change file permissions for Fedora packaging
20200509 v1.10.10
- Fix ls parser issue where the first file was skipped for ls -R on some platforms
- Update last parser to handle 'gone - no logout' condition
- Update netstat parser to handle bluetooth section (ignore gracefully for now)
20200508 v1.10.9
- Add license info to vendorized ifconfig-parser class
20200508 v1.10.8
- Add license file to dist for Fedora RPM packaging requirements
- Remove tests from package to keep from polluting the global site-packages
20200501 v1.10.7
- Requirements modifications for Fedora RPM packaging requirements
20200420 v1.10.6
- Remove homebrew shim references from du osx tests
20200414 v1.10.5
- Minor change of using sys.exit(0) instead of exit()
20200412 v1.10.4
- Add color customization via JC_COLORS env variable
20200409 v1.10.3
- Fix break on pipe error
20200409 v1.10.2
- Change colors to ansi and match jello colors
20200402 v1.10.1
- Code cleanup
20200402 v1.10.0
- Add color output by default when not piping data to another program
- Add -m option for monochrome output
20200326 v1.9.3
- Add axfr support for dig command parser
20200312 v1.9.2
- Update arp parser to fix OSX detection for some edge cases
20200312 v1.9.1
- Update file command parser to make filename splitting more robust
20200311 v1.9.0
- Add ntpq command parser
- Add timedatectl status command parser
- Add airport -I and airport -s command parser
- Add file command parser
- Optimized history command parser by https://github.com/philippeitis
- Magic syntax fix for certain edge cases
20200308 v1.8.1
- CLI optimizations by https://github.com/philippeitis
- Refactored magic syntax function and added tests (https://github.com/philippeitis)
- Github actions for CI testing on multiple platforms by https://github.com/philippeitis
- Update ls parser to fix parsing error in OSX with -lR when there are empty folders
20200303 v1.8.0
- Add blkid command parser
- Add last and lastb command parser
- Add who command parser
- Add CSV file parser
- Add /etc/passwd file parser
- Add /etc/shadow file parser
- Add /etc/group file parser
- Add /etc/gshadow file parser
20200227 v1.7.5
- Update ls parser to support filenames with newline characters
20200219 v1.7.4
- Update ls parser to support multiple directories, globbing, and -R (recursive)
20200211 v1.7.3
- Add alternative 'magic' syntax: e.g. `jc ls -al`
- Options can now be condensed (e.g. -prq is equivalant to -p -r -q)
20200208 v1.7.2
- Include test fixtures in wheel and sdist
20200205 v1.7.1
- Add YAML file parser
- Add INI file parser
- Add XML file parser
- Add id parser (tested on linux and OSX)
- Add crontab file parser with user support (tested on linux)
- Add __version__ variable to parser modules
- Add exit code on error
- Update history parser to output "line" as an integer
- Update compatibility list for some parsers
- Bugfix in crontab file parser: header insertion was clobbering first row
- Just-in-time loading of parser modules instead of loading all at start
20191217 v1.6.1
- Add du parser (tested on linux and OSX)
- Add crontab parser (tested on linux and OSX)
- Add pip list parser (tested on linux and OSX)
- Add pip show parser (tested on linux and OSX)
- Add OSX support for the ifconfig, arp, df, mount, and uname parsers
- Add tests for ls, dig, ps, w, uptime on OSX
- Add about option
- Add universal parsers to refactor repetitive code
- Update ifconfig parser to output 'state' as an array
20191117 v1.5.1
- Add ss parser
- Add stat parser
- Add /etc/hosts parser
- Add /etc/fstab parser
- Add systemctl parser (includes list-jobs, list-sockets, and list-unit-files)
- Add -r and raw=True options. By default, jc will now convert numbers and boolean, if possible, and add other semantic information, while the raw output will keep all values as text and provide a more literal JSON output
- Add -q and quiet=True options to suppress warnings to stderr
- Add -d option to debug parsing issues
- Add compatibility warnings to stderr
- Add documentation
- Update iptables parser to allow --line-numbers option
- Update lsblk parser to allow parsing of added columns
- Update mount parser: changed 'access' field name to 'options'
- Update netstat parser to allow parsing of unix sockets and raw network connections
- Update w parser to fix unaligned data where blanks are possible
- Clean up code and reorganize package
20191031 v1.1.1
- Add arp parser
- Add dig parser
- Add unit tests
- fix netstat parser (remove side effects due to global variable)
20191025 v1.0.1
- Add w parser
- Add uptime parser
- Add history parser
- Flatten env parser output
- Remove problematic characters from key names in: df, free, history, lsblk, lsof, and w
- Where possible, lowercase all keys (except cases like env where the key is the variable name)
- Remove integer values
- Handle CTRL-C gracefully
20191023 v0.9.1
- Add jobs parser
- Add lsof parser
- Add lsmod parser
- No blocking if no piped data
- Better help text
- Clean up iptables parser code
20191022 v0.8.1
- Add env parser
- Add df parser
- Add free parser
- Add lsblk parser
- Add mount parser
- Add uname parser
- Add iptables parser
20191021 v0.6.4
- Flatten netstat parser output
- Clean up argument parsing
- Fix command help
20191018 v0.5.5
- Fix netstat -p parsing for Ubuntu
- Add ps parser
- Add route parser
- ls parser fixes
20191017 v0.2.0
- ifconfig, ls, and netstat support

89
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,89 @@
# Contributing to jc
We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
- Reporting a bug
- Discussing the current state of the code
- Submitting a fix
- Proposing new features
- Proposing a new parser
## We Develop with Github
We use github to host code, to track issues and feature requests, as well as accept pull requests.
## We Use Github Flow, So All Code Changes Happen Through Pull Requests
Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://guides.github.com/introduction/flow/index.html)). We actively welcome your pull requests:
1. Open an issue to discuss the new feature, bug fix, or parser before opening a pull request. For new parsers, it is important to agree upon a schema before developing the parser.
2. Fork the repo and create your branch from `dev`, if available, otherwise `master`.
3. For new parsers: Use the [`jc/parsers/foo.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/foo.py) or [`jc/parsers/foo_s.py (streaming)`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/foo_s.py) parsers as a template to get started. You can even place a new parser python module file in the [parser plugin directory](https://github.com/kellyjonbrazil/jc#custom-parsers) to get started right away with just a standard `jc` installation.
4. If you've added code that should be tested, add tests. All new parsers should have several sample outputs and tests.
5. Documentation is auto-generated from docstrings, so ensure they are clear and accurate.
6. Ensure the test suite passes. (Note: "**America/Los_Angeles**" timezone should be configured on the test system)
7. Make sure your code lints.
8. Issue that pull request!
## Parser Schema Guidelines
- Try to keep the schema as flat as possible - typically a list of flat dictionaries
- Keys should be lowercase, contain no special characters, and spaces should be converted to underscores
- Keys should be static, if possible. If they have to be dynamic, then they should not contain lists or dictionaries
This will make it easier to use tools like `jq` without requiring escaping of special characters, encapsulating key names in [""], keeps paths predictable, and makes iterating and searching for values easier.
**Examples**
Bad:
```json
{
"Interface 1": [
"192.168.1.1",
"172.16.1.1"
],
"Wifi Interface 1": [
"10.1.1.1"
]
}
```
Good:
```json
[
{
"interface": "Interface 1",
"ip_addresses": [
"192.168.1.1",
"172.16.1.1"
]
},
{
"interface": "Wifi Interface 1",
"ip_addresses": [
"10.1.1.1"
]
}
]
```
## Tests
It is essential to have good command output sample coverage and tests to keep the `jc` parser quality high.
Many parsers include calculated timestamp fields using the `jc.utils.timestamp` class. Naive timestamps created with this class should be generated on a system configured with the "**America/Los_Angeles**" timezone on linux/macOS/unix and "**Pacific Standard Time**" timezone on Windows for tests to pass on the Github Actions CI tests. This timezone should be configured on your local system before running the tests locally, as well.
## Any contributions you make will be under the MIT Software License
In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern.
## Report bugs using Github's Issues
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/kellyjonbrazil/jc/issues); it's that easy!
## Write bug reports with detail, background, and sample code
**Great Bug Reports** tend to have:
- A quick summary and/or background
- Steps to reproduce
- Be specific!
- Give sample code if you can.
- What you expected would happen
- What actually happens
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
## Use a Consistent Coding Style
* 4 spaces for indentation rather than tabs
* Use a Python linter that will enforce PEP 8 and other best practices

4112
EXAMPLES.md Normal file

File diff suppressed because it is too large Load Diff

2
LICENSE.md Executable file → Normal file
View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2019 Kelly Brazil
Copyright (c) 2020 Kelly Brazil
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

2
MANIFEST.in Normal file
View File

@@ -0,0 +1,2 @@
include man/jc.1
include CHANGELOG

2022
README.md Executable file → Normal file

File diff suppressed because it is too large Load Diff

1
_config.yml Normal file
View File

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

View File

@@ -1,43 +0,0 @@
jc changelog
20191025 v1.0.1
- Add w parser
- Add uptime parser
- Add history parser
- Fix uptime parser
- Flatten env parser output
- Remove problematic characters from key names in: df, free, history, lsblk, lsof, and w
- Where possible, lowercase all keys (except cases like env where the key is the variable name)
- Remove integer values
- Handle CTRL-C gracefully
20191023 v0.9.1
- Add jobs parser
- Add lsof parser
- Add lsmod parser
- No blocking if no piped data
- Better help text
- Clean up iptables parser code
20191022 v0.8.1
- Add env parser
- Add df parser
- Add free parser
- Add lsblk parser
- Add mount parser
- Add uname parser
- Add iptables parser
20191021 v0.6.4
- Flatten netstat parser output
- Clean up argument parsing
- Fix command help
20191018 v0.5.5
- Fix netstat -p parsing for Ubuntu
- Add ps parser
- Add route parser
- ls parser fixes
20191017 v0.2.0
- ifconfig, ls, and netstat support

134
docgen.sh Executable file
View File

@@ -0,0 +1,134 @@
#!/bin/bash
# Generate docs.md
# requires pydoc-markdown 4.6.1
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"
) &
(
echo Building docs for: lib
pydoc-markdown -m jc.lib "${toc_config}" > ../docs/lib.md; echo "+++ lib docs complete"
) &
(
echo Building docs for: utils
pydoc-markdown -m jc.utils "${toc_config}" > ../docs/utils.md; echo "+++ utils docs complete"
) &
(
echo Building docs for: streaming
pydoc-markdown -m jc.streaming "${toc_config}" > ../docs/streaming.md; echo "+++ streaming docs complete"
) &
(
echo Building docs for: universal parser
pydoc-markdown -m jc.parsers.universal "${toc_config}" > ../docs/parsers/universal.md; echo "+++ universal parser docs complete"
) &
# a bit of inception here... jc is being used to help
# automate the generation of its own documentation. :)
# pull jc parser objects into a bash array from jq
# filter out any plugin parsers
parsers=()
while read -r value
do
parsers+=("$value")
done < <(jc -a | jq -c '.parsers[] | select(.plugin != true)')
for parser in "${parsers[@]}"
do (
parser_name=$(jq -r '.name' <<< "$parser")
compatible=$(jq -r '.compatible | join(", ")' <<< "$parser")
version=$(jq -r '.version' <<< "$parser")
author=$(jq -r '.author' <<< "$parser")
author_email=$(jq -r '.author_email' <<< "$parser")
echo "Building docs for: ${parser_name}"
echo "[Home](https://kellyjonbrazil.github.io/jc/)" > ../docs/parsers/"${parser_name}".md
pydoc-markdown -m jc.parsers."${parser_name}" "${parser_config}" >> ../docs/parsers/"${parser_name}".md
echo "### Parser Information" >> ../docs/parsers/"${parser_name}".md
echo "Compatibility: ${compatible}" >> ../docs/parsers/"${parser_name}".md
echo >> ../docs/parsers/"${parser_name}".md
echo "Version ${version} by ${author} (${author_email})" >> ../docs/parsers/"${parser_name}".md
echo "+++ ${parser_name} docs complete"
) &
done
wait
echo "Document Generation Complete"

176
docs/lib.md Normal file
View File

@@ -0,0 +1,176 @@
# Table of Contents
* [jc.lib](#jc.lib)
* [parse](#jc.lib.parse)
* [parser\_mod\_list](#jc.lib.parser_mod_list)
* [plugin\_parser\_mod\_list](#jc.lib.plugin_parser_mod_list)
* [standard\_parser\_mod\_list](#jc.lib.standard_parser_mod_list)
* [streaming\_parser\_mod\_list](#jc.lib.streaming_parser_mod_list)
* [parser\_info](#jc.lib.parser_info)
* [all\_parser\_info](#jc.lib.all_parser_info)
* [get\_help](#jc.lib.get_help)
<a id="jc.lib"></a>
# jc.lib
jc - JSON Convert lib module
<a id="jc.lib.parse"></a>
### parse
```python
def parse(parser_mod_name: str,
data: Union[str, Iterable[str]],
quiet: bool = False,
raw: bool = False,
ignore_exceptions: bool = None,
**kwargs) -> Union[Dict, List[Dict], Iterator[Dict]]
```
Parse the string data using the supplied parser module.
This function provides a high-level API to simplify parser use. This
function will call built-in parsers and custom plugin parsers.
Example:
>>> import jc
>>> jc.parse('date', 'Tue Jan 18 10:23:07 PST 2022')
{'year': 2022, 'month': 'Jan', 'month_num': 1, 'day'...}
To get a list of available parser module names, use `parser_mod_list()`.
You can also use the lower-level parser modules directly:
>>> import jc.parsers.date
>>> jc.parsers.date.parse('Tue Jan 18 10:23:07 PST 2022')
Though, accessing plugin parsers directly is a bit more cumbersome, so
this higher-level API is recommended. Here is how you can access plugin
parsers without this API:
>>> import os
>>> import sys
>>> import jc.appdirs
>>> data_dir = jc.appdirs.user_data_dir('jc', 'jc')
>>> local_parsers_dir = os.path.join(data_dir, 'jcparsers')
>>> sys.path.append(local_parsers_dir)
>>> import my_custom_parser
>>> my_custom_parser.parse('command_data')
Parameters:
parser_mod_name: (string) name of the parser module. This
function will accept module_name,
cli-name, and --argument-name
variants of the module name.
data: (string or data to parse (string for normal
iterable) parsers, iterable of strings for
streaming parsers)
raw: (boolean) output preprocessed JSON if True
quiet: (boolean) suppress warning messages if True
ignore_exceptions: (boolean) ignore parsing exceptions if True
(streaming parsers only)
Returns:
Standard Parsers: Dictionary or List of Dictionaries
Streaming Parsers: Generator Object containing Dictionaries
<a id="jc.lib.parser_mod_list"></a>
### parser\_mod\_list
```python
def parser_mod_list() -> 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() -> 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() -> 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() -> List[str]
```
Returns a list of streaming parser module names. This function is a
subset of `parser_mod_list()`.
<a id="jc.lib.parser_info"></a>
### parser\_info
```python
def parser_info(parser_mod_name: str, documentation: bool = False) -> Dict
```
Returns a dictionary that includes the parser module metadata.
Parameters:
parser_mod_name: (string) name of the parser module. This
function will accept module_name,
cli-name, and --argument-name
variants of the module name.
documentation: (boolean) include parser docstring if True
<a id="jc.lib.all_parser_info"></a>
### all\_parser\_info
```python
def all_parser_info(documentation: bool = False) -> List[Dict]
```
Returns a list of dictionaries that includes metadata for all parser
modules.
Parameters:
documentation: (boolean) include parser docstrings if True
<a id="jc.lib.get_help"></a>
### get\_help
```python
def get_help(parser_mod_name: str) -> 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.

253
docs/parsers/acpi.md Normal file
View File

@@ -0,0 +1,253 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.acpi"></a>
# jc.parsers.acpi
jc - JSON Convert `acpi` command output parser
Usage (cli):
$ acpi -V | jc --acpi
or
$ jc acpi -V
Usage (module):
import jc
result = jc.parse('acpi', acpi_command_output)
Schema:
[
{
"type": string,
"id": integer,
"state": string,
"charge_percent": integer,
"until_charged": string,
"until_charged_hours": integer,
"until_charged_minuts": integer,
"until_charged_seconds": integer,
"until_charged_total_seconds": integer,
"charge_remaining": string,
"charge_remaining_hours": integer,
"charge_remaining_minutes": integer,
"charge_remaining_seconds": integer,
"charge_remaining_total_seconds": integer,
"design_capacity_mah": integer,
"last_full_capacity": integer,
"last_full_capacity_percent": integer,
"on-line": boolean,
"mode": string,
"temperature": float,
"temperature_unit": string,
"trip_points": [
{
"id": integer,
"switches_to_mode": string,
"temperature": float,
"temperature_unit": string
}
],
"messages": [
string
]
}
]
Examples:
$ acpi -V | jc --acpi -p
[
{
"type": "Battery",
"id": 0,
"state": "Charging",
"charge_percent": 71,
"until_charged": "00:29:20",
"design_capacity_mah": 2110,
"last_full_capacity": 2271,
"last_full_capacity_percent": 100,
"until_charged_hours": 0,
"until_charged_minutes": 29,
"until_charged_seconds": 20,
"until_charged_total_seconds": 1760
},
{
"type": "Adapter",
"id": 0,
"on-line": true
},
{
"type": "Thermal",
"id": 0,
"mode": "ok",
"temperature": 46.0,
"temperature_unit": "C",
"trip_points": [
{
"id": 0,
"switches_to_mode": "critical",
"temperature": 127.0,
"temperature_unit": "C"
},
{
"id": 1,
"switches_to_mode": "hot",
"temperature": 127.0,
"temperature_unit": "C"
}
]
},
{
"type": "Cooling",
"id": 0,
"messages": [
"Processor 0 of 10"
]
},
{
"type": "Cooling",
"id": 1,
"messages": [
"Processor 0 of 10"
]
},
{
"type": "Cooling",
"id": 2,
"messages": [
"x86_pkg_temp no state information available"
]
},
{
"type": "Cooling",
"id": 3,
"messages": [
"Processor 0 of 10"
]
},
{
"type": "Cooling",
"id": 4,
"messages": [
"intel_powerclamp no state information available"
]
},
{
"type": "Cooling",
"id": 5,
"messages": [
"Processor 0 of 10"
]
}
]
$ acpi -V | jc --acpi -p -r
[
{
"type": "Battery",
"id": "0",
"state": "Charging",
"charge_percent": "71",
"until_charged": "00:29:20",
"design_capacity_mah": "2110",
"last_full_capacity": "2271",
"last_full_capacity_percent": "100"
},
{
"type": "Adapter",
"id": "0",
"on-line": true
},
{
"type": "Thermal",
"id": "0",
"mode": "ok",
"temperature": "46.0",
"temperature_unit": "C",
"trip_points": [
{
"id": "0",
"switches_to_mode": "critical",
"temperature": "127.0",
"temperature_unit": "C"
},
{
"id": "1",
"switches_to_mode": "hot",
"temperature": "127.0",
"temperature_unit": "C"
}
]
},
{
"type": "Cooling",
"id": "0",
"messages": [
"Processor 0 of 10"
]
},
{
"type": "Cooling",
"id": "1",
"messages": [
"Processor 0 of 10"
]
},
{
"type": "Cooling",
"id": "2",
"messages": [
"x86_pkg_temp no state information available"
]
},
{
"type": "Cooling",
"id": "3",
"messages": [
"Processor 0 of 10"
]
},
{
"type": "Cooling",
"id": "4",
"messages": [
"intel_powerclamp no state information available"
]
},
{
"type": "Cooling",
"id": "5",
"messages": [
"Processor 0 of 10"
]
}
]
<a id="jc.parsers.acpi.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

106
docs/parsers/airport.md Normal file
View File

@@ -0,0 +1,106 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.airport"></a>
# jc.parsers.airport
jc - JSON Convert `airport -I` command output parser
The `airport` program can be found at `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport`.
Usage (cli):
$ airport -I | jc --airport
or
$ jc airport -I
Usage (module):
import jc
result = jc.parse('airport', airport_command_output)
Schema:
{
"agrctlrssi": integer,
"agrextrssi": integer,
"agrctlnoise": integer,
"agrextnoise": integer,
"state": string,
"op_mode": string,
"lasttxrate": integer,
"maxrate": integer,
"lastassocstatus": integer,
"802_11_auth": string,
"link_auth": string,
"bssid": string,
"ssid": string,
"mcs": integer,
"channel": string
}
Examples:
$ airport -I | jc --airport -p
{
"agrctlrssi": -66,
"agrextrssi": 0,
"agrctlnoise": -90,
"agrextnoise": 0,
"state": "running",
"op_mode": "station",
"lasttxrate": 195,
"maxrate": 867,
"lastassocstatus": 0,
"802_11_auth": "open",
"link_auth": "wpa2-psk",
"bssid": "3c:37:86:15:ad:f9",
"ssid": "SnazzleDazzle",
"mcs": 0,
"channel": "48,80"
}
$ airport -I | jc --airport -p -r
{
"agrctlrssi": "-66",
"agrextrssi": "0",
"agrctlnoise": "-90",
"agrextnoise": "0",
"state": "running",
"op_mode": "station",
"lasttxrate": "195",
"maxrate": "867",
"lastassocstatus": "0",
"802_11_auth": "open",
"link_auth": "wpa2-psk",
"bssid": "3c:37:86:15:ad:f9",
"ssid": "SnazzleDazzle",
"mcs": "0",
"channel": "48,80"
}
<a id="jc.parsers.airport.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: darwin
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

134
docs/parsers/airport_s.md Normal file
View File

@@ -0,0 +1,134 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.airport_s"></a>
# jc.parsers.airport\_s
jc - JSON Convert `airport -s` command output parser
The `airport` program can be found at `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport`.
Usage (cli):
$ airport -s | jc --airport-s
or
$ jc airport -s
Usage (module):
import jc
result = jc.parse('airport_s', airport_s_command_output)
Schema:
[
{
"ssid": string,
"bssid": string,
"rssi": integer,
"channel": string,
"ht": boolean,
"cc": string,
"security": [
string,
]
}
]
Examples:
$ airport -s | jc --airport-s -p
[
{
"ssid": "DIRECT-4A-HP OfficeJet 3830",
"bssid": "00:67:eb:2a:a7:3b",
"rssi": -90,
"channel": "6",
"ht": true,
"cc": "--",
"security": [
"WPA2(PSK/AES/AES)"
]
},
{
"ssid": "Latitude38",
"bssid": "c0:ff:d5:d2:7a:f3",
"rssi": -85,
"channel": "11",
"ht": true,
"cc": "US",
"security": [
"WPA2(PSK/AES/AES)"
]
},
{
"ssid": "xfinitywifi",
"bssid": "6e:e3:0e:b8:45:99",
"rssi": -83,
"channel": "11",
"ht": true,
"cc": "US",
"security": [
"NONE"
]
},
...
]
$ airport -s | jc --airport -p -r
[
{
"ssid": "DIRECT-F3-HP ENVY 5660 series",
"bssid": "b0:5a:da:6f:0a:d4",
"rssi": "-93",
"channel": "1",
"ht": "Y",
"cc": "--",
"security": "WPA2(PSK/AES/AES)"
},
{
"ssid": "YouAreInfected-5",
"bssid": "5c:e3:0e:c2:85:da",
"rssi": "-85",
"channel": "36",
"ht": "Y",
"cc": "US",
"security": "WPA(PSK/AES,TKIP/TKIP) WPA2(PSK/AES,TKIP/TKIP)"
},
{
"ssid": "YuanFamily",
"bssid": "5c:e3:0e:b8:5f:9a",
"rssi": "-84",
"channel": "11",
"ht": "Y",
"cc": "US",
"security": "WPA(PSK/AES,TKIP/TKIP) WPA2(PSK/AES,TKIP/TKIP)"
},
...
]
<a id="jc.parsers.airport_s.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: darwin
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

143
docs/parsers/arp.md Normal file
View File

@@ -0,0 +1,143 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.arp"></a>
# jc.parsers.arp
jc - JSON Convert `arp` command output parser
Supports `arp` and `arp -a` output.
Usage (cli):
$ arp | jc --arp
or
$ jc arp
Usage (module):
import jc
result = jc.parse('arp', arp_command_output)
Schema:
[
{
"name": string,
"address": string,
"hwtype": string,
"hwaddress": string,
"flags_mask": string,
"iface": string,
"permanent": boolean,
"expires": integer
}
]
Examples:
$ arp | jc --arp -p
[
{
"address": "192.168.71.254",
"hwtype": "ether",
"hwaddress": "00:50:56:f0:98:26",
"flags_mask": "C",
"iface": "ens33"
},
{
"address": "gateway",
"hwtype": "ether",
"hwaddress": "00:50:56:f7:4a:fc",
"flags_mask": "C",
"iface": "ens33"
}
]
$ arp | jc --arp -p -r
[
{
"address": "gateway",
"hwtype": "ether",
"hwaddress": "00:50:56:f7:4a:fc",
"flags_mask": "C",
"iface": "ens33"
},
{
"address": "192.168.71.254",
"hwtype": "ether",
"hwaddress": "00:50:56:fe:7a:b4",
"flags_mask": "C",
"iface": "ens33"
}
]
$ arp -a | jc --arp -p
[
{
"name": null,
"address": "192.168.71.254",
"hwtype": "ether",
"hwaddress": "00:50:56:f0:98:26",
"iface": "ens33"
"permanent": false,
"expires": 1182
},
{
"name": "gateway",
"address": "192.168.71.2",
"hwtype": "ether",
"hwaddress": "00:50:56:f7:4a:fc",
"iface": "ens33"
"permanent": false,
"expires": 110
}
]
$ arp -a | jc --arp -p -r
[
{
"name": "?",
"address": "192.168.71.254",
"hwtype": "ether",
"hwaddress": "00:50:56:fe:7a:b4",
"iface": "ens33"
"permanent": false,
"expires": "1182"
},
{
"name": "_gateway",
"address": "192.168.71.2",
"hwtype": "ether",
"hwaddress": "00:50:56:f7:4a:fc",
"iface": "ens33"
"permanent": false,
"expires": "110"
}
]
<a id="jc.parsers.arp.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, aix, freebsd, darwin
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,139 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.asciitable"></a>
# jc.parsers.asciitable
jc - JSON Convert `asciitable` parser
This parser converts ASCII and Unicode text tables with single-line rows.
Column headers must be at least two spaces apart from each other and must
be unique.
For example:
╒══════════╤═════════╤════════╕
│ foo │ bar │ baz │
╞══════════╪═════════╪════════╡
│ good day │ │ 12345 │
├──────────┼─────────┼────────┤
│ hi there │ abc def │ 3.14 │
╘══════════╧═════════╧════════╛
or
+-----------------------------+
| foo bar baz |
+-----------------------------+
| good day 12345 |
| hi there abc def 3.14 |
+-----------------------------+
or
| foo | bar | baz |
|----------|---------|--------|
| good day | | 12345 |
| hi there | abc def | 3.14 |
or
foo bar baz
--------- -------- ------
good day 12345
hi there abc def 3.14
or
foo bar baz
good day 12345
hi there abc def 3.14
etc...
Headers (keys) are converted to snake-case. All values are returned as
strings, except empty strings, which are converted to None/null.
Usage (cli):
$ cat table.txt | jc --asciitable
Usage (module):
import jc
result = jc.parse('asciitable', asciitable_string)
Schema:
[
{
"column_name1": string, # empty string is null
"column_name2": string # empty string is null
}
]
Examples:
$ echo '
> ╒══════════╤═════════╤════════╕
> │ foo │ bar │ baz │
> ╞══════════╪═════════╪════════╡
> │ good day │ │ 12345 │
> ├──────────┼─────────┼────────┤
> │ hi there │ abc def │ 3.14 │
> ╘══════════╧═════════╧════════╛' | jc --asciitable -p
[
{
"foo": "good day",
"bar": null,
"baz": "12345"
},
{
"foo": "hi there",
"bar": "abc def",
"baz": "3.14"
}
]
$ echo '
> foo bar baz
> --------- -------- ------
> good day 12345
> hi there abc def 3.14' | jc --asciitable -p
[
{
"foo": "good day",
"bar": null,
"baz": "12345"
},
{
"foo": "hi there",
"bar": "abc def",
"baz": "3.14"
}
]
<a id="jc.parsers.asciitable.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

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

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

@@ -0,0 +1,146 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.blkid"></a>
# jc.parsers.blkid
jc - JSON Convert `blkid` command output parser
Usage (cli):
$ blkid | jc --blkid
or
$ jc blkid
Usage (module):
import jc
result = jc.parse('blkid', blkid_command_output)
Schema:
[
{
"device": string,
"uuid": string,
"type": string,
"usage": string,
"part_entry_scheme": string,
"part_entry_type": string,
"part_entry_flags": string,
"part_entry_number": integer,
"part_entry_offset": integer,
"part_entry_size": integer,
"part_entry_disk": string,
"id_fs_uuid": string,
"id_fs_uuid_enc": string,
"id_fs_version": string,
"id_fs_type": string,
"id_fs_usage": string,
"id_part_entry_scheme": string,
"id_part_entry_type": string,
"id_part_entry_flags": string,
"id_part_entry_number": integer,
"id_part_entry_offset": integer,
"id_part_entry_size": integer,
"id_iolimit_minimum_io_size": integer,
"id_iolimit_physical_sector_size": integer,
"id_iolimit_logical_sector_size": integer,
"id_part_entry_disk": string,
"minimum_io_size": integer,
"physical_sector_size": integer,
"logical_sector_size": integer
}
]
Examples:
$ blkid | jc --blkid -p
[
{
"device": "/dev/sda1",
"uuid": "05d927ab-5875-49e4-ada1-7f46cb32c932",
"type": "xfs"
},
{
"device": "/dev/sda2",
"uuid": "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM",
"type": "LVM2_member"
},
{
"device": "/dev/mapper/centos-root",
"uuid": "07d718ff-950c-4e5b-98f0-42a1147c77d9",
"type": "xfs"
},
{
"device": "/dev/mapper/centos-swap",
"uuid": "615eb89a-bcbf-46fd-80e3-c483ff5c931f",
"type": "swap"
}
]
$ sudo blkid -o udev -ip /dev/sda2 | jc --blkid -p
[
{
"id_fs_uuid": "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM",
"id_fs_uuid_enc": "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM",
"id_fs_version": "LVM2\\x20001",
"id_fs_type": "LVM2_member",
"id_fs_usage": "raid",
"id_iolimit_minimum_io_size": 512,
"id_iolimit_physical_sector_size": 512,
"id_iolimit_logical_sector_size": 512,
"id_part_entry_scheme": "dos",
"id_part_entry_type": "0x8e",
"id_part_entry_number": 2,
"id_part_entry_offset": 2099200,
"id_part_entry_size": 39843840,
"id_part_entry_disk": "8:0"
}
]
$ sudo blkid -ip /dev/sda1 | jc --blkid -p -r
[
{
"devname": "/dev/sda1",
"uuid": "05d927bb-5875-49e3-ada1-7f46cb31c932",
"type": "xfs",
"usage": "filesystem",
"minimum_io_size": "512",
"physical_sector_size": "512",
"logical_sector_size": "512",
"part_entry_scheme": "dos",
"part_entry_type": "0x83",
"part_entry_flags": "0x80",
"part_entry_number": "1",
"part_entry_offset": "2048",
"part_entry_size": "2097152",
"part_entry_disk": "8:0"
}
]
<a id="jc.parsers.blkid.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

80
docs/parsers/cksum.md Normal file
View File

@@ -0,0 +1,80 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.cksum"></a>
# jc.parsers.cksum
jc - JSON Convert `cksum` command output parser
This parser works with the following checksum calculation utilities:
- `sum`
- `cksum`
Usage (cli):
$ cksum file.txt | jc --cksum
or
$ jc cksum file.txt
Usage (module):
import jc
result = jc.parse('cksum', cksum_command_output)
Schema:
[
{
"filename": string,
"checksum": integer,
"blocks": integer
}
]
Examples:
$ cksum * | jc --cksum -p
[
{
"filename": "__init__.py",
"checksum": 4294967295,
"blocks": 0
},
{
"filename": "airport.py",
"checksum": 2208551092,
"blocks": 3745
},
{
"filename": "airport_s.py",
"checksum": 1113817598,
"blocks": 4572
},
...
]
<a id="jc.parsers.cksum.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,199 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.crontab"></a>
# jc.parsers.crontab
jc - JSON Convert `crontab -l` command output and crontab
file parser
Supports `crontab -l` command output and crontab files.
Usage (cli):
$ crontab -l | jc --crontab
or
$ jc crontab -l
Usage (module):
import jc
result = jc.parse('crontab', crontab_output)
Schema:
{
"variables": [
{
"name": string,
"value": string
}
],
"schedule": [
{
"occurrence" string,
"minute": [
string
],
"hour": [
string
],
"day_of_month": [
string
],
"month": [
string
],
"day_of_week": [
string
],
"occurrence": string,
"command": string
}
]
}
Examples:
$ crontab -l | jc --crontab -p
{
"variables": [
{
"name": "MAILTO",
"value": "root"
},
{
"name": "PATH",
"value": "/sbin:/bin:/usr/sbin:/usr/bin"
},
{
"name": "SHELL",
"value": "/bin/bash"
}
],
"schedule": [
{
"minute": [
"5"
],
"hour": [
"10-11",
"22"
],
"day_of_month": [
"*"
],
"month": [
"*"
],
"day_of_week": [
"*"
],
"command": "/var/www/devdaily.com/bin/mk-new-links.php"
},
{
"minute": [
"30"
],
"hour": [
"4/2"
],
"day_of_month": [
"*"
],
"month": [
"*"
],
"day_of_week": [
"*"
],
"command": "/var/www/devdaily.com/bin/create-all-backups.sh"
},
{
"occurrence": "yearly",
"command": "/home/maverick/bin/annual-maintenance"
},
{
"occurrence": "reboot",
"command": "/home/cleanup"
},
{
"occurrence": "monthly",
"command": "/home/maverick/bin/tape-backup"
}
]
}
$ cat /etc/crontab | jc --crontab -p -r
{
"variables": [
{
"name": "MAILTO",
"value": "root"
},
{
"name": "PATH",
"value": "/sbin:/bin:/usr/sbin:/usr/bin"
},
{
"name": "SHELL",
"value": "/bin/bash"
}
],
"schedule": [
{
"minute": "5",
"hour": "10-11,22",
"day_of_month": "*",
"month": "*",
"day_of_week": "*",
"command": "/var/www/devdaily.com/bin/mk-new-links.php"
},
{
"minute": "30",
"hour": "4/2",
"day_of_month": "*",
"month": "*",
"day_of_week": "*",
"command": "/var/www/devdaily.com/bin/create-all-backups.sh"
},
{
"occurrence": "yearly",
"command": "/home/maverick/bin/annual-maintenance"
},
{
"occurrence": "reboot",
"command": "/home/cleanup"
},
{
"occurrence": "monthly",
"command": "/home/maverick/bin/tape-backup"
}
]
}
<a id="jc.parsers.crontab.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, aix, freebsd
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

196
docs/parsers/crontab_u.md Normal file
View File

@@ -0,0 +1,196 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.crontab_u"></a>
# jc.parsers.crontab\_u
jc - JSON Convert `crontab -l` command output and crontab
file parser
This version of the `crontab -l` parser supports output that contains user
information for processes.
Usage (cli):
$ crontab -l | jc --crontab-u
Usage (module):
import jc
result = jc.parse('crontab_u', crontab_u_output)
Schema:
{
"variables": [
{
"name": string,
"value": string
}
],
"schedule": [
{
"occurrence" string,
"minute": [
string
],
"hour": [
string
],
"day_of_month": [
string
],
"month": [
string
],
"day_of_week": [
string
],
"occurrence": string,
"user": string,
"command": string
}
]
}
Examples:
$ cat /etc/crontab | jc --crontab-u -p
{
"variables": [
{
"name": "PATH",
"value": "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sb..."
},
{
"name": "SHELL",
"value": "/bin/sh"
}
],
"schedule": [
{
"minute": [
"25"
],
"hour": [
"6"
],
"day_of_month": [
"*"
],
"month": [
"*"
],
"day_of_week": [
"*"
],
"user": "root",
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
},
{
"minute": [
"47"
],
"hour": [
"6"
],
"day_of_month": [
"*"
],
"month": [
"*"
],
"day_of_week": [
"7"
],
"user": "root",
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
},
{
"minute": [
"52"
],
"hour": [
"6"
],
"day_of_month": [
"1"
],
"month": [
"*"
],
"day_of_week": [
"*"
],
"user": "root",
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
}
]
}
$ cat /etc/crontab | jc --crontab-u -p -r
{
"variables": [
{
"name": "PATH",
"value": "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/..."
},
{
"name": "SHELL",
"value": "/bin/sh"
}
],
"schedule": [
{
"minute": "25",
"hour": "6",
"day_of_month": "*",
"month": "*",
"day_of_week": "*",
"user": "root",
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
},
{
"minute": "47",
"hour": "6",
"day_of_month": "*",
"month": "*",
"day_of_week": "7",
"user": "root",
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
},
{
"minute": "52",
"hour": "6",
"day_of_month": "1",
"month": "*",
"day_of_week": "*",
"user": "root",
"command": "test -x /usr/sbin/anacron || ( cd / && run-parts ..."
}
]
}
<a id="jc.parsers.crontab_u.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, aix, freebsd
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

103
docs/parsers/csv.md Normal file
View File

@@ -0,0 +1,103 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.csv"></a>
# jc.parsers.csv
jc - JSON Convert `csv` file parser
The `csv` parser will attempt to automatically detect the delimiter
character. If the delimiter cannot be detected it will default to comma.
The first row of the file must be a header row.
Usage (cli):
$ cat file.csv | jc --csv
Usage (module):
import jc
result = jc.parse('csv', csv_output)
Schema:
csv file converted to a Dictionary:
https://docs.python.org/3/library/csv.html
[
{
"column_name1": string,
"column_name2": string
}
]
Examples:
$ cat homes.csv
"Sell", "List", "Living", "Rooms", "Beds", "Baths", "Age", "Acres"...
142, 160, 28, 10, 5, 3, 60, 0.28, 3167
175, 180, 18, 8, 4, 1, 12, 0.43, 4033
129, 132, 13, 6, 3, 1, 41, 0.33, 1471
...
$ cat homes.csv | jc --csv -p
[
{
"Sell": "142",
"List": "160",
"Living": "28",
"Rooms": "10",
"Beds": "5",
"Baths": "3",
"Age": "60",
"Acres": "0.28",
"Taxes": "3167"
},
{
"Sell": "175",
"List": "180",
"Living": "18",
"Rooms": "8",
"Beds": "4",
"Baths": "1",
"Age": "12",
"Acres": "0.43",
"Taxes": "4033"
},
{
"Sell": "129",
"List": "132",
"Living": "13",
"Rooms": "6",
"Beds": "3",
"Baths": "1",
"Age": "41",
"Acres": "0.33",
"Taxes": "1471"
},
...
]
<a id="jc.parsers.csv.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

93
docs/parsers/csv_s.md Normal file
View File

@@ -0,0 +1,93 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.csv_s"></a>
# jc.parsers.csv\_s
jc - JSON Convert `csv` file streaming parser
> This streaming parser outputs JSON Lines (cli) or returns a Generator
iterator of Dictionaries (module)
The `csv` streaming parser will attempt to automatically detect the
delimiter character. If the delimiter cannot be detected it will default
to comma. The first row of the file must be a header row.
Note: The first 100 rows are read into memory to enable delimiter detection,
then the rest of the rows are loaded lazily.
Usage (cli):
$ cat file.csv | jc --csv-s
Usage (module):
import jc
result = jc.parse('csv_s', csv_output.splitlines())
for item in result:
# do something
Schema:
csv file converted to a Dictionary:
https://docs.python.org/3/library/csv.html
{
"column_name1": string,
"column_name2": string,
# below object only exists if using -qq or ignore_exceptions=True
"_jc_meta": {
"success": boolean, # false if error parsing
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
}
Examples:
$ cat homes.csv
"Sell", "List", "Living", "Rooms", "Beds", "Baths", "Age", "Acres"...
142, 160, 28, 10, 5, 3, 60, 0.28, 3167
175, 180, 18, 8, 4, 1, 12, 0.43, 4033
129, 132, 13, 6, 3, 1, 41, 0.33, 1471
...
$ cat homes.csv | jc --csv-s
{"Sell":"142","List":"160","Living":"28","Rooms":"10","Beds":"5"...}
{"Sell":"175","List":"180","Living":"18","Rooms":"8","Beds":"4"...}
{"Sell":"129","List":"132","Living":"13","Rooms":"6","Beds":"3"...}
...
<a id="jc.parsers.csv_s.parse"></a>
### parse
```python
@add_jc_meta
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
```
Main text parsing generator function. Returns an iterator object.
Parameters:
data: (iterable) line-based text data to parse
(e.g. sys.stdin or str.splitlines())
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
ignore_exceptions: (boolean) ignore parsing exceptions if True
Yields:
Dictionary. Raw or processed structured data.
Returns:
Iterator object (generator)
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

103
docs/parsers/date.md Normal file
View File

@@ -0,0 +1,103 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.date"></a>
# jc.parsers.date
jc - JSON Convert `date` command output parser
The `epoch` calculated timestamp field is naive. (i.e. based on the local
time of the system the parser is run on)
The `epoch_utc` calculated timestamp field is timezone-aware and is only
available if the timezone field is UTC.
Usage (cli):
$ date | jc --date
or
$ jc date
Usage (module):
import jc
result = jc.parse('date', date_command_output)
Schema:
{
"year": integer,
"month": string,
"month_num": integer,
"day": integer,
"weekday": string,
"weekday_num": integer,
"hour": integer,
"hour_24": integer,
"minute": integer,
"second": integer,
"period": string,
"timezone": string,
"utc_offset": string, # null if timezone field is not UTC
"day_of_year": integer,
"week_of_year": integer,
"iso": string,
"epoch": integer, # [0]
"epoch_utc": integer, # [1]
"timezone_aware": boolean # [2]
}
[0] naive timestamp
[1] timezone-aware timestamp. Only available if timezone field is UTC
[2] if true, all fields are correctly based on UTC
Examples:
$ date | jc --date -p
{
"year": 2021,
"month": "Mar",
"month_num": 3,
"day": 25,
"weekday": "Thu",
"weekday_num": 4,
"hour": 2,
"hour_24": 2,
"minute": 2,
"second": 26,
"period": "AM",
"timezone": "UTC",
"utc_offset": "+0000",
"day_of_year": 84,
"week_of_year": 12,
"iso": "2021-03-25T02:02:26+00:00",
"epoch": 1616662946,
"epoch_utc": 1616637746,
"timezone_aware": true
}
<a id="jc.parsers.date.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, freebsd
Version 2.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,123 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.df"></a>
# jc.parsers.df
jc - JSON Convert `df` command output parser
Usage (cli):
$ df | jc --df
or
$ jc df
Usage (module):
import jc
result = jc.parse('df', df_command_output)
Schema:
[
{
"filesystem": string,
"size": string,
"1k_blocks": integer,
"512_blocks": integer,
"used": integer,
"available": integer,
"capacity_percent": integer,
"ifree": integer,
"iused": integer,
"use_percent": integer,
"iused_percent": integer,
"mounted_on": string
}
]
Examples:
$ df | jc --df -p
[
{
"filesystem": "devtmpfs",
"1k_blocks": 1918820,
"used": 0,
"available": 1918820,
"use_percent": 0,
"mounted_on": "/dev"
},
{
"filesystem": "tmpfs",
"1k_blocks": 1930668,
"used": 0,
"available": 1930668,
"use_percent": 0,
"mounted_on": "/dev/shm"
},
{
"filesystem": "tmpfs",
"1k_blocks": 1930668,
"used": 11800,
"available": 1918868,
"use_percent": 1,
"mounted_on": "/run"
},
...
]
$ df | jc --df -p -r
[
{
"filesystem": "devtmpfs",
"1k_blocks": "1918820",
"used": "0",
"available": "1918820",
"use_percent": "0%",
"mounted_on": "/dev"
},
{
"filesystem": "tmpfs",
"1k_blocks": "1930668",
"used": "0",
"available": "1930668",
"use_percent": "0%",
"mounted_on": "/dev/shm"
},
{
"filesystem": "tmpfs",
"1k_blocks": "1930668",
"used": "11800",
"available": "1918868",
"use_percent": "1%",
"mounted_on": "/run"
},
...
]
<a id="jc.parsers.df.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, freebsd
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)

348
docs/parsers/dig.md Normal file
View File

@@ -0,0 +1,348 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.dig"></a>
# jc.parsers.dig
jc - JSON Convert `dig` command output parser
Options supported:
- `+noall +answer` options are supported in cases where only the answer
information is desired.
- `+axfr` option is supported on its own
The `when_epoch` calculated timestamp field is naive. (i.e. based on the
local time of the system the parser is run on)
The `when_epoch_utc` calculated timestamp field is timezone-aware and is
only available if the timezone field is UTC.
Usage (cli):
$ dig example.com | jc --dig
or
$ jc dig example.com
Usage (module):
import jc
result = jc.parse('dig', dig_command_output)
Schema:
[
{
"id": integer,
"opcode": string,
"status": string,
"flags": [
string
],
"query_num": integer,
"answer_num": integer,
"authority_num": integer,
"additional_num": integer,
"axfr": [
{
"name": string,
"class": string,
"type": string,
"ttl": integer,
"data": string
}
],
"opt_pseudosection": {
"edns": {
"version": integer,
"flags": [
string
],
"udp": integer
},
"cookie": string
},
"question": {
"name": string,
"class": string,
"type": string
},
"answer": [
{
"name": string,
"class": string,
"type": string,
"ttl": integer,
"data": string
}
],
"additional": [
{
"name": string,
"class": string,
"type": string,
"ttl": integer,
"data": string
}
],
"authority": [
{
"name": string,
"class": string,
"type": string,
"ttl": integer,
"data": string
}
],
"query_size": integer,
"query_time": integer, # in msec
"server": string,
"when": string,
"when_epoch": integer, # [0]
"when_epoch_utc": integer, # [1]
"rcvd": integer
"size": string
}
]
[0] naive timestamp if "when" field is parsable, else null
[1] timezone aware timestamp availabe for UTC, else null
Examples:
$ dig example.com | jc --dig -p
[
{
"id": 2951,
"opcode": "QUERY",
"status": "NOERROR",
"flags": [
"qr",
"rd",
"ra"
],
"query_num": 1,
"answer_num": 1,
"authority_num": 0,
"additional_num": 1,
"opt_pseudosection": {
"edns": {
"version": 0,
"flags": [],
"udp": 4096
}
},
"question": {
"name": "example.com.",
"class": "IN",
"type": "A"
},
"answer": [
{
"name": "example.com.",
"class": "IN",
"type": "A",
"ttl": 39302,
"data": "93.184.216.34"
}
],
"query_time": 49,
"server": "2600:1700:bab0:d40::1#53(2600:1700:bab0:d40::1)",
"when": "Fri Apr 16 16:05:10 PDT 2021",
"rcvd": 56,
"when_epoch": 1618614310,
"when_epoch_utc": null
}
]
$ dig cnn.com www.cnn.com @205.251.194.64 | jc --dig -p -r
[
{
"id": "46052",
"opcode": "QUERY",
"status": "NOERROR",
"flags": [
"qr",
"rd",
"ra"
],
"query_num": "1",
"answer_num": "1",
"authority_num": "0",
"additional_num": "1",
"opt_pseudosection": {
"edns": {
"version": "0",
"flags": [],
"udp": "4096"
}
},
"question": {
"name": "example.com.",
"class": "IN",
"type": "A"
},
"answer": [
{
"name": "example.com.",
"class": "IN",
"type": "A",
"ttl": "40426",
"data": "93.184.216.34"
}
],
"query_time": "48 msec",
"server": "2600:1700:bab0:d40::1#53(2600:1700:bab0:d40::1)",
"when": "Fri Apr 16 16:06:12 PDT 2021",
"rcvd": "56"
}
]
$ dig -x 1.1.1.1 | jc --dig -p
[
{
"id": 20785,
"opcode": "QUERY",
"status": "NOERROR",
"flags": [
"qr",
"rd",
"ra"
],
"query_num": 1,
"answer_num": 1,
"authority_num": 0,
"additional_num": 1,
"opt_pseudosection": {
"edns": {
"version": 0,
"flags": [],
"udp": 4096
}
},
"question": {
"name": "1.1.1.1.in-addr.arpa.",
"class": "IN",
"type": "PTR"
},
"answer": [
{
"name": "1.1.1.1.in-addr.arpa.",
"class": "IN",
"type": "PTR",
"ttl": 1800,
"data": "one.one.one.one."
}
],
"query_time": 40,
"server": "2600:1700:bab0:d40::1#53(2600:1700:bab0:d40::1)",
"when": "Sat Apr 17 14:50:50 PDT 2021",
"rcvd": 78,
"when_epoch": 1618696250,
"when_epoch_utc": null
}
]
$ dig -x 1.1.1.1 | jc --dig -p -r
[
{
"id": "32644",
"opcode": "QUERY",
"status": "NOERROR",
"flags": [
"qr",
"rd",
"ra"
],
"query_num": "1",
"answer_num": "1",
"authority_num": "0",
"additional_num": "1",
"opt_pseudosection": {
"edns": {
"version": "0",
"flags": [],
"udp": "4096"
}
},
"question": {
"name": "1.1.1.1.in-addr.arpa.",
"class": "IN",
"type": "PTR"
},
"answer": [
{
"name": "1.1.1.1.in-addr.arpa.",
"class": "IN",
"type": "PTR",
"ttl": "1800",
"data": "one.one.one.one."
}
],
"query_time": "52 msec",
"server": "2600:1700:bab0:d40::1#53(2600:1700:bab0:d40::1)",
"when": "Sat Apr 17 14:51:46 PDT 2021",
"rcvd": "78"
}
]
$ dig +noall +answer cnn.com | jc --dig -p
[
{
"answer": [
{
"name": "cnn.com.",
"class": "IN",
"type": "A",
"ttl": 60,
"data": "151.101.193.67"
},
{
"name": "cnn.com.",
"class": "IN",
"type": "A",
"ttl": 60,
"data": "151.101.65.67"
},
{
"name": "cnn.com.",
"class": "IN",
"type": "A",
"ttl": 60,
"data": "151.101.1.67"
},
{
"name": "cnn.com.",
"class": "IN",
"type": "A",
"ttl": 60,
"data": "151.101.129.67"
}
]
}
]
<a id="jc.parsers.dig.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, aix, freebsd, darwin, win32, cygwin
Version 2.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,146 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.dir"></a>
# jc.parsers.dir
jc - JSON Convert `dir` command output parser
Options supported:
- `/T timefield`
- `/O sortorder`
- `/C, /-C`
- `/S`
The "Magic" syntax is not supported since the `dir` command is a shell
builtin.
The `epoch` calculated timestamp field is naive. (i.e. based on the local
time of the system the parser is run on)
Usage (cli):
C:> dir | jc --dir
Usage (module):
import jc
result = jc.parse('dir', dir_command_output)
Schema:
[
{
"date": string,
"time": string,
"epoch": integer, # naive timestamp
"dir": boolean,
"size": integer,
"filename: string,
"parent": string
}
]
Examples:
C:> dir | jc --dir -p
[
{
"date": "03/24/2021",
"time": "03:15 PM",
"dir": true,
"size": null,
"filename": ".",
"parent": "C:\\Program Files\\Internet Explorer",
"epoch": 1616624100
},
{
"date": "03/24/2021",
"time": "03:15 PM",
"dir": true,
"size": null,
"filename": "..",
"parent": "C:\\Program Files\\Internet Explorer",
"epoch": 1616624100
},
{
"date": "12/07/2019",
"time": "02:49 AM",
"dir": true,
"size": null,
"filename": "en-US",
"parent": "C:\\Program Files\\Internet Explorer",
"epoch": 1575715740
},
{
"date": "12/07/2019",
"time": "02:09 AM",
"dir": false,
"size": 54784,
"filename": "ExtExport.exe",
"parent": "C:\\Program Files\\Internet Explorer",
"epoch": 1575713340
},
...
]
C:> dir | jc --dir -p -r
[
{
"date": "03/24/2021",
"time": "03:15 PM",
"dir": true,
"size": null,
"filename": ".",
"parent": "C:\\Program Files\\Internet Explorer"
},
{
"date": "03/24/2021",
"time": "03:15 PM",
"dir": true,
"size": null,
"filename": "..",
"parent": "C:\\Program Files\\Internet Explorer"
},
{
"date": "12/07/2019",
"time": "02:49 AM",
"dir": true,
"size": null,
"filename": "en-US",
"parent": "C:\\Program Files\\Internet Explorer"
},
{
"date": "12/07/2019",
"time": "02:09 AM",
"dir": false,
"size": "54,784",
"filename": "ExtExport.exe",
"parent": "C:\\Program Files\\Internet Explorer"
},
...
]
<a id="jc.parsers.dir.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: win32
Version 1.5 by Rasheed Elsaleh (rasheed@rebelliondefense.com)

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

@@ -0,0 +1,151 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.dmidecode"></a>
# jc.parsers.dmidecode
jc - JSON Convert `dmidecode` command output parser
Usage (cli):
$ dmidecode | jc --dmidecode
or
$ jc dmidecode
Usage (module):
import jc
result = jc.parse('dmidecode', dmidecode_command_output)
Schema:
[
{
"handle": string,
"type": integer,
"bytes": integer,
"description": string,
"values": { # null if empty
"lowercase_no_spaces_keys": string,
"multiline_key_values": [
string,
]
}
}
]
Examples:
# dmidecode | jc --dmidecode -p
[
{
"handle": "0x0000",
"type": 0,
"bytes": 24,
"description": "BIOS Information",
"values": {
"vendor": "Phoenix Technologies LTD",
"version": "6.00",
"release_date": "04/13/2018",
"address": "0xEA490",
"runtime_size": "88944 bytes",
"rom_size": "64 kB",
"characteristics": [
"ISA is supported",
"PCI is supported",
"PC Card (PCMCIA) is supported",
"PNP is supported",
"APM is supported",
"BIOS is upgradeable",
"BIOS shadowing is allowed",
"ESCD support is available",
"Boot from CD is supported",
"Selectable boot is supported",
"EDD is supported",
"Print screen service is supported (int 5h)",
"8042 keyboard services are supported (int 9h)",
"Serial services are supported (int 14h)",
"Printer services are supported (int 17h)",
"CGA/mono video services are supported (int 10h)",
"ACPI is supported",
"Smart battery is supported",
"BIOS boot specification is supported",
"Function key-initiated network boot is supported",
"Targeted content distribution is supported"
],
"bios_revision": "4.6",
"firmware_revision": "0.0"
}
},
...
]
# dmidecode | jc --dmidecode -p -r
[
{
"handle": "0x0000",
"type": "0",
"bytes": "24",
"description": "BIOS Information",
"values": {
"vendor": "Phoenix Technologies LTD",
"version": "6.00",
"release_date": "04/13/2018",
"address": "0xEA490",
"runtime_size": "88944 bytes",
"rom_size": "64 kB",
"characteristics": [
"ISA is supported",
"PCI is supported",
"PC Card (PCMCIA) is supported",
"PNP is supported",
"APM is supported",
"BIOS is upgradeable",
"BIOS shadowing is allowed",
"ESCD support is available",
"Boot from CD is supported",
"Selectable boot is supported",
"EDD is supported",
"Print screen service is supported (int 5h)",
"8042 keyboard services are supported (int 9h)",
"Serial services are supported (int 14h)",
"Printer services are supported (int 17h)",
"CGA/mono video services are supported (int 10h)",
"ACPI is supported",
"Smart battery is supported",
"BIOS boot specification is supported",
"Function key-initiated network boot is supported",
"Targeted content distribution is supported"
],
"bios_revision": "4.6",
"firmware_revision": "0.0"
}
},
...
]
<a id="jc.parsers.dmidecode.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

157
docs/parsers/dpkg_l.md Normal file
View File

@@ -0,0 +1,157 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.dpkg_l"></a>
# jc.parsers.dpkg\_l
jc - JSON Convert `dpkg -l` command output parser
Set the `COLUMNS` environment variable to a large value to avoid field
truncation. For example:
$ COLUMNS=500 dpkg -l | jc --dpkg-l
Usage (cli):
$ dpkg -l | jc --dpkg-l
or
$ jc dpkg -l
Usage (module):
import jc
result = jc.parse('dpkg_l', dpkg_command_output)
Schema:
[
{
"codes": string,
"name": string,
"version": string,
"architecture": string,
"description": string,
"desired": string,
"status": string,
"error": string
}
]
Examples:
$ dpkg -l | jc --dpkg-l -p
[
{
"codes": "ii",
"name": "accountsservice",
"version": "0.6.45-1ubuntu1.3",
"architecture": "amd64",
"description": "query and manipulate user account information",
"desired": "install",
"status": "installed"
},
{
"codes": "rc",
"name": "acl",
"version": "2.2.52-3build1",
"architecture": "amd64",
"description": "Access control list utilities",
"desired": "remove",
"status": "config-files"
},
{
"codes": "uWR",
"name": "acpi",
"version": "1.7-1.1",
"architecture": "amd64",
"description": "displays information on ACPI devices",
"desired": "unknown",
"status": "trigger await",
"error": "reinstall required"
},
{
"codes": "rh",
"name": "acpid",
"version": "1:2.0.28-1ubuntu1",
"architecture": "amd64",
"description": "Advanced Configuration and Power Interface...",
"desired": "remove",
"status": "half installed"
},
{
"codes": "pn",
"name": "adduser",
"version": "3.116ubuntu1",
"architecture": "all",
"description": "add and remove users and groups",
"desired": "purge",
"status": "not installed"
},
...
]
$ dpkg -l | jc --dpkg-l -p -r
[
{
"codes": "ii",
"name": "accountsservice",
"version": "0.6.45-1ubuntu1.3",
"architecture": "amd64",
"description": "query and manipulate user account information"
},
{
"codes": "rc",
"name": "acl",
"version": "2.2.52-3build1",
"architecture": "amd64",
"description": "Access control list utilities"
},
{
"codes": "uWR",
"name": "acpi",
"version": "1.7-1.1",
"architecture": "amd64",
"description": "displays information on ACPI devices"
},
{
"codes": "rh",
"name": "acpid",
"version": "1:2.0.28-1ubuntu1",
"architecture": "amd64",
"description": "Advanced Configuration and Power Interface..."
},
{
"codes": "pn",
"name": "adduser",
"version": "3.116ubuntu1",
"architecture": "all",
"description": "add and remove users and groups"
},
...
]
<a id="jc.parsers.dpkg_l.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,113 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.du"></a>
# jc.parsers.du
jc - JSON Convert `du` command output parser
Usage (cli):
$ du | jc --du
or
$ jc du
Usage (module):
import jc
result = jc.parse('du', du_command_output)
Schema:
[
{
"size": integer,
"name": string
}
]
Examples:
$ du /usr | jc --du -p
[
{
"size": 104608,
"name": "/usr/bin"
},
{
"size": 56,
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
},
{
"size": 0,
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
},
{
"size": 0,
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
},
{
"size": 0,
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
},
{
"size": 1008,
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
},
...
]
$ du /usr | jc --du -p -r
[
{
"size": "104608",
"name": "/usr/bin"
},
{
"size": "56",
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
},
{
"size": "0",
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
},
{
"size": "0",
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
},
{
"size": "0",
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
},
{
"size": "1008",
"name": "/usr/standalone/firmware/iBridge1_1Customer.bundle/..."
},
...
]
<a id="jc.parsers.du.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, aix, freebsd
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,99 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.env"></a>
# jc.parsers.env
jc - JSON Convert `env` and `printenv` command output parser
This parser will output a list of dictionaries each containing `name` and
`value` keys. If you would like a simple dictionary output, then use the
`-r` command-line option or the `raw=True` argument in the `parse()`
function.
Usage (cli):
$ env | jc --env
or
$ jc env
Usage (module):
import jc
result = jc.parse('env', env_command_output)
Schema:
[
{
"name": string,
"value": string
}
]
Examples:
$ env | jc --env -p
[
{
"name": "XDG_SESSION_ID",
"value": "1"
},
{
"name": "HOSTNAME",
"value": "localhost.localdomain"
},
{
"name": "TERM",
"value": "vt220"
},
{
"name": "SHELL",
"value": "/bin/bash"
},
{
"name": "HISTSIZE",
"value": "1000"
},
...
]
$ env | jc --env -p -r
{
"TERM": "xterm-256color",
"SHELL": "/bin/bash",
"USER": "root",
"PATH": "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",
"PWD": "/root",
"LANG": "en_US.UTF-8",
"HOME": "/root",
"LOGNAME": "root",
"_": "/usr/bin/env"
}
<a id="jc.parsers.env.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary of raw structured data or
List of Dictionaries of processed structured data
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

88
docs/parsers/file.md Normal file
View File

@@ -0,0 +1,88 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.file"></a>
# jc.parsers.file
jc - JSON Convert `file` command output parser
Usage (cli):
$ file * | jc --file
or
$ jc file *
Usage (module):
import jc
result = jc.parse('file', file_command_output)
Schema:
[
{
"filename": string,
"type": string
}
]
Examples:
$ file * | jc --file -p
[
{
"filename": "Applications",
"type": "directory"
},
{
"filename": "another file with spaces",
"type": "empty"
},
{
"filename": "argstest.py",
"type": "Python script text executable, ASCII text"
},
{
"filename": "blkid-p.out",
"type": "ASCII text"
},
{
"filename": "blkid-pi.out",
"type": "ASCII text, with very long lines"
},
{
"filename": "cd_catalog.xml",
"type": "XML 1.0 document text, ASCII text, with CRLF line ..."
},
{
"filename": "centosserial.sh",
"type": "Bourne-Again shell script text executable, UTF-8 ..."
},
...
]
<a id="jc.parsers.file.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, aix, freebsd, darwin
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

116
docs/parsers/finger.md Normal file
View File

@@ -0,0 +1,116 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.finger"></a>
# jc.parsers.finger
jc - JSON Convert `finger` command output parser
Supports `-s` output option. Does not support the `-l` detail option.
Usage (cli):
$ finger | jc --finger
or
$ jc finger
Usage (module):
import jc
result = jc.parse('finger', finger_command_output)
Schema:
[
{
"login": string,
"name": string,
"tty": string,
"idle": string, # null if empty
"login_time": string,
"details": string,
"tty_writeable": boolean,
"idle_minutes": integer,
"idle_hours": integer,
"idle_days": integer,
"total_idle_minutes": integer
}
]
Examples:
$ finger | jc --finger -p
[
{
"login": "jdoe",
"name": "John Doe",
"tty": "tty1",
"idle": "14d",
"login_time": "Mar 22 21:14",
"tty_writeable": false,
"idle_minutes": 0,
"idle_hours": 0,
"idle_days": 14,
"total_idle_minutes": 20160
},
{
"login": "jdoe",
"name": "John Doe",
"tty": "pts/0",
"idle": null,
"login_time": "Apr 5 15:33",
"details": "(192.168.1.22)",
"tty_writeable": true,
"idle_minutes": 0,
"idle_hours": 0,
"idle_days": 0,
"total_idle_minutes": 0
},
...
]
$ finger | jc --finger -p -r
[
{
"login": "jdoe",
"name": "John Doe",
"tty": "*tty1",
"idle": "14d",
"login_time": "Mar 22 21:14"
},
{
"login": "jdoe",
"name": "John Doe",
"tty": "pts/0",
"idle": null,
"login_time": "Apr 5 15:33",
"details": "(192.168.1.22)"
},
...
]
<a id="jc.parsers.finger.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, cygwin, freebsd
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

98
docs/parsers/free.md Normal file
View File

@@ -0,0 +1,98 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.free"></a>
# jc.parsers.free
jc - JSON Convert `free` command output parser
Usage (cli):
$ free | jc --free
or
$ jc free
Usage (module):
import jc
result = jc.parse('free', free_command_output)
Schema:
[
{
"type": string,
"total": integer,
"used": integer,
"free": integer,
"shared": integer,
"buff_cache": integer,
"available": integer
}
]
Examples:
$ free | jc --free -p
[
{
"type": "Mem",
"total": 3861340,
"used": 220508,
"free": 3381972,
"shared": 11800,
"buff_cache": 258860,
"available": 3397784
},
{
"type": "Swap",
"total": 2097148,
"used": 0,
"free": 2097148
}
]
$ free | jc --free -p -r
[
{
"type": "Mem",
"total": "2017300",
"used": "213104",
"free": "1148452",
"shared": "1176",
"buff_cache": "655744",
"available": "1622204"
},
{
"type": "Swap",
"total": "2097148",
"used": "0",
"free": "2097148"
}
]
<a id="jc.parsers.free.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,111 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.fstab"></a>
# jc.parsers.fstab
jc - JSON Convert `fstab` file parser
Usage (cli):
$ cat /etc/fstab | jc --fstab
Usage (module):
import jc
result = jc.parse('fstab', fstab_command_output)
Schema:
[
{
"fs_spec": string,
"fs_file": string,
"fs_vfstype": string,
"fs_mntops": string,
"fs_freq": integer,
"fs_passno": integer
}
]
Examples:
$ cat /etc/fstab | jc --fstab -p
[
{
"fs_spec": "/dev/mapper/centos-root",
"fs_file": "/",
"fs_vfstype": "xfs",
"fs_mntops": "defaults",
"fs_freq": 0,
"fs_passno": 0
},
{
"fs_spec": "UUID=05d927bb-5875-49e3-ada1-7f46cb31c932",
"fs_file": "/boot",
"fs_vfstype": "xfs",
"fs_mntops": "defaults",
"fs_freq": 0,
"fs_passno": 0
},
{
"fs_spec": "/dev/mapper/centos-swap",
"fs_file": "swap",
"fs_vfstype": "swap",
"fs_mntops": "defaults",
"fs_freq": 0,
"fs_passno": 0
}
]
$ cat /etc/fstab | jc --fstab -p -r
[
{
"fs_spec": "/dev/mapper/centos-root",
"fs_file": "/",
"fs_vfstype": "xfs",
"fs_mntops": "defaults",
"fs_freq": "0",
"fs_passno": "0"
},
{
"fs_spec": "UUID=05d927bb-5875-49e3-ada1-7f46cb31c932",
"fs_file": "/boot",
"fs_vfstype": "xfs",
"fs_mntops": "defaults",
"fs_freq": "0",
"fs_passno": "0"
},
{
"fs_spec": "/dev/mapper/centos-swap",
"fs_file": "swap",
"fs_vfstype": "swap",
"fs_mntops": "defaults",
"fs_freq": "0",
"fs_passno": "0"
}
]
<a id="jc.parsers.fstab.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, freebsd
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

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

135
docs/parsers/group.md Normal file
View File

@@ -0,0 +1,135 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.group"></a>
# jc.parsers.group
jc - JSON Convert `/etc/group` file parser
Usage (cli):
$ cat /etc/group | jc --group
Usage (module):
import jc
result = jc.parse('group', group_file_output)
Schema:
[
{
"group_name": string,
"password": string,
"gid": integer,
"members": [
string
]
}
]
Examples:
$ cat /etc/group | jc --group -p
[
{
"group_name": "nobody",
"password": "*",
"gid": -2,
"members": []
},
{
"group_name": "nogroup",
"password": "*",
"gid": -1,
"members": []
},
{
"group_name": "wheel",
"password": "*",
"gid": 0,
"members": [
"root"
]
},
{
"group_name": "certusers",
"password": "*",
"gid": 29,
"members": [
"root",
"_jabber",
"_postfix",
"_cyrus",
"_calendar",
"_dovecot"
]
},
...
]
$ cat /etc/group | jc --group -p -r
[
{
"group_name": "nobody",
"password": "*",
"gid": "-2",
"members": [
""
]
},
{
"group_name": "nogroup",
"password": "*",
"gid": "-1",
"members": [
""
]
},
{
"group_name": "wheel",
"password": "*",
"gid": "0",
"members": [
"root"
]
},
{
"group_name": "certusers",
"password": "*",
"gid": "29",
"members": [
"root",
"_jabber",
"_postfix",
"_cyrus",
"_calendar",
"_dovecot"
]
},
...
]
<a id="jc.parsers.group.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, aix, freebsd
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

103
docs/parsers/gshadow.md Normal file
View File

@@ -0,0 +1,103 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.gshadow"></a>
# jc.parsers.gshadow
jc - JSON Convert `/etc/gshadow` file parser
Usage (cli):
$ cat /etc/gshadow | jc --gshadow
Usage (module):
import jc
result = jc.parse('gshadow', gshadow_file_output)
Schema:
[
{
"group_name": string,
"password": string,
"administrators": [
string
],
"members": [
string
]
}
]
Examples:
$ cat /etc/gshadow | jc --gshadow -p
[
{
"group_name": "root",
"password": "*",
"administrators": [],
"members": []
},
{
"group_name": "adm",
"password": "*",
"administrators": [],
"members": [
"syslog",
"joeuser"
]
},
...
]
$ cat /etc/gshadow | jc --gshadow -p -r
[
{
"group_name": "root",
"password": "*",
"administrators": [
""
],
"members": [
""
]
},
{
"group_name": "adm",
"password": "*",
"administrators": [
""
],
"members": [
"syslog",
"joeuser"
]
},
...
]
<a id="jc.parsers.gshadow.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, aix, freebsd
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

63
docs/parsers/hash.md Normal file
View File

@@ -0,0 +1,63 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.hash"></a>
# jc.parsers.hash
jc - JSON Convert `hash` command output parser
Usage (cli):
$ hash | jc --hash
Usage (module):
import jc
result = jc.parse('hash', hash_command_output)
Schema:
[
{
"command": string,
"hits": integer
}
]
Examples:
$ hash | jc --hash -p
[
{
"hits": 2,
"command": "/bin/cat"
},
{
"hits": 1,
"command": "/bin/ls"
}
]
<a id="jc.parsers.hash.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

94
docs/parsers/hashsum.md Normal file
View File

@@ -0,0 +1,94 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.hashsum"></a>
# jc.parsers.hashsum
jc - JSON Convert `hash sum` command output parser
This parser works with the following hash calculation utilities:
- `md5`
- `md5sum`
- `shasum`
- `sha1sum`
- `sha224sum`
- `sha256sum`
- `sha384sum`
- `sha512sum`
Usage (cli):
$ md5sum file.txt | jc --hashsum
or
$ jc md5sum file.txt
Usage (module):
import jc
result = jc.parse('hashsum', md5sum_command_output)
Schema:
[
{
"filename": string,
"hash": string,
}
]
Examples:
$ md5sum * | jc --hashsum -p
[
{
"filename": "devtoolset-3-gcc-4.9.2-6.el7.x86_64.rpm",
"hash": "65fc958c1add637ec23c4b137aecf3d3"
},
{
"filename": "digout",
"hash": "5b9312ee5aff080927753c63a347707d"
},
{
"filename": "dmidecode.out",
"hash": "716fd11c2ac00db109281f7110b8fb9d"
},
{
"filename": "file with spaces in the name",
"hash": "d41d8cd98f00b204e9800998ecf8427e"
},
{
"filename": "id-centos.out",
"hash": "4295be239a14ad77ef3253103de976d2"
},
{
"filename": "ifcfg.json",
"hash": "01fda0d9ba9a75618b072e64ff512b43"
},
...
]
<a id="jc.parsers.hashsum.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

343
docs/parsers/hciconfig.md Normal file
View File

@@ -0,0 +1,343 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.hciconfig"></a>
# jc.parsers.hciconfig
jc - JSON Convert `hciconfig` command output parser
Usage (cli):
$ hciconfig | jc --hciconfig
or
$ jc hciconfig
Usage (module):
import jc
result = jc.parse('hciconfig', hciconfig_command_output)
Schema:
[
{
"device": string,
"type": string,
"bus": string,
"bd_address": string,
"acl_mtu": integer,
"acl_mtu_packets": integer,
"sco_mtu": integer,
"sco_mtu_packets": integer,
"state": [
string
],
"rx_bytes": integer,
"rx_acl": integer,
"rx_sco": integer,
"rx_events": integer,
"rx_errors": integer,
"tx_bytes": integer,
"tx_acl": integer,
"tx_sco": integer,
"tx_commands": integer,
"tx_errors": integer,
"features": [
string
],
"packet_type": [
string
],
"link_policy": [
string
],
"link_mode": [
string
],
"name": string,
"class": string,
"service_classes": [
string # 'Unspecified' is null
],
"device_class": string,
"hci_version": string,
"hci_revision": string,
"lmp_version": string,
"lmp_subversion": string,
"manufacturer": string
}
]
Examples:
$ hciconfig -a | jc --hciconfig -p
[
{
"device": "hci0",
"type": "Primary",
"bus": "USB",
"bd_address": "00:1A:7D:DA:71:13",
"acl_mtu": 310,
"acl_mtu_packets": 10,
"sco_mtu": 64,
"sco_mtu_packets": 8,
"state": [
"UP",
"RUNNING"
],
"rx_bytes": 13905869,
"rx_acl": 0,
"rx_sco": 0,
"rx_events": 393300,
"rx_errors": 0,
"tx_bytes": 62629,
"tx_acl": 0,
"tx_sco": 0,
"tx_commands": 3893,
"tx_errors": 0,
"features": [
"0xff",
"0xff",
"0x8f",
"0xfe",
"0xdb",
"0xff",
"0x5b",
"0x87"
],
"packet_type": [
"DM1",
"DM3",
"DM5",
"DH1",
"DH3",
"DH5",
"HV1",
"HV2",
"HV3"
],
"link_policy": [
"RSWITCH",
"HOLD",
"SNIFF",
"PARK"
],
"link_mode": [
"SLAVE",
"ACCEPT"
],
"name": "CSR8510 A10",
"class": "0x000000",
"service_classes": null,
"device_class": "Miscellaneous",
"hci_version": "4.0 (0x6)",
"hci_revision": "0x22bb",
"lmp_version": "4.0 (0x6)",
"lmp_subversion": "0x22bb",
"manufacturer": "Cambridge Silicon Radio (10)"
},
{
"device": "hci1",
"type": "Primary",
"bus": "USB",
"bd_address": "00:1A:7D:DA:71:13",
"acl_mtu": 310,
"acl_mtu_packets": 10,
"sco_mtu": 64,
"sco_mtu_packets": 8,
"state": [
"DOWN"
],
"rx_bytes": 4388363,
"rx_acl": 0,
"rx_sco": 0,
"rx_events": 122021,
"rx_errors": 0,
"tx_bytes": 52350,
"tx_acl": 0,
"tx_sco": 0,
"tx_commands": 3480,
"tx_errors": 2,
"features": [
"0xff",
"0xff",
"0x8f",
"0xfe",
"0xdb",
"0xff",
"0x5b",
"0x87"
],
"packet_type": [
"DM1",
"DM3",
"DM5",
"DH1",
"DH3",
"DH5",
"HV1",
"HV2",
"HV3"
],
"link_policy": [
"RSWITCH",
"HOLD",
"SNIFF",
"PARK"
],
"link_mode": [
"SLAVE",
"ACCEPT"
]
}
]
$ hciconfig -a | jc --hciconfig -p -r
[
{
"device": "hci0",
"type": "Primary",
"bus": "USB",
"bd_address": "00:1A:7D:DA:71:13",
"acl_mtu": "310",
"acl_mtu_packets": "10",
"sco_mtu": "64",
"sco_mtu_packets": "8",
"state": [
"UP",
"RUNNING"
],
"rx_bytes": "13905869",
"rx_acl": "0",
"rx_sco": "0",
"rx_events": "393300",
"rx_errors": "0",
"tx_bytes": "62629",
"tx_acl": "0",
"tx_sco": "0",
"tx_commands": "3893",
"tx_errors": "0",
"features": [
"0xff",
"0xff",
"0x8f",
"0xfe",
"0xdb",
"0xff",
"0x5b",
"0x87"
],
"packet_type": [
"DM1",
"DM3",
"DM5",
"DH1",
"DH3",
"DH5",
"HV1",
"HV2",
"HV3"
],
"link_policy": [
"RSWITCH",
"HOLD",
"SNIFF",
"PARK"
],
"link_mode": [
"SLAVE",
"ACCEPT"
],
"name": "CSR8510 A10",
"class": "0x000000",
"service_classes": [
"Unspecified"
],
"device_class": "Miscellaneous",
"hci_version": "4.0 (0x6)",
"hci_revision": "0x22bb",
"lmp_version": "4.0 (0x6)",
"lmp_subversion": "0x22bb",
"manufacturer": "Cambridge Silicon Radio (10)"
},
{
"device": "hci1",
"type": "Primary",
"bus": "USB",
"bd_address": "00:1A:7D:DA:71:13",
"acl_mtu": "310",
"acl_mtu_packets": "10",
"sco_mtu": "64",
"sco_mtu_packets": "8",
"state": [
"DOWN"
],
"rx_bytes": "4388363",
"rx_acl": "0",
"rx_sco": "0",
"rx_events": "122021",
"rx_errors": "0",
"tx_bytes": "52350",
"tx_acl": "0",
"tx_sco": "0",
"tx_commands": "3480",
"tx_errors": "2",
"features": [
"0xff",
"0xff",
"0x8f",
"0xfe",
"0xdb",
"0xff",
"0x5b",
"0x87"
],
"packet_type": [
"DM1",
"DM3",
"DM5",
"DH1",
"DH3",
"DH5",
"HV1",
"HV2",
"HV3"
],
"link_policy": [
"RSWITCH",
"HOLD",
"SNIFF",
"PARK"
],
"link_mode": [
"SLAVE",
"ACCEPT"
]
}
]
<a id="jc.parsers.hciconfig.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,90 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.history"></a>
# jc.parsers.history
jc - JSON Convert `history` command output parser
This parser will output a list of dictionaries each containing `line` and
`command` keys. If you would like a simple dictionary output, then use the
`-r` command-line option or the `raw=True` argument in the `parse()`
function.
The "Magic" syntax is not supported since the `history` command is a shell
builtin.
Usage (cli):
$ history | jc --history
Usage (module):
import jc
result = jc.parse('history', history_command_output)
Schema:
[
{
"line": integer,
"command": string
}
]
Examples:
$ history | jc --history -p
[
{
"line": 118,
"command": "sleep 100"
},
{
"line": 119,
"command": "ls /bin"
},
{
"line": 120,
"command": "echo \"hello\""
},
{
"line": 121,
"command": "docker images"
},
...
]
$ history | jc --history -p -r
{
"118": "sleep 100",
"119": "ls /bin",
"120": "echo \"hello\"",
"121": "docker images",
...
}
<a id="jc.parsers.history.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary of raw structured data or
List of Dictionaries of processed structured data
### Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

100
docs/parsers/hosts.md Normal file
View File

@@ -0,0 +1,100 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.hosts"></a>
# jc.parsers.hosts
jc - JSON Convert `/etc/hosts` file parser
Usage (cli):
$ cat /etc/hosts | jc --hosts
Usage (module):
import jc
result = jc.parse('hosts', hosts_file_output)
Schema:
[
{
"ip": string,
"hostname": [
string
]
}
]
Examples:
$ cat /etc/hosts | jc --hosts -p
[
{
"ip": "127.0.0.1",
"hostname": [
"localhost"
]
},
{
"ip": "127.0.1.1",
"hostname": [
"root-ubuntu"
]
},
{
"ip": "::1",
"hostname": [
"ip6-localhost",
"ip6-loopback"
]
},
{
"ip": "fe00::0",
"hostname": [
"ip6-localnet"
]
},
{
"ip": "ff00::0",
"hostname": [
"ip6-mcastprefix"
]
},
{
"ip": "ff02::1",
"hostname": [
"ip6-allnodes"
]
},
{
"ip": "ff02::2",
"hostname": [
"ip6-allrouters"
]
}
]
<a id="jc.parsers.hosts.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

131
docs/parsers/id.md Normal file
View File

@@ -0,0 +1,131 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.id"></a>
# jc.parsers.id
jc - JSON Convert `id` command output parser
Usage (cli):
$ id | jc --id
or
$ jc id
Usage (module):
import jc
result = jc.parse('id', id_command_output)
Schema:
{
"uid": {
"id": integer,
"name": string
},
"gid": {
"id": integer,
"name": string
},
"groups": [
{
"id": integer,
"name": string
},
{
"id": integer,
"name": string
}
],
"context": {
"user": string,
"role": string,
"type": string,
"level": string
}
}
Examples:
$ id | jc --id -p
{
"uid": {
"id": 1000,
"name": "joeuser"
},
"gid": {
"id": 1000,
"name": "joeuser"
},
"groups": [
{
"id": 1000,
"name": "joeuser"
},
{
"id": 10,
"name": "wheel"
}
],
"context": {
"user": "unconfined_u",
"role": "unconfined_r",
"type": "unconfined_t",
"level": "s0-s0:c0.c1023"
}
}
$ id | jc --id -p -r
{
"uid": {
"id": "1000",
"name": "joeuser"
},
"gid": {
"id": "1000",
"name": "joeuser"
},
"groups": [
{
"id": "1000",
"name": "joeuser"
},
{
"id": "10",
"name": "wheel"
}
],
"context": {
"user": "unconfined_u",
"role": "unconfined_r",
"type": "unconfined_t",
"level": "s0-s0:c0.c1023"
}
}
<a id="jc.parsers.id.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, aix, freebsd
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

212
docs/parsers/ifconfig.md Normal file
View File

@@ -0,0 +1,212 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ifconfig"></a>
# jc.parsers.ifconfig
jc - JSON Convert `ifconfig` command output parser
Note: No `ifconfig` options are supported.
Usage (cli):
$ ifconfig | jc --ifconfig
or
$ jc ifconfig
Usage (module):
import jc
result = jc.parse('ifconfig', ifconfig_command_output)
Schema:
[
{
"name": string,
"flags": integer,
"state": [
string
],
"mtu": integer,
"ipv4_addr": string,
"ipv4_mask": string,
"ipv4_bcast": string,
"ipv6_addr": string,
"ipv6_mask": integer,
"ipv6_scope": string,
"mac_addr": string,
"type": string,
"rx_packets": integer,
"rx_bytes": integer,
"rx_errors": integer,
"rx_dropped": integer,
"rx_overruns": integer,
"rx_frame": integer,
"tx_packets": integer,
"tx_bytes": integer,
"tx_errors": integer,
"tx_dropped": integer,
"tx_overruns": integer,
"tx_carrier": integer,
"tx_collisions": integer,
"metric": integer
}
]
Examples:
$ ifconfig | jc --ifconfig -p
[
{
"name": "ens33",
"flags": 4163,
"state": [
"UP",
"BROADCAST",
"RUNNING",
"MULTICAST"
],
"mtu": 1500,
"ipv4_addr": "192.168.71.137",
"ipv4_mask": "255.255.255.0",
"ipv4_bcast": "192.168.71.255",
"ipv6_addr": "fe80::c1cb:715d:bc3e:b8a0",
"ipv6_mask": 64,
"ipv6_scope": "0x20",
"mac_addr": "00:0c:29:3b:58:0e",
"type": "Ethernet",
"rx_packets": 8061,
"rx_bytes": 1514413,
"rx_errors": 0,
"rx_dropped": 0,
"rx_overruns": 0,
"rx_frame": 0,
"tx_packets": 4502,
"tx_bytes": 866622,
"tx_errors": 0,
"tx_dropped": 0,
"tx_overruns": 0,
"tx_carrier": 0,
"tx_collisions": 0,
"metric": null
},
{
"name": "lo",
"flags": 73,
"state": [
"UP",
"LOOPBACK",
"RUNNING"
],
"mtu": 65536,
"ipv4_addr": "127.0.0.1",
"ipv4_mask": "255.0.0.0",
"ipv4_bcast": null,
"ipv6_addr": "::1",
"ipv6_mask": 128,
"ipv6_scope": "0x10",
"mac_addr": null,
"type": "Local Loopback",
"rx_packets": 73,
"rx_bytes": 6009,
"rx_errors": 0,
"rx_dropped": 0,
"rx_overruns": 0,
"rx_frame": 0,
"tx_packets": 73,
"tx_bytes": 6009,
"tx_errors": 0,
"tx_dropped": 0,
"tx_overruns": 0,
"tx_carrier": 0,
"tx_collisions": 0,
"metric": null
}
]
$ ifconfig | jc --ifconfig -p -r
[
{
"name": "ens33",
"flags": "4163",
"state": "UP,BROADCAST,RUNNING,MULTICAST",
"mtu": "1500",
"ipv4_addr": "192.168.71.137",
"ipv4_mask": "255.255.255.0",
"ipv4_bcast": "192.168.71.255",
"ipv6_addr": "fe80::c1cb:715d:bc3e:b8a0",
"ipv6_mask": "64",
"ipv6_scope": "0x20",
"mac_addr": "00:0c:29:3b:58:0e",
"type": "Ethernet",
"rx_packets": "8061",
"rx_bytes": "1514413",
"rx_errors": "0",
"rx_dropped": "0",
"rx_overruns": "0",
"rx_frame": "0",
"tx_packets": "4502",
"tx_bytes": "866622",
"tx_errors": "0",
"tx_dropped": "0",
"tx_overruns": "0",
"tx_carrier": "0",
"tx_collisions": "0",
"metric": null
},
{
"name": "lo",
"flags": "73",
"state": "UP,LOOPBACK,RUNNING",
"mtu": "65536",
"ipv4_addr": "127.0.0.1",
"ipv4_mask": "255.0.0.0",
"ipv4_bcast": null,
"ipv6_addr": "::1",
"ipv6_mask": "128",
"ipv6_scope": "0x10",
"mac_addr": null,
"type": "Local Loopback",
"rx_packets": "73",
"rx_bytes": "6009",
"rx_errors": "0",
"rx_dropped": "0",
"rx_overruns": "0",
"rx_frame": "0",
"tx_packets": "73",
"tx_bytes": "6009",
"tx_errors": "0",
"tx_dropped": "0",
"tx_overruns": "0",
"tx_carrier": "0",
"tx_collisions": "0",
"metric": null
}
]
<a id="jc.parsers.ifconfig.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, aix, freebsd, darwin
Version 1.11 by Kelly Brazil (kellyjonbrazil@gmail.com)

94
docs/parsers/ini.md Normal file
View File

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

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

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

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

@@ -0,0 +1,137 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.iostat_s"></a>
# jc.parsers.iostat\_s
jc - JSON Convert `iostat` command output streaming parser
> This streaming parser outputs JSON Lines (cli) or returns a Generator
iterator of Dictionaries (module)
Note: `iostat` version 11 and higher include a JSON output option
Usage (cli):
$ iostat | jc --iostat-s
> Note: When piping `jc` converted `iostat` output to other processes it may
appear the output is hanging due to the OS pipe buffers. This is because
`iostat` output is too small to quickly fill up the buffer. Use the `-u`
option to unbuffer the `jc` output if you would like immediate output. See
the [readme](https://github.com/kellyjonbrazil/jc/tree/master#unbuffering-output)
for more information.
Usage (module):
import jc
result = jc.parse('iostat_s', iostat_command_output.splitlines())
for item in result:
# do something
Schema:
{
"type": string,
"percent_user": float,
"percent_nice": float,
"percent_system": float,
"percent_iowait": float,
"percent_steal": float,
"percent_idle": float,
"device": string,
"tps": float,
"kb_read_s": float,
"mb_read_s": float,
"kb_wrtn_s": float,
"mb_wrtn_s": float,
"kb_read": integer,
"mb_read": integer,
"kb_wrtn": integer,
"mb_wrtn": integer,
'kb_dscd': integer,
'mb_dscd': integer,
"rrqm_s": float,
"wrqm_s": float,
"r_s": float,
"w_s": float,
"rmb_s": float,
"rkb_s": float,
"wmb_s": float,
"wkb_s": float,
"avgrq_sz": float,
"avgqu_sz": float,
"await": float,
"r_await": float,
"w_await": float,
"svctm": float,
"aqu_sz": float,
"rareq_sz": float,
"wareq_sz": float,
"d_s": float,
"dkb_s": float,
"dmb_s": float,
"drqm_s": float,
"percent_drqm": float,
"d_await": float,
"dareq_sz": float,
"f_s": float,
"f_await": float,
"kb_dscd_s": float,
"mb_dscd_s": float,
"percent_util": float,
"percent_rrqm": float,
"percent_wrqm": float,
# below object only exists if using -qq or ignore_exceptions=True
"_jc_meta": {
"success": boolean, # false if error parsing
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
}
Examples:
$ iostat | jc --iostat-s
{"percent_user":0.14,"percent_nice":0.0,"percent_system":0.16,...}
{"device":"sda","tps":0.24,"kb_read_s":5.28,"kb_wrtn_s":1.1...}
...
$ iostat | jc --iostat-s -r
{"percent_user":"0.14","percent_nice":"0.00","percent_system":"0.16"...}
{"device":"sda","tps":"0.24","kb_read_s":"5.28","kb_wrtn_s":"1.10"...}
...
<a id="jc.parsers.iostat_s.parse"></a>
### parse
```python
@add_jc_meta
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
```
Main text parsing generator function. Returns an iterator object.
Parameters:
data: (iterable) line-based text data to parse
(e.g. sys.stdin or str.splitlines())
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
ignore_exceptions: (boolean) ignore parsing exceptions if True
Yields:
Dictionary. Raw or processed structured data.
Returns:
Iterator object (generator)
### Parser Information
Compatibility: linux
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

189
docs/parsers/iptables.md Normal file
View File

@@ -0,0 +1,189 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.iptables"></a>
# jc.parsers.iptables
jc - JSON Convert `iptables` command output parser
Supports `-vLn` and `--line-numbers` for all tables.
Usage (cli):
$ sudo iptables -L -t nat | jc --iptables
or
$ jc iptables -L -t nat
Usage (module):
import jc
result = jc.parse('iptables', iptables_command_output)
Schema:
[
{
"chain": string,
"rules": [
{
"num" integer,
"pkts": integer,
"bytes": integer, # converted based on suffix
"target": string,
"prot": string,
"opt": string, # "--" = Null
"in": string,
"out": string,
"source": string,
"destination": string,
"options": string
}
]
}
]
Examples:
$ sudo iptables --line-numbers -v -L -t nat | jc --iptables -p
[
{
"chain": "PREROUTING",
"rules": [
{
"num": 1,
"pkts": 2183,
"bytes": 186000,
"target": "PREROUTING_direct",
"prot": "all",
"opt": null,
"in": "any",
"out": "any",
"source": "anywhere",
"destination": "anywhere"
},
{
"num": 2,
"pkts": 2183,
"bytes": 186000,
"target": "PREROUTING_ZONES_SOURCE",
"prot": "all",
"opt": null,
"in": "any",
"out": "any",
"source": "anywhere",
"destination": "anywhere"
},
{
"num": 3,
"pkts": 2183,
"bytes": 186000,
"target": "PREROUTING_ZONES",
"prot": "all",
"opt": null,
"in": "any",
"out": "any",
"source": "anywhere",
"destination": "anywhere"
},
{
"num": 4,
"pkts": 0,
"bytes": 0,
"target": "DOCKER",
"prot": "all",
"opt": null,
"in": "any",
"out": "any",
"source": "anywhere",
"destination": "anywhere",
"options": "ADDRTYPE match dst-type LOCAL"
}
]
},
...
]
$ sudo iptables --line-numbers -v -L -t nat | jc --iptables -p -r
[
{
"chain": "PREROUTING",
"rules": [
{
"num": "1",
"pkts": "2183",
"bytes": "186K",
"target": "PREROUTING_direct",
"prot": "all",
"opt": "--",
"in": "any",
"out": "any",
"source": "anywhere",
"destination": "anywhere"
},
{
"num": "2",
"pkts": "2183",
"bytes": "186K",
"target": "PREROUTING_ZONES_SOURCE",
"prot": "all",
"opt": "--",
"in": "any",
"out": "any",
"source": "anywhere",
"destination": "anywhere"
},
{
"num": "3",
"pkts": "2183",
"bytes": "186K",
"target": "PREROUTING_ZONES",
"prot": "all",
"opt": "--",
"in": "any",
"out": "any",
"source": "anywhere",
"destination": "anywhere"
},
{
"num": "4",
"pkts": "0",
"bytes": "0",
"target": "DOCKER",
"prot": "all",
"opt": "--",
"in": "any",
"out": "any",
"source": "anywhere",
"destination": "anywhere",
"options": "ADDRTYPE match dst-type LOCAL"
}
]
},
...
]
<a id="jc.parsers.iptables.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,147 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.iw_scan"></a>
# jc.parsers.iw\_scan
jc - JSON Convert `iw dev <device> scan` command output parser
This parser is considered beta quality. Not all fields are parsed and there
are not enough samples to test.
Usage (cli):
$ iw dev wlan0 scan | jc --iw-scan
or
$ jc iw dev wlan0 scan
Usage (module):
import jc
result = jc.parse('iw_scan', iw_scan_command_output)
Schema:
[
{
"foo": string/integer/float, # best guess based on value
"bar": string/integer/float,
"baz": string/integer/float
}
]
Examples:
$ iw dev wlan0 scan | jc --iw-scan -p
[
{
"bssid": "71:31:72:65:e1:a2",
"interface": "wlan0",
"freq": 2462,
"capability": "ESS Privacy ShortSlotTime (0x0411)",
"ssid": "WLAN-1234",
"supported_rates": [
1.0,
2.0,
5.5,
11.0,
18.0,
24.0,
36.0,
54.0
],
"erp": "<no flags>",
"erp_d4.0": "<no flags>",
"rsn": "Version: 1",
"group_cipher": "CCMP",
"pairwise_ciphers": "CCMP",
"authentication_suites": "PSK",
"capabilities": "0x186c",
"extended_supported_rates": [
6.0,
9.0,
12.0,
48.0
],
"ht_rx_mcs_rate_indexes_supported": "0-15",
"primary_channel": 11,
"secondary_channel_offset": "no secondary",
"rifs": 1,
"ht_protection": "no",
"non-gf_present": 1,
"obss_non-gf_present": 0,
"dual_beacon": 0,
"dual_cts_protection": 0,
"stbc_beacon": 0,
"l-sig_txop_prot": 0,
"pco_active": 0,
"pco_phase": 0,
"bss_width_channel_transition_delay_factor": 5,
"extended_capabilities": "HT Information Exchange Supported",
"wmm": "Parameter version 1",
"be": "CW 15-1023, AIFSN 3",
"bk": "CW 15-1023, AIFSN 7",
"vi": "CW 7-15, AIFSN 2, TXOP 3008 usec",
"vo": "CW 3-7, AIFSN 2, TXOP 1504 usec",
"wps": "Version: 1.0",
"wi-fi_protected_setup_state": "2 (Configured)",
"selected_registrar": "0x0",
"response_type": "3 (AP)",
"uuid": "00000000-0000-0003-0000-75317074f1a2",
"manufacturer": "Corporation",
"model": "VGV8539JW",
"model_number": "1.47.000",
"serial_number": "J144024542",
"primary_device_type": "6-0050f204-1",
"device_name": "Wireless Router(WFA)",
"config_methods": "Label, PBC",
"rf_bands": "0x3",
"tsf_usec": 212098649788,
"sta_channel_width_mhz": 20,
"passive_dwell_tus": 20,
"active_dwell_tus": 10,
"channel_width_trigger_scan_interval_s": 300,
"scan_passive_total_per_channel_tus": 200,
"scan_active_total_per_channel_tus": 20,
"beacon_interval_tus": 100,
"signal_dbm": -80.0,
"last_seen_ms": 11420,
"selected_rates": [
1.0,
2.0,
5.5,
11.0
],
"obss_scan_activity_threshold_percent": 0.25,
"ds_parameter_set_channel": 11,
"max_amsdu_length_bytes": 7935,
"minimum_rx_ampdu_time_spacing_usec": 16
},
...
]
<a id="jc.parsers.iw_scan.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 0.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -0,0 +1,103 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.jar_manifest"></a>
# jc.parsers.jar\_manifest
jc - JSON Convert `MANIFEST.MF` file parser
Usage (cli):
$ cat MANIFEST.MF | jc --jar-manifest
Usage (module):
import jc
result = jc.parse('jar_manifest', jar_manifest_file_output)
Schema:
[
{
"key1": string,
"key2": string
}
]
Examples:
$ cat MANIFEST.MF | jc --jar-manifest -p
$ unzip -c log4j-core-2.16.0.jar META-INF/MANIFEST.MF | \\
jc --jar-manifest -p
$ unzip -c 'apache-log4j-2.16.0-bin/*.jar' META-INF/MANIFEST.MF | \\
jc --jar-manifest -p
$ cat MANIFEST.MF | jc --jar-manifest -p
[
{
"Import_Package": "com.conversantmedia.util.concurrent;resoluti...",
"Export_Package": "org.apache.logging.log4j.core;uses:=\"org.ap...",
"Manifest_Version": "1.0",
"Bundle_License": "https://www.apache.org/licenses/LICENSE-2.0.txt",
"Bundle_SymbolicName": "org.apache.logging.log4j.core",
"Built_By": "matt",
"Bnd_LastModified": "1639373735804",
"Implementation_Vendor_Id": "org.apache.logging.log4j",
"Specification_Title": "Apache Log4j Core",
"Log4jReleaseManager": "Matt Sicker",
...
}
]
$ unzip -c 'apache-log4j-2.16.0-bin/*.jar' META-INF/MANIFEST.MF | \\
jc --jar-manifest -p
[
...
{
"Archive": "apache-log4j-2.16.0-bin/log4j-spring-boot-2.16.0-so...",
"Manifest_Version": "1.0",
"Built_By": "matt",
"Created_By": "Apache Maven 3.8.4",
"Build_Jdk": "1.8.0_312"
},
{
"Archive": "apache-log4j-2.16.0-bin/log4j-spring-boot-2.16.0-ja...",
"Manifest_Version": "1.0",
"Built_By": "matt",
"Created_By": "Apache Maven 3.8.4",
"Build_Jdk": "1.8.0_312"
},
{
"Bundle_SymbolicName": "org.apache.logging.log4j.spring-cloud-c...",
"Export_Package": "org.apache.logging.log4j.spring.cloud.config...",
"Archive": "apache-log4j-2.16.0-bin/log4j-spring-cloud-config-c...",
"Manifest_Version": "1.0",
"Bundle_License": "https://www.apache.org/licenses/LICENSE-2.0.txt",
...
}
...
]
<a id="jc.parsers.jar_manifest.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 0.01 by Matt J (https://github.com/listuser)

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

@@ -0,0 +1,119 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.jobs"></a>
# jc.parsers.jobs
jc - JSON Convert `jobs` command output parser
Also supports the `-l` option.
The "Magic" syntax is not supported since the `jobs` command is a shell
builtin.
Usage (cli):
$ jobs | jc --jobs
Usage (module):
import jc
result = jc.parse('jobs', jobs_command_output)
Schema:
[
{
"job_number": integer,
"pid": integer,
"history": string,
"status": string,
"command": string
}
]
Example:
$ jobs -l | jc --jobs -p
[
{
"job_number": 1,
"pid": 5283,
"status": "Running",
"command": "sleep 10000 &"
},
{
"job_number": 2,
"pid": 5284,
"status": "Running",
"command": "sleep 10100 &"
},
{
"job_number": 3,
"pid": 5285,
"history": "previous",
"status": "Running",
"command": "sleep 10001 &"
},
{
"job_number": 4,
"pid": 5286,
"history": "current",
"status": "Running",
"command": "sleep 10112 &"
}
]
$ jobs -l | jc --jobs -p -r
[
{
"job_number": "1",
"pid": "19510",
"status": "Running",
"command": "sleep 1000 &"
},
{
"job_number": "2",
"pid": "19511",
"status": "Running",
"command": "sleep 1001 &"
},
{
"job_number": "3",
"pid": "19512",
"history": "previous",
"status": "Running",
"command": "sleep 1002 &"
},
{
"job_number": "4",
"pid": "19513",
"history": "current",
"status": "Running",
"command": "sleep 1003 &"
}
]
<a id="jc.parsers.jobs.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

83
docs/parsers/kv.md Normal file
View File

@@ -0,0 +1,83 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.kv"></a>
# jc.parsers.kv
jc - JSON Convert `Key/Value` file parser
Supports files containing simple key/value pairs.
- Delimiter can be `=` or `:`. Missing values are supported.
- Comment prefix can be `#` or `;`. Comments must be on their own line.
- If duplicate keys are found, only the last value will be used.
> Note: Values starting and ending with quotation marks will have the marks
removed. If you would like to keep the quotation marks, use the `-r`
command-line argument or the `raw=True` argument in `parse()`.
Usage (cli):
$ cat foo.txt | jc --kv
Usage (module):
import jc
result = jc.parse('kv', kv_file_output)
Schema:
key/value document converted to a dictionary - see the
configparser standard library documentation for more details.
{
"key1": string,
"key2": string
}
Examples:
$ cat keyvalue.txt
# this file contains key/value pairs
name = John Doe
address=555 California Drive
age: 34
; comments can include # or ;
# delimiter can be = or :
# quoted values have quotation marks stripped by default
# but can be preserved with the -r argument
occupation:"Engineer"
$ cat keyvalue.txt | jc --kv -p
{
"name": "John Doe",
"address": "555 California Drive",
"age": "34",
"occupation": "Engineer"
}
<a id="jc.parsers.kv.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Note: this is just a wrapper for jc.parsers.ini
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary representing the key/value file
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

130
docs/parsers/last.md Normal file
View File

@@ -0,0 +1,130 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.last"></a>
# jc.parsers.last
jc - JSON Convert `last` and `lastb` command output parser
Supports `-w` and `-F` options.
Calculated epoch time fields are naive (i.e. based on the local time of the
system the parser is run on) since there is no timezone information in the
`last` command output.
Usage (cli):
$ last | jc --last
or
$ jc last
Usage (module):
import jc
result = jc.parse('last', last_command_output)
Schema:
[
{
"user": string,
"tty": string,
"hostname": string,
"login": string,
"logout": string,
"duration": string,
"login_epoch": integer, # (naive) available w/last -F option
"logout_epoch": integer, # (naive) available w/last -F option
"duration_seconds": integer # available w/last -F option
}
]
Examples:
$ last -F | jc --last -p
[
{
"user": "kbrazil",
"tty": "ttys002",
"hostname": null,
"login": "Mon Dec 28 17:24:10 2020",
"logout": "still logged in"
},
{
"user": "kbrazil",
"tty": "ttys003",
"hostname": null,
"login": "Mon Dec 28 17:24:10 2020",
"logout": "Mon Dec 28 17:25:01 2020",
"duration": "00:00",
"login_epoch": 1565891826,
"logout_epoch": 1565895404,
"duration_seconds": 3578
},
{
"user": "kbrazil",
"tty": "ttys003",
"hostname": null,
"login": "Mon Dec 28 17:24:10 2020",
"logout": "Mon Dec 28 17:25:01 2020",
"duration": "00:00",
"login_epoch": 1565891826,
"logout_epoch": 1565895404,
"duration_seconds": 3578
},
...
]
$ last | jc --last -p -r
[
{
"user": "kbrazil",
"tty": "ttys002",
"hostname": "-",
"login": "Thu Feb 27 14:31",
"logout": "still_logged_in"
},
{
"user": "kbrazil",
"tty": "ttys003",
"hostname": "-",
"login": "Thu Feb 27 10:38",
"logout": "10:38",
"duration": "00:00"
},
{
"user": "kbrazil",
"tty": "ttys003",
"hostname": "-",
"login": "Thu Feb 27 10:18",
"logout": "10:18",
"duration": "00:00"
},
...
]
<a id="jc.parsers.last.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, aix, freebsd
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,142 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ls"></a>
# jc.parsers.ls
jc - JSON Convert `ls` and `vdir` command output parser
Options supported:
- `lbaR1`
- `--time-style=full-iso`
Note: The `-1`, `-l`, or `-b` option of `ls` should be used to correctly
parse filenames that include newline characters. Since `ls` does not encode
newlines in filenames when outputting to a pipe it will cause `jc` to see
multiple files instead of a single file if `-1`, `-l`, or `-b` is not used.
Alternatively, `vdir` can be used, which is the same as running `ls -lb`.
The `epoch` calculated timestamp field is naive. (i.e. based on the local
time of the system the parser is run on)
The `epoch_utc` calculated timestamp field is timezone-aware and is only
available if the timezone field is UTC.
Usage (cli):
$ ls | jc --ls
or
$ jc ls
Usage (module):
import jc
result = jc.parse('ls', ls_command_output)
Schema:
[
{
"filename": string,
"flags": string,
"links": integer,
"parent": string,
"owner": string,
"group": string,
"size": integer,
"date": string,
"epoch": integer, # [0]
"epoch_utc": integer # [1]
}
]
[0] naive timestamp if date field exists and can be converted.
[1] timezone aware timestamp if date field is in UTC and can
be converted.
Examples:
$ ls /usr/bin | jc --ls -p
[
{
"filename": "apropos"
},
{
"filename": "arch"
},
...
]
$ ls -l /usr/bin | jc --ls -p
[
{
"filename": "apropos",
"link_to": "whatis",
"flags": "lrwxrwxrwx.",
"links": 1,
"owner": "root",
"group": "root",
"size": 6,
"date": "Aug 15 10:53"
},
{
"filename": "ar",
"flags": "-rwxr-xr-x.",
"links": 1,
"owner": "root",
"group": "root",
"size": 62744,
"date": "Aug 8 16:14"
},
...
]
$ ls -l /usr/bin | jc --ls -p -r
[
{
"filename": "apropos",
"link_to": "whatis",
"flags": "lrwxrwxrwx.",
"links": "1",
"owner": "root",
"group": "root",
"size": "6",
"date": "Aug 15 10:53"
},
{
"filename": "arch",
"flags": "-rwxr-xr-x.",
"links": "1",
"owner": "root",
"group": "root",
"size": "33080",
"date": "Aug 19 23:25"
},
...
]
<a id="jc.parsers.ls.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.11 by Kelly Brazil (kellyjonbrazil@gmail.com)

106
docs/parsers/ls_s.md Normal file
View File

@@ -0,0 +1,106 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ls_s"></a>
# jc.parsers.ls\_s
jc - JSON Convert `ls` and `vdir` command output streaming parser
> This streaming parser outputs JSON Lines (cli) or returns a Generator
iterator of Dictionaries (module)
Requires the `-l` option to be used on `ls`. If there are newline characters
in the filename, then make sure to use the `-b` option on `ls`.
The `jc` `-qq` option can be used to ignore parsing errors. (e.g. filenames
with newline characters, but `-b` was not used)
The `epoch` calculated timestamp field is naive (i.e. based on the local
time of the system the parser is run on)
The `epoch_utc` calculated timestamp field is timezone-aware and is only
available if the timezone field is UTC.
Usage (cli):
$ ls | jc --ls-s
Usage (module):
import jc
result = jc.parse('ls_s', ls_command_output.splitlines())
for item in result:
# do something
Schema:
{
"filename": string,
"flags": string,
"links": integer,
"parent": string,
"owner": string,
"group": string,
"size": integer,
"date": string,
"epoch": integer, # [0]
"epoch_utc": integer, # [1]
# below object only exists if using -qq or ignore_exceptions=True
"_jc_meta": {
"success": boolean, # false if error parsing
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
}
[0] naive timestamp if date field exists and can be converted.
[1] timezone aware timestamp if date field is in UTC and can
be converted
Examples:
$ ls -l /usr/bin | jc --ls-s
{"filename":"2to3-","flags":"-rwxr-xr-x","links":4,"owner":"root","...}
{"filename":"2to3-2.7","link_to":"../../System/Library/Frameworks/P...}
{"filename":"AssetCacheLocatorUtil","flags":"-rwxr-xr-x","links":1,...}
...
$ ls -l /usr/bin | jc --ls-s -r
{"filename":"2to3-","flags":"-rwxr-xr-x","links":"4","owner":"roo"..."}
{"filename":"2to3-2.7","link_to":"../../System/Library/Frameworks/P...}
{"filename":"AssetCacheLocatorUtil","flags":"-rwxr-xr-x","links":"1...}
...
<a id="jc.parsers.ls_s.parse"></a>
### parse
```python
@add_jc_meta
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
```
Main text parsing generator function. Returns an iterator object.
Parameters:
data: (iterable) line-based text data to parse
(e.g. sys.stdin or str.splitlines())
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
ignore_exceptions: (boolean) ignore parsing exceptions if True
Yields:
Dictionary. Raw or processed structured data.
Returns:
Iterator object (generator)
### Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

300
docs/parsers/lsblk.md Normal file
View File

@@ -0,0 +1,300 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.lsblk"></a>
# jc.parsers.lsblk
jc - JSON Convert `lsblk` command output parser
Usage (cli):
$ lsblk | jc --lsblk
or
$ jc lsblk
Usage (module):
import jc
result = jc.parse('lsblk', lsblk_command_output)
Schema:
[
{
"name": string,
"maj_min": string,
"rm": boolean,
"size": string,
"ro": boolean,
"type": string,
"mountpoint": string,
"kname": string,
"fstype": string,
"label": string,
"uuid": string,
"partlabel": string,
"partuuid": string,
"ra": integer,
"model": string,
"serial": string,
"state": string,
"owner": string,
"group": string,
"mode": string,
"alignment": integer,
"min_io": integer,
"opt_io": integer,
"phy_sec": integer,
"log_sec": integer,
"rota": boolean,
"sched": string,
"rq_size": integer,
"disc_aln": integer,
"disc_gran": string,
"disc_max": string,
"disc_zero": boolean,
"wsame": string,
"wwn": string,
"rand": boolean,
"pkname": string,
"hctl": string,
"tran": string,
"rev": string,
"vendor": string
}
]
Examples:
$ lsblk | jc --lsblk -p
[
{
"name": "sda",
"maj_min": "8:0",
"rm": false,
"size": "20G",
"ro": false,
"type": "disk",
"mountpoint": null
},
{
"name": "sda1",
"maj_min": "8:1",
"rm": false,
"size": "1G",
"ro": false,
"type": "part",
"mountpoint": "/boot"
},
...
]
$ lsblk -o +KNAME,FSTYPE,LABEL,UUID,PARTLABEL,PARTUUID,RA,MODEL,SERIAL,\\
STATE,OWNER,GROUP,MODE,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,\\
SCHED,RQ-SIZE,DISC-ALN,DISC-GRAN,DISC-MAX,DISC-ZERO,WSAME,WWN,RAND,\\
PKNAME,HCTL,TRAN,REV,VENDOR | jc --lsblk -p
[
{
"name": "sda",
"maj_min": "8:0",
"rm": false,
"size": "20G",
"ro": false,
"type": "disk",
"mountpoint": null,
"kname": "sda",
"fstype": null,
"label": null,
"uuid": null,
"partlabel": null,
"partuuid": null,
"ra": 4096,
"model": "VMware Virtual S",
"serial": null,
"state": "running",
"owner": "root",
"group": "disk",
"mode": "brw-rw----",
"alignment": 0,
"min_io": 512,
"opt_io": 0,
"phy_sec": 512,
"log_sec": 512,
"rota": true,
"sched": "deadline",
"rq_size": 128,
"disc_aln": 0,
"disc_gran": "0B",
"disc_max": "0B",
"disc_zero": false,
"wsame": "32M",
"wwn": null,
"rand": true,
"pkname": null,
"hctl": "0:0:0:0",
"tran": "spi",
"rev": "1.0",
"vendor": "VMware,"
},
{
"name": "sda1",
"maj_min": "8:1",
"rm": false,
"size": "1G",
"ro": false,
"type": "part",
"mountpoint": "/boot",
"kname": "sda1",
"fstype": "xfs",
"label": null,
"uuid": "05d927bb-5875-49e3-ada1-7f46cb31c932",
"partlabel": null,
"partuuid": null,
"ra": 4096,
"model": null,
"serial": null,
"state": null,
"owner": "root",
"group": "disk",
"mode": "brw-rw----",
"alignment": 0,
"min_io": 512,
"opt_io": 0,
"phy_sec": 512,
"log_sec": 512,
"rota": true,
"sched": "deadline",
"rq_size": 128,
"disc_aln": 0,
"disc_gran": "0B",
"disc_max": "0B",
"disc_zero": false,
"wsame": "32M",
"wwn": null,
"rand": true,
"pkname": "sda",
"hctl": null,
"tran": null,
"rev": null,
"vendor": null
},
...
]
$ lsblk -o +KNAME,FSTYPE,LABEL,UUID,PARTLABEL,PARTUUID,RA,MODEL,SERIAL,\\
STATE,OWNER,GROUP,MODE,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,\\
SCHED,RQ-SIZE,DISC-ALN,DISC-GRAN,DISC-MAX,DISC-ZERO,WSAME,WWN,RAND,\\
PKNAME,HCTL,TRAN,REV,VENDOR | jc --lsblk -p -r
[
{
"name": "sda",
"maj_min": "8:0",
"rm": "0",
"size": "20G",
"ro": "0",
"type": "disk",
"mountpoint": null,
"kname": "sda",
"fstype": null,
"label": null,
"uuid": null,
"partlabel": null,
"partuuid": null,
"ra": "4096",
"model": "VMware Virtual S",
"serial": null,
"state": "running",
"owner": "root",
"group": "disk",
"mode": "brw-rw----",
"alignment": "0",
"min_io": "512",
"opt_io": "0",
"phy_sec": "512",
"log_sec": "512",
"rota": "1",
"sched": "deadline",
"rq_size": "128",
"disc_aln": "0",
"disc_gran": "0B",
"disc_max": "0B",
"disc_zero": "0",
"wsame": "32M",
"wwn": null,
"rand": "1",
"pkname": null,
"hctl": "0:0:0:0",
"tran": "spi",
"rev": "1.0",
"vendor": "VMware,"
},
{
"name": "sda1",
"maj_min": "8:1",
"rm": "0",
"size": "1G",
"ro": "0",
"type": "part",
"mountpoint": "/boot",
"kname": "sda1",
"fstype": "xfs",
"label": null,
"uuid": "05d927bb-5875-49e3-ada1-7f46cb31c932",
"partlabel": null,
"partuuid": null,
"ra": "4096",
"model": null,
"serial": null,
"state": null,
"owner": "root",
"group": "disk",
"mode": "brw-rw----",
"alignment": "0",
"min_io": "512",
"opt_io": "0",
"phy_sec": "512",
"log_sec": "512",
"rota": "1",
"sched": "deadline",
"rq_size": "128",
"disc_aln": "0",
"disc_gran": "0B",
"disc_max": "0B",
"disc_zero": "0",
"wsame": "32M",
"wwn": null,
"rand": "1",
"pkname": "sda",
"hctl": null,
"tran": null,
"rev": null,
"vendor": null
},
...
]
<a id="jc.parsers.lsblk.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,151 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.lsmod"></a>
# jc.parsers.lsmod
jc - JSON Convert `lsmod` command output parser
Usage (cli):
$ lsmod | jc --lsmod
or
$ jc lsmod
Usage (module):
import jc
result = jc.parse('lsmod', lsmod_command_output)
Schema:
[
{
"module": string,
"size": integer,
"used": integer,
"by": [
string
]
}
]
Examples:
$ lsmod | jc --lsmod -p
[
...
{
"module": "nf_nat",
"size": 26583,
"used": 3,
"by": [
"nf_nat_ipv4",
"nf_nat_ipv6",
"nf_nat_masquerade_ipv4"
]
},
{
"module": "iptable_mangle",
"size": 12695,
"used": 1
},
{
"module": "iptable_security",
"size": 12705,
"used": 1
},
{
"module": "iptable_raw",
"size": 12678,
"used": 1
},
{
"module": "nf_conntrack",
"size": 139224,
"used": 7,
"by": [
"nf_nat",
"nf_nat_ipv4",
"nf_nat_ipv6",
"xt_conntrack",
"nf_nat_masquerade_ipv4",
"nf_conntrack_ipv4",
"nf_conntrack_ipv6"
]
},
...
]
$ lsmod | jc --lsmod -p -r
[
...
{
"module": "nf_conntrack",
"size": "139224",
"used": "7",
"by": [
"nf_nat",
"nf_nat_ipv4",
"nf_nat_ipv6",
"xt_conntrack",
"nf_nat_masquerade_ipv4",
"nf_conntrack_ipv4",
"nf_conntrack_ipv6"
]
},
{
"module": "ip_set",
"size": "45799",
"used": "0"
},
{
"module": "nfnetlink",
"size": "14519",
"used": "1",
"by": [
"ip_set"
]
},
{
"module": "ebtable_filter",
"size": "12827",
"used": "1"
},
{
"module": "ebtables",
"size": "35009",
"used": "2",
"by": [
"ebtable_nat",
"ebtable_filter"
]
},
...
]
<a id="jc.parsers.lsmod.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,145 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.lsof"></a>
# jc.parsers.lsof
jc - JSON Convert `lsof` command output parser
Usage (cli):
$ lsof | jc --lsof
or
$ jc lsof
Usage (module):
import jc
result = jc.parse('lsof', lsof_command_output)
Schema:
[
{
"command": string,
"pid": integer,
"tid": integer,
"user": string,
"fd": string,
"type": string,
"device": string,
"size_off": integer,
"node": integer,
"name": string
}
]
Examples:
$ sudo lsof | jc --lsof -p
[
{
"command": "systemd",
"pid": 1,
"tid": null,
"user": "root",
"fd": "cwd",
"type": "DIR",
"device": "253,0",
"size_off": 224,
"node": 64,
"name": "/"
},
{
"command": "systemd",
"pid": 1,
"tid": null,
"user": "root",
"fd": "rtd",
"type": "DIR",
"device": "253,0",
"size_off": 224,
"node": 64,
"name": "/"
},
{
"command": "systemd",
"pid": 1,
"tid": null,
"user": "root",
"fd": "txt",
"type": "REG",
"device": "253,0",
"size_off": 1624520,
"node": 50360451,
"name": "/usr/lib/systemd/systemd"
},
...
]
$ sudo lsof | jc --lsof -p -r
[
{
"command": "systemd",
"pid": "1",
"tid": null,
"user": "root",
"fd": "cwd",
"type": "DIR",
"device": "8,2",
"size_off": "4096",
"node": "2",
"name": "/"
},
{
"command": "systemd",
"pid": "1",
"tid": null,
"user": "root",
"fd": "rtd",
"type": "DIR",
"device": "8,2",
"size_off": "4096",
"node": "2",
"name": "/"
},
{
"command": "systemd",
"pid": "1",
"tid": null,
"user": "root",
"fd": "txt",
"type": "REG",
"device": "8,2",
"size_off": "1595792",
"node": "668802",
"name": "/lib/systemd/systemd"
},
...
]
<a id="jc.parsers.lsof.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

287
docs/parsers/lsusb.md Normal file
View File

@@ -0,0 +1,287 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.lsusb"></a>
# jc.parsers.lsusb
jc - JSON Convert `lsusb` command output parser
Supports the `-v` option or no options.
Usage (cli):
$ lsusb -v | jc --lsusb
or
$ jc lsusb -v
Usage (module):
import jc
result = jc.parse('lsusb', lsusb_command_output)
Schema:
Note: <item> object keynames are assigned directly from the lsusb
output. If there are duplicate <item> names in a section, only the
last one is converted.
[
{
"bus": string,
"device": string,
"id": string,
"description": string,
"device_descriptor": {
"<item>": {
"value": string,
"description": string,
"attributes": [
string
]
},
"configuration_descriptor": {
"<item>": {
"value": string,
"description": string,
"attributes": [
string
]
},
"interface_association": {
"<item>": {
"value": string,
"description": string,
"attributes": [
string
]
}
},
"interface_descriptors": [
{
"<item>": {
"value": string,
"description": string,
"attributes": [
string
]
},
"cdc_header": {
"<item>": {
"value": string,
"description": string,
"attributes": [
string
]
}
},
"cdc_call_management": {
"<item>": {
"value": string,
"description": string,
"attributes": [
string
]
}
},
"cdc_acm": {
"<item>": {
"value": string,
"description": string,
"attributes": [
string
]
}
},
"cdc_union": {
"<item>": {
"value": string,
"description": string,
"attributes": [
string
]
}
},
"endpoint_descriptors": [
{
"<item>": {
"value": string,
"description": string,
"attributes": [
string
]
}
}
]
}
]
}
},
"hub_descriptor": {
"<item>": {
"value": string,
"description": string,
"attributes": [
string,
]
},
"hub_port_status": {
"<item>": {
"value": string,
"attributes": [
string
]
}
}
},
"device_status": {
"value": string,
"description": string
}
}
]
Examples:
$ lsusb -v | jc --lsusb -p
[
{
"bus": "002",
"device": "001",
"id": "1d6b:0001",
"description": "Linux Foundation 1.1 root hub",
"device_descriptor": {
"bLength": {
"value": "18"
},
"bDescriptorType": {
"value": "1"
},
"bcdUSB": {
"value": "1.10"
},
...
"bNumConfigurations": {
"value": "1"
},
"configuration_descriptor": {
"bLength": {
"value": "9"
},
...
"iConfiguration": {
"value": "0"
},
"bmAttributes": {
"value": "0xe0",
"attributes": [
"Self Powered",
"Remote Wakeup"
]
},
"MaxPower": {
"description": "0mA"
},
"interface_descriptors": [
{
"bLength": {
"value": "9"
},
...
"bInterfaceProtocol": {
"value": "0",
"description": "Full speed (or root) hub"
},
"iInterface": {
"value": "0"
},
"endpoint_descriptors": [
{
"bLength": {
"value": "7"
},
...
"bmAttributes": {
"value": "3",
"attributes": [
"Transfer Type Interrupt",
"Synch Type None",
"Usage Type Data"
]
},
"wMaxPacketSize": {
"value": "0x0002",
"description": "1x 2 bytes"
},
"bInterval": {
"value": "255"
}
}
]
}
]
}
},
"hub_descriptor": {
"bLength": {
"value": "9"
},
...
"wHubCharacteristic": {
"value": "0x000a",
"attributes": [
"No power switching (usb 1.0)",
"Per-port overcurrent protection"
]
},
...
"hub_port_status": {
"Port 1": {
"value": "0000.0103",
"attributes": [
"power",
"enable",
"connect"
]
},
"Port 2": {
"value": "0000.0103",
"attributes": [
"power",
"enable",
"connect"
]
}
}
},
"device_status": {
"value": "0x0001",
"description": "Self Powered"
}
}
]
<a id="jc.parsers.lsusb.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,101 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.mount"></a>
# jc.parsers.mount
jc - JSON Convert `mount` command output parser
Usage (cli):
$ mount | jc --mount
or
$ jc mount
Usage (module):
import jc
result = jc.parse('mount', mount_command_output)
Schema:
[
{
"filesystem": string,
"mount_point": string,
"type": string,
"access": [
string
]
}
]
Example:
$ mount | jc --mount -p
[
{
"filesystem": "sysfs",
"mount_point": "/sys",
"type": "sysfs",
"access": [
"rw",
"nosuid",
"nodev",
"noexec",
"relatime"
]
},
{
"filesystem": "proc",
"mount_point": "/proc",
"type": "proc",
"access": [
"rw",
"nosuid",
"nodev",
"noexec",
"relatime"
]
},
{
"filesystem": "udev",
"mount_point": "/dev",
"type": "devtmpfs",
"access": [
"rw",
"nosuid",
"relatime",
"size=977500k",
"nr_inodes=244375",
"mode=755"
]
},
...
]
<a id="jc.parsers.mount.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, freebsd
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

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

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

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

381
docs/parsers/netstat.md Normal file
View File

@@ -0,0 +1,381 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.netstat"></a>
# jc.parsers.netstat
jc - JSON Convert `netstat` command output parser
Caveats:
- Use of multiple `l` options is not supported on OSX (e.g. `netstat -rlll`)
- Use of the `A` option is not supported on OSX when using the `r` option
(e.g. `netstat -rA`)
Usage (cli):
$ netstat | jc --netstat
or
$ jc netstat
Usage (module):
import jc
result = jc.parse('netstat', netstat_command_output)
Schema:
[
{
"proto": string,
"recv_q": integer,
"send_q": integer,
"transport_protocol" string,
"network_protocol": string,
"local_address": string,
"local_port": string,
"local_port_num": integer,
"foreign_address": string,
"foreign_port": string,
"foreign_port_num": integer,
"state": string,
"program_name": string,
"pid": integer,
"user": string,
"security_context": string,
"refcnt": integer,
"flags": string,
"type": string,
"inode": integer,
"path": string,
"kind": string,
"address": string,
"unix_inode": string,
"conn": string,
"refs": string,
"nextref": string,
"name": string,
"unit": integer,
"vendor": integer,
"class": integer,
"subcla": integer,
"unix_flags": integer,
"pcbcount": integer,
"rcvbuf": integer,
"sndbuf": integer,
"rxbytes": integer,
"txbytes": integer,
"destination": string,
"gateway": string,
"route_flags": string,
"route_flags_pretty": [
string,
]
"route_refs": integer,
"use": integer,
"mtu": integer,
"expire": string,
"genmask": string,
"mss": integer,
"window": integer,
"irtt": integer,
"iface": string,
"metric": integer,
"network": string,
"address": string,
"ipkts": integer, # - = null
"ierrs": integer, # - = null
"idrop": integer, # - = null
"opkts": integer, # - = null
"oerrs": integer, # - = null
"coll": integer, # - = null
"rx_ok": integer,
"rx_err": integer,
"rx_drp": integer,
"rx_ovr": integer,
"tx_ok": integer,
"tx_err": integer,
"tx_drp": integer,
"tx_ovr": integer,
"flg": string,
"ibytes": integer,
"obytes": integer,
"r_mbuf": integer,
"s_mbuf": integer,
"r_clus": integer,
"s_clus": integer,
"r_hiwa": integer,
"s_hiwa": integer,
"r_lowa": integer,
"s_lowa": integer,
"r_bcnt": integer,
"s_bcnt": integer,
"r_bmax": integer,
"s_bmax": integer,
"rexmit": integer,
"ooorcv": integer,
"0_win": integer,
"rexmt": float,
"persist": float,
"keep": float,
"2msl": float,
"delack": float,
"rcvtime": float,
}
]
Examples:
# netstat -apee | jc --netstat -p
[
{
"proto": "tcp",
"recv_q": 0,
"send_q": 0,
"local_address": "localhost",
"foreign_address": "0.0.0.0",
"state": "LISTEN",
"user": "systemd-resolve",
"inode": 26958,
"program_name": "systemd-resolve",
"kind": "network",
"pid": 887,
"local_port": "domain",
"foreign_port": "*",
"transport_protocol": "tcp",
"network_protocol": "ipv4"
},
{
"proto": "tcp",
"recv_q": 0,
"send_q": 0,
"local_address": "0.0.0.0",
"foreign_address": "0.0.0.0",
"state": "LISTEN",
"user": "root",
"inode": 30499,
"program_name": "sshd",
"kind": "network",
"pid": 1186,
"local_port": "ssh",
"foreign_port": "*",
"transport_protocol": "tcp",
"network_protocol": "ipv4"
},
{
"proto": "tcp",
"recv_q": 0,
"send_q": 0,
"local_address": "localhost",
"foreign_address": "localhost",
"state": "ESTABLISHED",
"user": "root",
"inode": 46829,
"program_name": "sshd: root",
"kind": "network",
"pid": 2242,
"local_port": "ssh",
"foreign_port": "52186",
"transport_protocol": "tcp",
"network_protocol": "ipv4",
"foreign_port_num": 52186
},
{
"proto": "tcp",
"recv_q": 0,
"send_q": 0,
"local_address": "localhost",
"foreign_address": "localhost",
"state": "ESTABLISHED",
"user": "root",
"inode": 46828,
"program_name": "ssh",
"kind": "network",
"pid": 2241,
"local_port": "52186",
"foreign_port": "ssh",
"transport_protocol": "tcp",
"network_protocol": "ipv4",
"local_port_num": 52186
},
{
"proto": "tcp6",
"recv_q": 0,
"send_q": 0,
"local_address": "[::]",
"foreign_address": "[::]",
"state": "LISTEN",
"user": "root",
"inode": 30510,
"program_name": "sshd",
"kind": "network",
"pid": 1186,
"local_port": "ssh",
"foreign_port": "*",
"transport_protocol": "tcp",
"network_protocol": "ipv6"
},
{
"proto": "udp",
"recv_q": 0,
"send_q": 0,
"local_address": "localhost",
"foreign_address": "0.0.0.0",
"state": null,
"user": "systemd-resolve",
"inode": 26957,
"program_name": "systemd-resolve",
"kind": "network",
"pid": 887,
"local_port": "domain",
"foreign_port": "*",
"transport_protocol": "udp",
"network_protocol": "ipv4"
},
{
"proto": "raw6",
"recv_q": 0,
"send_q": 0,
"local_address": "[::]",
"foreign_address": "[::]",
"state": "7",
"user": "systemd-network",
"inode": 27001,
"program_name": "systemd-network",
"kind": "network",
"pid": 867,
"local_port": "ipv6-icmp",
"foreign_port": "*",
"transport_protocol": null,
"network_protocol": "ipv6"
},
{
"proto": "unix",
"refcnt": 2,
"flags": null,
"type": "DGRAM",
"state": null,
"inode": 33322,
"program_name": "systemd",
"path": "/run/user/1000/systemd/notify",
"kind": "socket",
"pid": 1607
},
{
"proto": "unix",
"refcnt": 2,
"flags": "ACC",
"type": "SEQPACKET",
"state": "LISTENING",
"inode": 20835,
"program_name": "init",
"path": "/run/udev/control",
"kind": "socket",
"pid": 1
},
...
]
$ netstat -r | jc --netstat -p
[
{
"destination": "default",
"gateway": "gateway",
"genmask": "0.0.0.0",
"route_flags": "UG",
"mss": 0,
"window": 0,
"irtt": 0,
"iface": "ens33",
"kind": "route",
"route_flags_pretty": [
"UP",
"GATEWAY"
]
},
{
"destination": "172.17.0.0",
"gateway": "0.0.0.0",
"genmask": "255.255.0.0",
"route_flags": "U",
"mss": 0,
"window": 0,
"irtt": 0,
"iface": "docker0",
"kind": "route",
"route_flags_pretty": [
"UP"
]
},
{
"destination": "192.168.71.0",
"gateway": "0.0.0.0",
"genmask": "255.255.255.0",
"route_flags": "U",
"mss": 0,
"window": 0,
"irtt": 0,
"iface": "ens33",
"kind": "route",
"route_flags_pretty": [
"UP"
]
}
]
$ netstat -i | jc --netstat -p
[
{
"iface": "ens33",
"mtu": 1500,
"rx_ok": 476,
"rx_err": 0,
"rx_drp": 0,
"rx_ovr": 0,
"tx_ok": 312,
"tx_err": 0,
"tx_drp": 0,
"tx_ovr": 0,
"flg": "BMRU",
"kind": "interface"
},
{
"iface": "lo",
"mtu": 65536,
"rx_ok": 0,
"rx_err": 0,
"rx_drp": 0,
"rx_ovr": 0,
"tx_ok": 0,
"tx_err": 0,
"tx_drp": 0,
"tx_ovr": 0,
"flg": "LRU",
"kind": "interface"
}
]
<a id="jc.parsers.netstat.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, freebsd
Version 1.12 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

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

232
docs/parsers/ntpq.md Normal file
View File

@@ -0,0 +1,232 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ntpq"></a>
# jc.parsers.ntpq
jc - JSON Convert `ntpq -p` command output parser
Usage (cli):
$ ntpq -p | jc --ntpq
or
$ jc ntpq -p
Usage (module):
import jc
result = jc.parse('ntpq', ntpq_command_output)
Schema:
[
{
"state": string, # space/~ converted to null
"remote": string,
"refid": string,
"st": integer,
"t": string,
"when": integer, # - converted to null
"poll": integer,
"reach": integer,
"delay": float,
"offset": float,
"jitter": float
},
]
Examples:
$ ntpq -p | jc --ntpq -p
[
{
"remote": "44.190.6.254",
"refid": "127.67.113.92",
"st": 2,
"t": "u",
"when": 1,
"poll": 64,
"reach": 1,
"delay": 23.399,
"offset": -2.805,
"jitter": 2.131,
"state": null
},
{
"remote": "ntp.wdc1.us.lea",
"refid": "130.133.1.10",
"st": 2,
"t": "u",
"when": null,
"poll": 64,
"reach": 1,
"delay": 93.053,
"offset": -0.807,
"jitter": 2.839,
"state": null
},
{
"remote": "clock.team-cymr",
"refid": "204.9.54.119",
"st": 2,
"t": "u",
"when": null,
"poll": 64,
"reach": 1,
"delay": 70.337,
"offset": -2.909,
"jitter": 2.6,
"state": null
},
{
"remote": "mirror1.sjc02.s",
"refid": "216.218.254.202",
"st": 2,
"t": "u",
"when": 2,
"poll": 64,
"reach": 1,
"delay": 29.325,
"offset": 1.044,
"jitter": 4.069,
"state": null,
}
]
$ ntpq -pn| jc --ntpq -p
[
{
"remote": "44.190.6.254",
"refid": "127.67.113.92",
"st": 2,
"t": "u",
"when": 66,
"poll": 64,
"reach": 377,
"delay": 22.69,
"offset": -0.392,
"jitter": 2.085,
"state": "+"
},
{
"remote": "108.59.2.24",
"refid": "130.133.1.10",
"st": 2,
"t": "u",
"when": 63,
"poll": 64,
"reach": 377,
"delay": 90.805,
"offset": 2.84,
"jitter": 1.908,
"state": "-"
},
{
"remote": "38.229.71.1",
"refid": "204.9.54.119",
"st": 2,
"t": "u",
"when": 64,
"poll": 64,
"reach": 377,
"delay": 68.699,
"offset": -0.61,
"jitter": 2.576,
"state": "+"
},
{
"remote": "72.5.72.15",
"refid": "216.218.254.202",
"st": 2,
"t": "u",
"when": 63,
"poll": 64,
"reach": 377,
"delay": 22.654,
"offset": 0.231,
"jitter": 1.964,
"state": "*"
}
]
$ ntpq -pn| jc --ntpq -p -r
[
{
"s": "+",
"remote": "44.190.6.254",
"refid": "127.67.113.92",
"st": "2",
"t": "u",
"when": "66",
"poll": "64",
"reach": "377",
"delay": "22.690",
"offset": "-0.392",
"jitter": "2.085"
},
{
"s": "-",
"remote": "108.59.2.24",
"refid": "130.133.1.10",
"st": "2",
"t": "u",
"when": "63",
"poll": "64",
"reach": "377",
"delay": "90.805",
"offset": "2.840",
"jitter": "1.908"
},
{
"s": "+",
"remote": "38.229.71.1",
"refid": "204.9.54.119",
"st": "2",
"t": "u",
"when": "64",
"poll": "64",
"reach": "377",
"delay": "68.699",
"offset": "-0.610",
"jitter": "2.576"
},
{
"s": "*",
"remote": "72.5.72.15",
"refid": "216.218.254.202",
"st": "2",
"t": "u",
"when": "63",
"poll": "64",
"reach": "377",
"delay": "22.654",
"offset": "0.231",
"jitter": "1.964"
}
]
<a id="jc.parsers.ntpq.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, freebsd
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,120 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.passwd"></a>
# jc.parsers.passwd
jc - JSON Convert `/etc/passwd` file Parser
Usage (cli):
$ cat /etc/passwd | jc --passwd
Usage (module):
import jc
result = jc.parse('passwd', passwd_file_output)
Schema:
[
{
"username": string,
"password": string,
"uid": integer,
"gid": integer,
"comment": string,
"home": string,
"shell": string
}
]
Examples:
$ cat /etc/passwd | jc --passwd -p
[
{
"username": "nobody",
"password": "*",
"uid": -2,
"gid": -2,
"comment": "Unprivileged User",
"home": "/var/empty",
"shell": "/usr/bin/false"
},
{
"username": "root",
"password": "*",
"uid": 0,
"gid": 0,
"comment": "System Administrator",
"home": "/var/root",
"shell": "/bin/sh"
},
{
"username": "daemon",
"password": "*",
"uid": 1,
"gid": 1,
"comment": "System Services",
"home": "/var/root",
"shell": "/usr/bin/false"
},
...
]
$ cat /etc/passwd | jc --passwd -p -r
[
{
"username": "nobody",
"password": "*",
"uid": "-2",
"gid": "-2",
"comment": "Unprivileged User",
"home": "/var/empty",
"shell": "/usr/bin/false"
},
{
"username": "root",
"password": "*",
"uid": "0",
"gid": "0",
"comment": "System Administrator",
"home": "/var/root",
"shell": "/bin/sh"
},
{
"username": "daemon",
"password": "*",
"uid": "1",
"gid": "1",
"comment": "System Services",
"home": "/var/root",
"shell": "/usr/bin/false"
},
...
]
<a id="jc.parsers.passwd.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, aix, freebsd
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

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

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

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

188
docs/parsers/ping.md Normal file
View File

@@ -0,0 +1,188 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ping"></a>
# jc.parsers.ping
jc - JSON Convert `ping` command output parser
Supports `ping` and `ping6` output.
Usage (cli):
Note: Use the ping `-c` (count) option, otherwise data will not be
piped to `jc`.
$ ping -c 3 1.2.3.4 | jc --ping
or
$ jc ping -c 3 1.2.3.4
Usage (module):
import jc
result = jc.parse('ping', ping_command_output)
Schema:
{
"source_ip": string,
"destination_ip": string,
"data_bytes": integer,
"pattern": string, # null if not set
"destination": string,
"packets_transmitted": integer,
"packets_received": integer,
"packet_loss_percent": float,
"duplicates": integer,
"round_trip_ms_min": float,
"round_trip_ms_avg": float,
"round_trip_ms_max": float,
"round_trip_ms_stddev": float,
"responses": [
{
"type": string, # [0]
"unparsed_line": string, # [1]
"timestamp": float,
"bytes": integer,
"response_ip": string,
"icmp_seq": integer,
"ttl": integer,
"time_ms": float,
"duplicate": boolean,
"vr": integer, # [2]
"hl": integer, # [2]
"tos": integer, # [2]
"len": integer, # [2]
"id": integer, # [2]
"flg": integer, # [2]
"off": integer, # [2]
"pro": integer, # [2]
"cks": ingeger, # [2]
"src": string,
"dst": string
}
]
}
[0] 'reply', 'timeout', 'unparsable_line', etc. See
`_error_type.type_map` for all options
[1] only if an 'unparsable_line' type
[2] hex value converted to decimal
Examples:
$ ping -c 3 -p ff cnn.com | jc --ping -p
{
"destination_ip": "151.101.1.67",
"data_bytes": 56,
"pattern": "0xff",
"destination": "cnn.com",
"packets_transmitted": 3,
"packets_received": 3,
"packet_loss_percent": 0.0,
"duplicates": 0,
"round_trip_ms_min": 28.015,
"round_trip_ms_avg": 32.848,
"round_trip_ms_max": 39.376,
"round_trip_ms_stddev": 4.79,
"responses": [
{
"type": "reply",
"bytes": 64,
"response_ip": "151.101.1.67",
"icmp_seq": 0,
"ttl": 59,
"time_ms": 28.015,
"duplicate": false
},
{
"type": "reply",
"bytes": 64,
"response_ip": "151.101.1.67",
"icmp_seq": 1,
"ttl": 59,
"time_ms": 39.376,
"duplicate": false
},
{
"type": "reply",
"bytes": 64,
"response_ip": "151.101.1.67",
"icmp_seq": 2,
"ttl": 59,
"time_ms": 31.153,
"duplicate": false
}
]
}
$ ping -c 3 -p ff cnn.com | jc --ping -p -r
{
"destination_ip": "151.101.129.67",
"data_bytes": "56",
"pattern": "0xff",
"destination": "cnn.com",
"packets_transmitted": "3",
"packets_received": "3",
"packet_loss_percent": "0.0",
"duplicates": "0",
"round_trip_ms_min": "25.078",
"round_trip_ms_avg": "29.543",
"round_trip_ms_max": "32.553",
"round_trip_ms_stddev": "3.221",
"responses": [
{
"type": "reply",
"bytes": "64",
"response_ip": "151.101.129.67",
"icmp_seq": "0",
"ttl": "59",
"time_ms": "25.078",
"duplicate": false
},
{
"type": "reply",
"bytes": "64",
"response_ip": "151.101.129.67",
"icmp_seq": "1",
"ttl": "59",
"time_ms": "30.999",
"duplicate": false
},
{
"type": "reply",
"bytes": "64",
"response_ip": "151.101.129.67",
"icmp_seq": "2",
"ttl": "59",
"time_ms": "32.553",
"duplicate": false
}
]
}
<a id="jc.parsers.ping.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, freebsd
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,113 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ping_s"></a>
# jc.parsers.ping\_s
jc - JSON Convert `ping` command output streaming parser
> This streaming parser outputs JSON Lines (cli) or returns a Generator
iterator of Dictionaries (module)
Supports `ping` and `ping6` output.
Usage (cli):
$ ping | jc --ping-s
> Note: When piping `jc` converted `ping` output to other processes it may
appear the output is hanging due to the OS pipe buffers. This is because
`ping` output is too small to quickly fill up the buffer. Use the `-u`
option to unbuffer the `jc` output if you would like immediate output.
See the [readme](https://github.com/kellyjonbrazil/jc/tree/master#unbuffering-output)
for more information.
Usage (module):
import jc
result = jc.parse('ping_s', ping_command_output.splitlines())
for item in result:
# do something
Schema:
{
"type": string, # [0]
"source_ip": string,
"destination_ip": string,
"sent_bytes": integer,
"pattern": string, # (null if not set)
"destination": string,
"timestamp": float,
"response_bytes": integer,
"response_ip": string,
"icmp_seq": integer,
"ttl": integer,
"time_ms": float,
"duplicate": boolean,
"packets_transmitted": integer,
"packets_received": integer,
"packet_loss_percent": float,
"duplicates": integer,
"round_trip_ms_min": float,
"round_trip_ms_avg": float,
"round_trip_ms_max": float,
"round_trip_ms_stddev": float,
# below object only exists if using -qq or ignore_exceptions=True
"_jc_meta": {
"success": boolean, # false if error parsing
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
}
[0] 'reply', 'timeout', 'summary', etc. See `_error_type.type_map`
for all options.
Examples:
$ ping 1.1.1.1 | jc --ping-s
{"type":"reply","destination_ip":"1.1.1.1","sent_bytes":56,"patte...}
{"type":"reply","destination_ip":"1.1.1.1","sent_bytes":56,"patte...}
{"type":"reply","destination_ip":"1.1.1.1","sent_bytes":56,"patte...}
...
$ ping 1.1.1.1 | jc --ping-s -r
{"type":"reply","destination_ip":"1.1.1.1","sent_bytes":"56","patte...}
{"type":"reply","destination_ip":"1.1.1.1","sent_bytes":"56","patte...}
{"type":"reply","destination_ip":"1.1.1.1","sent_bytes":"56","patte...}
...
<a id="jc.parsers.ping_s.parse"></a>
### parse
```python
@add_jc_meta
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
```
Main text parsing generator function. Returns an iterator object.
Parameters:
data: (iterable) line-based text data to parse
(e.g. sys.stdin or str.splitlines())
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
ignore_exceptions: (boolean) ignore parsing exceptions if True
Yields:
Dictionary. Raw or processed structured data.
Returns:
Iterator object (generator)
### Parser Information
Compatibility: linux, darwin, freebsd
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,73 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.pip_list"></a>
# jc.parsers.pip\_list
jc - JSON Convert `pip-list` command output parser
Usage (cli):
$ pip list | jc --pip-list
or
$ jc pip list
Usage (module):
import jc
result = jc.parse('pip_list', pip_list_command_output)
Schema:
[
{
"package": string,
"version": string,
"location": string
}
]
Examples:
$ pip list | jc --pip-list -p
[
{
"package": "ansible",
"version": "2.8.5"
},
{
"package": "antlr4-python3-runtime",
"version": "4.7.2"
},
{
"package": "asn1crypto",
"version": "0.24.0"
},
...
]
<a id="jc.parsers.pip_list.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,91 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.pip_show"></a>
# jc.parsers.pip\_show
jc - JSON Convert `pip-show` command output parser
Usage (cli):
$ pip show | jc --pip-show
or
$ jc pip show
Usage (module):
import jc
result = jc.parse('pip_show', pip_show_command_output)
Schema:
[
{
"name": string,
"version": string,
"summary": string,
"home_page": string,
"author": string,
"author_email": string,
"license": string,
"location": string,
"requires": string,
"required_by": string
}
]
Examples:
$ pip show wrapt jc wheel | jc --pip-show -p
[
{
"name": "wrapt",
"version": "1.11.2",
"summary": "Module for decorators, wrappers and monkey patching.",
"home_page": "https://github.com/GrahamDumpleton/wrapt",
"author": "Graham Dumpleton",
"author_email": "Graham.Dumpleton@gmail.com",
"license": "BSD",
"location": "/usr/local/lib/python3.7/site-packages",
"requires": null,
"required_by": "astroid"
},
{
"name": "wheel",
"version": "0.33.4",
"summary": "A built-package format for Python.",
"home_page": "https://github.com/pypa/wheel",
"author": "Daniel Holth",
"author_email": "dholth@fastmail.fm",
"license": "MIT",
"location": "/usr/local/lib/python3.7/site-packages",
"requires": null,
"required_by": null
}
]
<a id="jc.parsers.pip_show.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

232
docs/parsers/ps.md Normal file
View File

@@ -0,0 +1,232 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ps"></a>
# jc.parsers.ps
jc - JSON Convert `ps` command output parser
`ps` options supported:
- `ef`
- `axu`
Usage (cli):
$ ps | jc --ps
or
$ jc ps
Usage (module):
import jc
result = jc.parse('ps', ps_command_output)
Schema:
[
{
"uid": string,
"pid": integer,
"ppid": integer,
"c": integer,
"stime": string,
"tty": string, # ? or ?? = Null
"tt": string, # ?? = Null
"time": string,
"cmd": string,
"user": string,
"cpu_percent": float,
"mem_percent": float,
"vsz": integer,
"rss": integer,
"stat": string,
"start": string,
"command": string
}
]
Examples:
$ ps -ef | jc --ps -p
[
{
"uid": "root",
"pid": 1,
"ppid": 0,
"c": 0,
"stime": "Nov01",
"tty": null,
"time": "00:00:11",
"cmd": "/usr/lib/systemd/systemd --switched-root --system --dese..."
},
{
"uid": "root",
"pid": 2,
"ppid": 0,
"c": 0,
"stime": "Nov01",
"tty": null,
"time": "00:00:00",
"cmd": "[kthreadd]"
},
{
"uid": "root",
"pid": 4,
"ppid": 2,
"c": 0,
"stime": "Nov01",
"tty": null,
"time": "00:00:00",
"cmd": "[kworker/0:0H]"
},
...
]
$ ps -ef | jc --ps -p -r
[
{
"uid": "root",
"pid": "1",
"ppid": "0",
"c": "0",
"stime": "Nov01",
"tty": "?",
"time": "00:00:11",
"cmd": "/usr/lib/systemd/systemd --switched-root --system --dese..."
},
{
"uid": "root",
"pid": "2",
"ppid": "0",
"c": "0",
"stime": "Nov01",
"tty": "?",
"time": "00:00:00",
"cmd": "[kthreadd]"
},
{
"uid": "root",
"pid": "4",
"ppid": "2",
"c": "0",
"stime": "Nov01",
"tty": "?",
"time": "00:00:00",
"cmd": "[kworker/0:0H]"
},
...
]
$ ps axu | jc --ps -p
[
{
"user": "root",
"pid": 1,
"cpu_percent": 0.0,
"mem_percent": 0.1,
"vsz": 128072,
"rss": 6784,
"tty": null,
"stat": "Ss",
"start": "Nov09",
"time": "0:08",
"command": "/usr/lib/systemd/systemd --switched-root --system --..."
},
{
"user": "root",
"pid": 2,
"cpu_percent": 0.0,
"mem_percent": 0.0,
"vsz": 0,
"rss": 0,
"tty": null,
"stat": "S",
"start": "Nov09",
"time": "0:00",
"command": "[kthreadd]"
},
{
"user": "root",
"pid": 4,
"cpu_percent": 0.0,
"mem_percent": 0.0,
"vsz": 0,
"rss": 0,
"tty": null,
"stat": "S<",
"start": "Nov09",
"time": "0:00",
"command": "[kworker/0:0H]"
},
...
]
$ ps axu | jc --ps -p -r
[
{
"user": "root",
"pid": "1",
"cpu_percent": "0.0",
"mem_percent": "0.1",
"vsz": "128072",
"rss": "6784",
"tty": "?",
"stat": "Ss",
"start": "Nov09",
"time": "0:08",
"command": "/usr/lib/systemd/systemd --switched-root --system --..."
},
{
"user": "root",
"pid": "2",
"cpu_percent": "0.0",
"mem_percent": "0.0",
"vsz": "0",
"rss": "0",
"tty": "?",
"stat": "S",
"start": "Nov09",
"time": "0:00",
"command": "[kthreadd]"
},
{
"user": "root",
"pid": "4",
"cpu_percent": "0.0",
"mem_percent": "0.0",
"vsz": "0",
"rss": "0",
"tty": "?",
"stat": "S<",
"start": "Nov09",
"time": "0:00",
"command": "[kworker/0:0H]"
},
...
]
<a id="jc.parsers.ps.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

134
docs/parsers/route.md Normal file
View File

@@ -0,0 +1,134 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.route"></a>
# jc.parsers.route
jc - JSON Convert `route` command output parser
Usage (cli):
$ route | jc --route
or
$ jc route
Usage (module):
import jc
result = jc.parse('route', route_command_output)
Schema:
[
{
"destination": string,
"gateway": string,
"genmask": string,
"flags": string,
"flags_pretty": [
string
]
"metric": integer,
"ref": integer,
"use": integer,
"mss": integer,
"window": integer,
"irtt": integer,
"iface": string
}
]
Examples:
$ route -ee | jc --route -p
[
{
"destination": "default",
"gateway": "_gateway",
"genmask": "0.0.0.0",
"flags": "UG",
"metric": 202,
"ref": 0,
"use": 0,
"iface": "ens33",
"mss": 0,
"window": 0,
"irtt": 0,
"flags_pretty": [
"UP",
"GATEWAY"
]
},
{
"destination": "192.168.71.0",
"gateway": "0.0.0.0",
"genmask": "255.255.255.0",
"flags": "U",
"metric": 202,
"ref": 0,
"use": 0,
"iface": "ens33",
"mss": 0,
"window": 0,
"irtt": 0,
"flags_pretty": [
"UP"
]
}
]
$ route -ee | jc --route -p -r
[
{
"destination": "default",
"gateway": "_gateway",
"genmask": "0.0.0.0",
"flags": "UG",
"metric": "202",
"ref": "0",
"use": "0",
"iface": "ens33",
"mss": "0",
"window": "0",
"irtt": "0"
},
{
"destination": "192.168.71.0",
"gateway": "0.0.0.0",
"genmask": "255.255.255.0",
"flags": "U",
"metric": "202",
"ref": "0",
"use": "0",
"iface": "ens33",
"mss": "0",
"window": "0",
"irtt": "0"
}
]
<a id="jc.parsers.route.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,187 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.rpm_qi"></a>
# jc.parsers.rpm\_qi
jc - JSON Convert `rpm -qi` command output parser
Works with `rpm -qi [package]` or `rpm -qia`.
The `..._epoch` calculated timestamp fields are naive. (i.e. based on the
local time of the system the parser is run on)
The `..._epoch_utc` calculated timestamp fields are timezone-aware and is
only available if the timezone field is UTC.
Usage (cli):
$ rpm -qia | jc --rpm-qi
or
$ jc rpm -qia
Usage (module):
import jc
result = jc.parse('rpm_qi', rpm_qi_command_output)
Schema:
[
{
"name": string,
"epoch": integer,
"version": string,
"release": string,
"architecture": string,
"install_date": string,
"install_date_epoch": integer, # [0]
"install_date_epoch_utc": integer, # [1]
"group": string,
"size": integer,
"license": string,
"signature": string,
"source_rpm": string,
"build_date": string,
"build_epoch": integer, # [0]
"build_epoch_utc": integer, # [1]
"build_host": string,
"relocations": string,
"packager": string,
"vendor": string,
"url": string,
"summary": string,
"description": string
}
]
[0] naive timestamp
[1] Aware timestamp if timezone is UTC
Examples:
$ rpm -qia | jc --rpm-qi -p
[
{
"name": "make",
"epoch": 1,
"version": "3.82",
"release": "24.el7",
"architecture": "x86_64",
"install_date": "Wed 16 Oct 2019 09:21:42 AM PDT",
"group": "Development/Tools",
"size": 1160660,
"license": "GPLv2+",
"signature": "RSA/SHA256, Thu 22 Aug 2019 02:34:59 PM PDT, Key ...",
"source_rpm": "make-3.82-24.el7.src.rpm",
"build_date": "Thu 08 Aug 2019 05:47:25 PM PDT",
"build_host": "x86-01.bsys.centos.org",
"relocations": "(not relocatable)",
"packager": "CentOS BuildSystem <http://bugs.centos.org>",
"vendor": "CentOS",
"url": "http://www.gnu.org/software/make/",
"summary": "A GNU tool which simplifies the build process for ...",
"description": "A GNU tool for controlling the generation of ex...",
"build_epoch": 1565311645,
"build_epoch_utc": null,
"install_date_epoch": 1571242902,
"install_date_epoch_utc": null
},
{
"name": "kbd-legacy",
"version": "1.15.5",
"release": "15.el7",
"architecture": "noarch",
"install_date": "Thu 15 Aug 2019 10:53:08 AM PDT",
"group": "System Environment/Base",
"size": 503608,
"license": "GPLv2+",
"signature": "RSA/SHA256, Mon 12 Nov 2018 07:17:49 AM PST, Key ...",
"source_rpm": "kbd-1.15.5-15.el7.src.rpm",
"build_date": "Tue 30 Oct 2018 03:40:00 PM PDT",
"build_host": "x86-01.bsys.centos.org",
"relocations": "(not relocatable)",
"packager": "CentOS BuildSystem <http://bugs.centos.org>",
"vendor": "CentOS",
"url": "http://ftp.altlinux.org/pub/people/legion/kbd",
"summary": "Legacy data for kbd package",
"description": "The kbd-legacy package contains original keymap...",
"build_epoch": 1540939200,
"build_epoch_utc": null,
"install_date_epoch": 1565891588,
"install_date_epoch_utc": null
},
...
]
$ rpm -qia | jc --rpm-qi -p -r
[
{
"name": "make",
"epoch": "1",
"version": "3.82",
"release": "24.el7",
"architecture": "x86_64",
"install_date": "Wed 16 Oct 2019 09:21:42 AM PDT",
"group": "Development/Tools",
"size": "1160660",
"license": "GPLv2+",
"signature": "RSA/SHA256, Thu 22 Aug 2019 02:34:59 PM PDT, Key ...",
"source_rpm": "make-3.82-24.el7.src.rpm",
"build_date": "Thu 08 Aug 2019 05:47:25 PM PDT",
"build_host": "x86-01.bsys.centos.org",
"relocations": "(not relocatable)",
"packager": "CentOS BuildSystem <http://bugs.centos.org>",
"vendor": "CentOS",
"url": "http://www.gnu.org/software/make/",
"summary": "A GNU tool which simplifies the build process for...",
"description": "A GNU tool for controlling the generation of exe..."
},
{
"name": "kbd-legacy",
"version": "1.15.5",
"release": "15.el7",
"architecture": "noarch",
"install_date": "Thu 15 Aug 2019 10:53:08 AM PDT",
"group": "System Environment/Base",
"size": "503608",
"license": "GPLv2+",
"signature": "RSA/SHA256, Mon 12 Nov 2018 07:17:49 AM PST, Key ...",
"source_rpm": "kbd-1.15.5-15.el7.src.rpm",
"build_date": "Tue 30 Oct 2018 03:40:00 PM PDT",
"build_host": "x86-01.bsys.centos.org",
"relocations": "(not relocatable)",
"packager": "CentOS BuildSystem <http://bugs.centos.org>",
"vendor": "CentOS",
"url": "http://ftp.altlinux.org/pub/people/legion/kbd",
"summary": "Legacy data for kbd package",
"description": "The kbd-legacy package contains original keymaps..."
},
...
]
<a id="jc.parsers.rpm_qi.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

160
docs/parsers/rsync.md Normal file
View File

@@ -0,0 +1,160 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.rsync"></a>
# jc.parsers.rsync
jc - JSON Convert `rsync` command output parser
Supports the `-i` or `--itemize-changes` options with all levels of
verbosity. This parser will process the STDOUT output or a log file
generated with the `--log-file` option.
Usage (cli):
$ rsync -i -a source/ dest | jc --rsync
or
$ jc rsync -i -a source/ dest
or
$ cat rsync-backup.log | jc --rsync
Usage (module):
import jc
result = jc.parse('rsync', rsync_command_output)
Schema:
[
{
"summary": {
"date": string,
"time": string,
"process": integer,
"sent": integer,
"received": integer,
"total_size": integer,
"matches": integer,
"hash_hits": integer,
"false_alarms": integer,
"data": integer,
"bytes_sec": float,
"speedup": float
},
"files": [
{
"filename": string,
"date": string,
"time": string,
"process": integer,
"metadata": string,
"update_type": string/null, [0]
"file_type": string/null, [1]
"checksum_or_value_different": bool/null,
"size_different": bool/null,
"modification_time_different": bool/null,
"permissions_different": bool/null,
"owner_different": bool/null,
"group_different": bool/null,
"acl_different": bool/null,
"extended_attribute_different": bool/null,
"epoch": integer, [2]
}
]
}
]
[0] 'file sent', 'file received', 'local change or creation',
'hard link', 'not updated', 'message'
[1] 'file', 'directory', 'symlink', 'device', 'special file'
[2] naive timestamp if time and date fields exist and can be converted.
Examples:
$ rsync -i -a source/ dest | jc --rsync -p
[
{
"summary": {
"sent": 1708,
"received": 8209,
"bytes_sec": 19834.0,
"total_size": 235,
"speedup": 0.02
},
"files": [
{
"filename": "./",
"metadata": ".d..t......",
"update_type": "not updated",
"file_type": "directory",
"checksum_or_value_different": false,
"size_different": false,
"modification_time_different": true,
"permissions_different": false,
"owner_different": false,
"group_different": false,
"acl_different": false,
"extended_attribute_different": false
},
...
]
}
]
$ rsync | jc --rsync -p -r
[
{
"summary": {
"sent": "1,708",
"received": "8,209",
"bytes_sec": "19,834.00",
"total_size": "235",
"speedup": "0.02"
},
"files": [
{
"filename": "./",
"metadata": ".d..t......",
"update_type": "not updated",
"file_type": "directory",
"checksum_or_value_different": false,
"size_different": false,
"modification_time_different": true,
"permissions_different": false,
"owner_different": false,
"group_different": false,
"acl_different": false,
"extended_attribute_different": false
},
...
]
}
]
<a id="jc.parsers.rsync.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, freebsd
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,123 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.rsync_s"></a>
# jc.parsers.rsync\_s
jc - JSON Convert `rsync` command output streaming parser
> This streaming parser outputs JSON Lines (cli) or returns a Generator
iterator of Dictionaries (module)
Supports the `-i` or `--itemize-changes` options with all levels of
verbosity. This parser will process the STDOUT output or a log file
generated with the `--log-file` option.
Usage (cli):
$ rsync -i -a source/ dest | jc --rsync-s
or
$ cat rsync-backup.log | jc --rsync-s
Usage (module):
import jc
result = jc.parse('rsync_s', rsync_command_output.splitlines())
for item in result:
# do something
Schema:
{
"type": string, # 'file' or 'summary'
"date": string,
"time": string,
"process": integer,
"sent": integer,
"received": integer,
"total_size": integer,
"matches": integer,
"hash_hits": integer,
"false_alarms": integer,
"data": integer,
"bytes_sec": float,
"speedup": float,
"filename": string,
"date": string,
"time": string,
"process": integer,
"metadata": string,
"update_type": string/null, [0]
"file_type": string/null, [1]
"checksum_or_value_different": bool/null,
"size_different": bool/null,
"modification_time_different": bool/null,
"permissions_different": bool/null,
"owner_different": bool/null,
"group_different": bool/null,
"acl_different": bool/null,
"extended_attribute_different": bool/null,
"epoch": integer, [2]
# below object only exists if using -qq or ignore_exceptions=True
"_jc_meta": {
"success": boolean, # false if error parsing
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
}
[0] 'file sent', 'file received', 'local change or creation',
'hard link', 'not updated', 'message'
[1] 'file', 'directory', 'symlink', 'device', 'special file'
[2] naive timestamp if time and date fields exist and can be converted.
Examples:
$ rsync -i -a source/ dest | jc --rsync-s
{"type":"file","filename":"./","metadata":".d..t......","update_...}
...
$ cat rsync_backup.log | jc --rsync-s
{"type":"file","filename":"./","date":"2022/01/28","time":"03:53...}
...
<a id="jc.parsers.rsync_s.parse"></a>
### parse
```python
@add_jc_meta
def parse(
data: Iterable[str],
raw: bool = False,
quiet: bool = False,
ignore_exceptions: bool = False
) -> Union[Generator[Dict, None, None], tuple]
```
Main text parsing generator function. Returns an iterator object.
Parameters:
data: (iterable) line-based text data to parse
(e.g. sys.stdin or str.splitlines())
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
ignore_exceptions: (boolean) ignore parsing exceptions if True
Yields:
Dictionary. Raw or processed structured data.
Returns:
Iterator object (generator)
### Parser Information
Compatibility: linux, darwin, freebsd
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

228
docs/parsers/sfdisk.md Normal file
View File

@@ -0,0 +1,228 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.sfdisk"></a>
# jc.parsers.sfdisk
jc - JSON Convert `sfdisk` command output parser
Supports the following `sfdisk` options:
- `-l`
- `-F`
- `-d` (deprecated - only for older versions of util-linux)
- `-uM` (deprecated - only for older versions of util-linux)
- `-uC` (deprecated - only for older versions of util-linux)
- `-uS` (deprecated - only for older versions of util-linux)
- `-uB` (deprecated - only for older versions of util-linux)
Usage (cli):
# sfdisk -l | jc --sfdisk
or
# jc sfdisk -l
Usage (module):
import jc
result = jc.parse('sfdisk', sfdisk_command_output)
Schema:
[
{
"disk": string,
"disk_size": string,
"free_disk_size": string,
"bytes": integer,
"free_bytes": integer,
"sectors": integer,
"free_sectors": integer,
"cylinders": integer,
"heads": integer,
"sectors_per_track": integer,
"units": string,
"logical_sector_size": integer,
"physical_sector_size": integer,
"min_io_size": integer,
"optimal_io_size": integer,
"disk_label_type": string,
"disk_identifier": string,
"disk_model": string,
"partitions": [
{
"device": string,
"boot": boolean,
"start": integer,
"end": integer,
"size": string, # [0]
"cyls": integer,
"mib": integer,
"blocks": integer,
"sectors": integer,
"id": string,
"system": string,
"type": string
}
]
}
]
[0] will be integer when using deprecated -d sfdisk option
Examples:
# sfdisk -l | jc --sfdisk -p
[
{
"disk": "/dev/sda",
"cylinders": 2610,
"heads": 255,
"sectors_per_track": 63,
"units": "cylinders of 8225280 bytes, blocks of 1024 bytes, ...",
"partitions": [
{
"device": "/dev/sda1",
"boot": true,
"start": 0,
"end": 130,
"cyls": 131,
"blocks": 1048576,
"id": "83",
"system": "Linux"
},
{
"device": "/dev/sda2",
"boot": false,
"start": 130,
"end": 2610,
"cyls": 2481,
"blocks": 19921920,
"id": "8e",
"system": "Linux LVM"
},
{
"device": "/dev/sda3",
"boot": false,
"start": 0,
"end": null,
"cyls": 0,
"blocks": 0,
"id": "0",
"system": "Empty"
},
{
"device": "/dev/sda4",
"boot": false,
"start": 0,
"end": null,
"cyls": 0,
"blocks": 0,
"id": "0",
"system": "Empty"
}
]
},
{
"disk": "/dev/mapper/centos-root",
"cylinders": 2218,
"heads": 255,
"sectors_per_track": 63
},
{
"disk": "/dev/mapper/centos-swap",
"cylinders": 261,
"heads": 255,
"sectors_per_track": 63
}
]
# sfdisk -l | jc --sfdisk -p -r
[
{
"disk": "/dev/sda",
"cylinders": "2610",
"heads": "255",
"sectors_per_track": "63",
"units": "cylinders of 8225280 bytes, blocks of 1024 bytes, co...",
"partitions": [
{
"device": "/dev/sda1",
"boot": "*",
"start": "0+",
"end": "130-",
"cyls": "131-",
"blocks": "1048576",
"id": "83",
"system": "Linux"
},
{
"device": "/dev/sda2",
"boot": null,
"start": "130+",
"end": "2610-",
"cyls": "2481-",
"blocks": "19921920",
"id": "8e",
"system": "Linux LVM"
},
{
"device": "/dev/sda3",
"boot": null,
"start": "0",
"end": "-",
"cyls": "0",
"blocks": "0",
"id": "0",
"system": "Empty"
},
{
"device": "/dev/sda4",
"boot": null,
"start": "0",
"end": "-",
"cyls": "0",
"blocks": "0",
"id": "0",
"system": "Empty"
}
]
},
{
"disk": "/dev/mapper/centos-root",
"cylinders": "2218",
"heads": "255",
"sectors_per_track": "63"
},
{
"disk": "/dev/mapper/centos-swap",
"cylinders": "261",
"heads": "255",
"sectors_per_track": "63"
}
]
<a id="jc.parsers.sfdisk.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,127 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.shadow"></a>
# jc.parsers.shadow
jc - JSON Convert `/etc/shadow` file parser
Usage (cli):
$ sudo cat /etc/shadow | jc --shadow
Usage (module):
import jc
result = jc.parse('shadow', shadow_file_output)
Schema:
[
{
"username": string,
"password": string,
"last_changed": integer,
"minimum": integer,
"maximum": integer,
"warn": integer,
"inactive": integer,
"expire": integer
}
]
Examples:
$ sudo cat /etc/shadow | jc --shadow -p
[
{
"username": "root",
"password": "*",
"last_changed": 18113,
"minimum": 0,
"maximum": 99999,
"warn": 7,
"inactive": null,
"expire": null
},
{
"username": "daemon",
"password": "*",
"last_changed": 18113,
"minimum": 0,
"maximum": 99999,
"warn": 7,
"inactive": null,
"expire": null
},
{
"username": "bin",
"password": "*",
"last_changed": 18113,
"minimum": 0,
"maximum": 99999,
"warn": 7,
"inactive": null,
"expire": null
},
...
]
$ sudo cat /etc/shadow | jc --shadow -p -r
[
{
"username": "root",
"password": "*",
"last_changed": "18113",
"minimum": "0",
"maximum": "99999",
"warn": "7",
"inactive": "",
"expire": ""
},
{
"username": "daemon",
"password": "*",
"last_changed": "18113",
"minimum": "0",
"maximum": "99999",
"warn": "7",
"inactive": "",
"expire": ""
},
{
"username": "bin",
"password": "*",
"last_changed": "18113",
"minimum": "0",
"maximum": "99999",
"warn": "7",
"inactive": "",
"expire": ""
},
...
]
<a id="jc.parsers.shadow.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, aix, freebsd
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

306
docs/parsers/ss.md Normal file
View File

@@ -0,0 +1,306 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ss"></a>
# jc.parsers.ss
jc - JSON Convert `ss` command output parser
Extended information options like -e and -p are not supported and may cause
parsing irregularities.
Usage (cli):
$ ss | jc --ss
or
$ jc ss
Usage (module):
import jc
result = jc.parse('ss', ss_command_output)
Schema:
Information from https://www.cyberciti.biz/files/ss.html used to define
field names
[
{
"netid": string,
"state": string,
"recv_q": integer,
"send_q": integer,
"local_address": string,
"local_port": string,
"local_port_num": integer,
"peer_address": string,
"peer_port": string,
"peer_port_num": integer,
"interface": string,
"link_layer" string,
"channel": string,
"path": string,
"pid": integer
}
]
Examples:
$ sudo ss -a | jc --ss -p
[
{
"netid": "nl",
"state": "UNCONN",
"recv_q": 0,
"send_q": 0,
"peer_address": "*",
"channel": "rtnl:kernel"
},
{
"netid": "nl",
"state": "UNCONN",
"recv_q": 0,
"send_q": 0,
"peer_address": "*",
"pid": 893,
"channel": "rtnl:systemd-resolve"
},
...
{
"netid": "p_raw",
"state": "UNCONN",
"recv_q": 0,
"send_q": 0,
"peer_address": "*",
"link_layer": "LLDP",
"interface": "ens33"
},
{
"netid": "u_dgr",
"state": "UNCONN",
"recv_q": 0,
"send_q": 0,
"local_port": "93066",
"peer_address": "*",
"peer_port": "0",
"path": "/run/user/1000/systemd/notify"
},
{
"netid": "u_seq",
"state": "LISTEN",
"recv_q": 0,
"send_q": 128,
"local_port": "20699",
"peer_address": "*",
"peer_port": "0",
"path": "/run/udev/control"
},
...
{
"netid": "icmp6",
"state": "UNCONN",
"recv_q": 0,
"send_q": 0,
"local_address": "*",
"local_port": "ipv6-icmp",
"peer_address": "*",
"peer_port": "*",
"interface": "ens33"
},
{
"netid": "udp",
"state": "UNCONN",
"recv_q": 0,
"send_q": 0,
"local_address": "127.0.0.53",
"local_port": "domain",
"peer_address": "0.0.0.0",
"peer_port": "*",
"interface": "lo"
},
{
"netid": "tcp",
"state": "LISTEN",
"recv_q": 0,
"send_q": 128,
"local_address": "127.0.0.53",
"local_port": "domain",
"peer_address": "0.0.0.0",
"peer_port": "*",
"interface": "lo"
},
{
"netid": "tcp",
"state": "LISTEN",
"recv_q": 0,
"send_q": 128,
"local_address": "0.0.0.0",
"local_port": "ssh",
"peer_address": "0.0.0.0",
"peer_port": "*"
},
{
"netid": "tcp",
"state": "LISTEN",
"recv_q": 0,
"send_q": 128,
"local_address": "[::]",
"local_port": "ssh",
"peer_address": "[::]",
"peer_port": "*"
},
{
"netid": "v_str",
"state": "ESTAB",
"recv_q": 0,
"send_q": 0,
"local_address": "999900439",
"local_port": "1023",
"peer_address": "0",
"peer_port": "976",
"local_port_num": 1023,
"peer_port_num": 976
}
]
$ sudo ss -a | jc --ss -p -r
[
{
"netid": "nl",
"state": "UNCONN",
"recv_q": "0",
"send_q": "0",
"peer_address": "*",
"channel": "rtnl:kernel"
},
{
"netid": "nl",
"state": "UNCONN",
"recv_q": "0",
"send_q": "0",
"peer_address": "*",
"pid": "893",
"channel": "rtnl:systemd-resolve"
},
...
{
"netid": "p_raw",
"state": "UNCONN",
"recv_q": "0",
"send_q": "0",
"peer_address": "*",
"link_layer": "LLDP",
"interface": "ens33"
},
{
"netid": "u_dgr",
"state": "UNCONN",
"recv_q": "0",
"send_q": "0",
"local_port": "93066",
"peer_address": "*",
"peer_port": "0",
"path": "/run/user/1000/systemd/notify"
},
{
"netid": "u_seq",
"state": "LISTEN",
"recv_q": "0",
"send_q": "128",
"local_port": "20699",
"peer_address": "*",
"peer_port": "0",
"path": "/run/udev/control"
},
...
{
"netid": "icmp6",
"state": "UNCONN",
"recv_q": "0",
"send_q": "0",
"local_address": "*",
"local_port": "ipv6-icmp",
"peer_address": "*",
"peer_port": "*",
"interface": "ens33"
},
{
"netid": "udp",
"state": "UNCONN",
"recv_q": "0",
"send_q": "0",
"local_address": "127.0.0.53",
"local_port": "domain",
"peer_address": "0.0.0.0",
"peer_port": "*",
"interface": "lo"
},
{
"netid": "tcp",
"state": "LISTEN",
"recv_q": "0",
"send_q": "128",
"local_address": "127.0.0.53",
"local_port": "domain",
"peer_address": "0.0.0.0",
"peer_port": "*",
"interface": "lo"
},
{
"netid": "tcp",
"state": "LISTEN",
"recv_q": "0",
"send_q": "128",
"local_address": "0.0.0.0",
"local_port": "ssh",
"peer_address": "0.0.0.0",
"peer_port": "*"
},
{
"netid": "tcp",
"state": "LISTEN",
"recv_q": "0",
"send_q": "128",
"local_address": "[::]",
"local_port": "ssh",
"peer_address": "[::]",
"peer_port": "*"
},
{
"netid": "v_str",
"state": "ESTAB",
"recv_q": "0",
"send_q": "0",
"local_address": "999900439",
"local_port": "1023",
"peer_address": "0",
"peer_port": "976"
}
]
<a id="jc.parsers.ss.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

196
docs/parsers/stat.md Normal file
View File

@@ -0,0 +1,196 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.stat"></a>
# jc.parsers.stat
jc - JSON Convert `stat` command output parser
The `xxx_epoch` calculated timestamp fields are naive. (i.e. based on the
local time of the system the parser is run on)
The `xxx_epoch_utc` calculated timestamp fields are timezone-aware and are
only available if the timezone field is UTC.
Usage (cli):
$ stat * | jc --stat
or
$ jc stat *
Usage (module):
import jc
result = jc.parse('stat', stat_command_output)
Schema:
[
{
"file": string,
"link_to" string,
"size": integer,
"blocks": integer,
"io_blocks": integer,
"type": string,
"device": string,
"inode": integer,
"links": integer,
"access": string,
"flags": string,
"uid": integer,
"user": string,
"gid": integer,
"group": string,
"access_time": string, # - = null
"access_time_epoch": integer, # naive timestamp
"access_time_epoch_utc": integer, # timezone-aware timestamp
"modify_time": string, # - = null
"modify_time_epoch": integer, # naive timestamp
"modify_time_epoch_utc": integer, # timezone-aware timestamp
"change_time": string, # - = null
"change_time_epoch": integer, # naive timestamp
"change_time_epoch_utc": integer, # timezone-aware timestamp
"birth_time": string, # - = null
"birth_time_epoch": integer, # naive timestamp
"birth_time_epoch_utc": integer, # timezone-aware timestamp
"unix_device": integer,
"rdev": integer,
"block_size": integer,
"unix_flags": string
}
]
Examples:
$ stat /bin/* | jc --stat -p
[
{
"file": "/bin/bash",
"size": 1113504,
"blocks": 2176,
"io_blocks": 4096,
"type": "regular file",
"device": "802h/2050d",
"inode": 131099,
"links": 1,
"access": "0755",
"flags": "-rwxr-xr-x",
"uid": 0,
"user": "root",
"gid": 0,
"group": "root",
"access_time": "2019-11-14 08:18:03.509681766 +0000",
"modify_time": "2019-06-06 22:28:15.000000000 +0000",
"change_time": "2019-08-12 17:21:29.521945390 +0000",
"birth_time": null,
"access_time_epoch": 1573748283,
"access_time_epoch_utc": 1573719483,
"modify_time_epoch": 1559885295,
"modify_time_epoch_utc": 1559860095,
"change_time_epoch": 1565655689,
"change_time_epoch_utc": 1565630489,
"birth_time_epoch": null,
"birth_time_epoch_utc": null
},
{
"file": "/bin/btrfs",
"size": 716464,
"blocks": 1400,
"io_blocks": 4096,
"type": "regular file",
"device": "802h/2050d",
"inode": 131100,
"links": 1,
"access": "0755",
"flags": "-rwxr-xr-x",
"uid": 0,
"user": "root",
"gid": 0,
"group": "root",
"access_time": "2019-11-14 08:18:28.990834276 +0000",
"modify_time": "2018-03-12 23:04:27.000000000 +0000",
"change_time": "2019-08-12 17:21:29.545944399 +0000",
"birth_time": null,
"access_time_epoch": 1573748308,
"access_time_epoch_utc": 1573719508,
"modify_time_epoch": 1520921067,
"modify_time_epoch_utc": 1520895867,
"change_time_epoch": 1565655689,
"change_time_epoch_utc": 1565630489,
"birth_time_epoch": null,
"birth_time_epoch_utc": null
},
...
]
$ stat /bin/* | jc --stat -p -r
[
{
"file": "/bin/bash",
"size": "1113504",
"blocks": "2176",
"io_blocks": "4096",
"type": "regular file",
"device": "802h/2050d",
"inode": "131099",
"links": "1",
"access": "0755",
"flags": "-rwxr-xr-x",
"uid": "0",
"user": "root",
"gid": "0",
"group": "root",
"access_time": "2019-11-14 08:18:03.509681766 +0000",
"modify_time": "2019-06-06 22:28:15.000000000 +0000",
"change_time": "2019-08-12 17:21:29.521945390 +0000",
"birth_time": null
},
{
"file": "/bin/btrfs",
"size": "716464",
"blocks": "1400",
"io_blocks": "4096",
"type": "regular file",
"device": "802h/2050d",
"inode": "131100",
"links": "1",
"access": "0755",
"flags": "-rwxr-xr-x",
"uid": "0",
"user": "root",
"gid": "0",
"group": "root",
"access_time": "2019-11-14 08:18:28.990834276 +0000",
"modify_time": "2018-03-12 23:04:27.000000000 +0000",
"change_time": "2019-08-12 17:21:29.545944399 +0000",
"birth_time": null
},
...
]
<a id="jc.parsers.stat.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, freebsd
Version 1.11 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,111 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.stat_s"></a>
# jc.parsers.stat\_s
jc - JSON Convert `stat` command output streaming parser
> This streaming parser outputs JSON Lines (cli) or returns a Generator
iterator of Dictionaries (module)
The `xxx_epoch` calculated timestamp fields are naive. (i.e. based on the
local time of the system the parser is run on).
The `xxx_epoch_utc` calculated timestamp fields are timezone-aware and are
only available if the timezone field is UTC.
Usage (cli):
$ stat * | jc --stat-s
Usage (module):
import jc
result = jc.parse('stat_s', stat_command_output.splitlines())
for item in result:
# do something
Schema:
{
"file": string,
"link_to" string,
"size": integer,
"blocks": integer,
"io_blocks": integer,
"type": string,
"device": string,
"inode": integer,
"links": integer,
"access": string,
"flags": string,
"uid": integer,
"user": string,
"gid": integer,
"group": string,
"access_time": string, # - = null
"access_time_epoch": integer, # naive timestamp
"access_time_epoch_utc": integer, # timezone-aware timestamp
"modify_time": string, # - = null
"modify_time_epoch": integer, # naive timestamp
"modify_time_epoch_utc": integer, # timezone-aware timestamp
"change_time": string, # - = null
"change_time_epoch": integer, # naive timestamp
"change_time_epoch_utc": integer, # timezone-aware timestamp
"birth_time": string, # - = null
"birth_time_epoch": integer, # naive timestamp
"birth_time_epoch_utc": integer, # timezone-aware timestamp
"unix_device": integer,
"rdev": integer,
"block_size": integer,
"unix_flags": string,
# below object only exists if using -qq or ignore_exceptions=True
"_jc_meta": {
"success": boolean, # false if error parsing
"error": string, # exists if "success" is false
"line": string # exists if "success" is false
}
}
Examples:
$ stat | jc --stat-s
{"file":"(stdin)","unix_device":1027739696,"inode":1155,"flags":"cr...}
$ stat | jc --stat-s -r
{"file":"(stdin)","unix_device":"1027739696","inode":"1155","flag...}
<a id="jc.parsers.stat_s.parse"></a>
### parse
```python
@add_jc_meta
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
```
Main text parsing generator function. Returns an iterator object.
Parameters:
data: (iterable) line-based text data to parse
(e.g. sys.stdin or str.splitlines())
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
ignore_exceptions: (boolean) ignore parsing exceptions if True
Yields:
Dictionary. Raw or processed structured data.
Returns:
Iterator object (generator)
### Parser Information
Compatibility: linux, darwin, freebsd
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

83
docs/parsers/sysctl.md Normal file
View File

@@ -0,0 +1,83 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.sysctl"></a>
# jc.parsers.sysctl
jc - JSON Convert `sysctl -a` command output parser
Note: Since `sysctl` output is not easily parsable only a very simple
key/value object will be output. An attempt is made to convert obvious
integers and floats. If no conversion is desired, use the `-r`
command-line argument or the `raw=True` argument in `parse()`.
Usage (cli):
$ sysctl -a | jc --sysctl
or
$ jc sysctl -a
Usage (module):
import jc
result = jc.parse('sysctl', sysctl_command_output)
Schema:
{
"key1": string/integer/float, # best guess based on value
"key2": string/integer/float,
"key3": string/integer/float
}
Examples:
$ sysctl -a | jc --sysctl -p
{
"user.cs_path": "/usr/bin:/bin:/usr/sbin:/sbin",
"user.bc_base_max": 99,
"user.bc_dim_max": 2048,
"user.bc_scale_max": 99,
"user.bc_string_max": 1000,
"user.coll_weights_max": 2,
"user.expr_nest_max": 32
...
}
$ sysctl -a | jc --sysctl -p -r
{
"user.cs_path": "/usr/bin:/bin:/usr/sbin:/sbin",
"user.bc_base_max": "99",
"user.bc_dim_max": "2048",
"user.bc_scale_max": "99",
"user.bc_string_max": "1000",
"user.coll_weights_max": "2",
"user.expr_nest_max": "32",
...
}
<a id="jc.parsers.sysctl.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, freebsd
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,84 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.systemctl"></a>
# jc.parsers.systemctl
jc - JSON Convert `systemctl` command output parser
Usage (cli):
$ systemctl | jc --systemctl
or
$ jc systemctl
Usage (module):
import jc
result = jc.parse('systemctl', systemctl_command_output)
Schema:
[
{
"unit": string,
"load": string,
"active": string,
"sub": string,
"description": string
}
]
Examples:
$ systemctl -a | jc --systemctl -p
[
{
"unit": "proc-sys-fs-binfmt_misc.automount",
"load": "loaded",
"active": "active",
"sub": "waiting",
"description": "Arbitrary Executable File Formats File System ..."
},
{
"unit": "dev-block-8:2.device",
"load": "loaded",
"active": "active",
"sub": "plugged",
"description": "LVM PV 3klkIj-w1qk-DkJi-0XBJ-y3o7-i2Ac-vHqWBM o..."
},
{
"unit": "dev-cdrom.device",
"load": "loaded",
"active": "active",
"sub": "plugged",
"description": "VMware_Virtual_IDE_CDROM_Drive"
},
...
]
<a id="jc.parsers.systemctl.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -0,0 +1,101 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.systemctl_lj"></a>
# jc.parsers.systemctl\_lj
jc - JSON Convert `systemctl list-jobs` command output parser
Usage (cli):
$ systemctl list-jobs | jc --systemctl-lj
or
$ jc systemctl list-jobs
Usage (module):
import jc
result = jc.parse('systemctl_lj', systemctl_lj_command_output)
Schema:
[
{
"job": integer,
"unit": string,
"type": string,
"state": string
}
]
Examples:
$ systemctl list-jobs| jc --systemctl-lj -p
[
{
"job": 3543,
"unit": "nginxAfterGlusterfs.service",
"type": "start",
"state": "waiting"
},
{
"job": 3545,
"unit": "glusterReadyForLocalhostMount.service",
"type": "start",
"state": "running"
},
{
"job": 3506,
"unit": "nginx.service",
"type": "start",
"state": "waiting"
}
]
$ systemctl list-jobs| jc --systemctl-lj -p -r
[
{
"job": "3543",
"unit": "nginxAfterGlusterfs.service",
"type": "start",
"state": "waiting"
},
{
"job": "3545",
"unit": "glusterReadyForLocalhostMount.service",
"type": "start",
"state": "running"
},
{
"job": "3506",
"unit": "nginx.service",
"type": "start",
"state": "waiting"
}
]
<a id="jc.parsers.systemctl_lj.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -0,0 +1,77 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.systemctl_ls"></a>
# jc.parsers.systemctl\_ls
jc - JSON Convert `systemctl list-sockets` command output
parser
Usage (cli):
$ systemctl list-sockets | jc --systemctl-ls
or
$ jc systemctl list-sockets
Usage (module):
import jc
result = jc.parse('systemctl_ls', systemctl_ls_command_output)
Schema:
[
{
"listen": string,
"unit": string,
"activates": string
}
]
Examples:
$ systemctl list-sockets | jc --systemctl-ls -p
[
{
"listen": "/dev/log",
"unit": "systemd-journald.socket",
"activates": "systemd-journald.service"
},
{
"listen": "/run/dbus/system_bus_socket",
"unit": "dbus.socket",
"activates": "dbus.service"
},
{
"listen": "/run/dmeventd-client",
"unit": "dm-event.socket",
"activates": "dm-event.service"
},
...
]
<a id="jc.parsers.systemctl_ls.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -0,0 +1,73 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.systemctl_luf"></a>
# jc.parsers.systemctl\_luf
jc - JSON Convert `systemctl list-unit-files` command output
parser
Usage (cli):
$ systemctl list-unit-files | jc --systemctl-luf
or
$ jc systemctl list-unit-files
Usage (module):
import jc
result = jc.parse('systemctl_luf', systemctl_luf_command_output)
Schema:
[
{
"unit_file": string,
"state": string
}
]
Examples:
$ systemctl list-unit-files | jc --systemctl-luf -p
[
{
"unit_file": "proc-sys-fs-binfmt_misc.automount",
"state": "static"
},
{
"unit_file": "dev-hugepages.mount",
"state": "static"
},
{
"unit_file": "dev-mqueue.mount",
"state": "static"
},
...
]
<a id="jc.parsers.systemctl_luf.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)

237
docs/parsers/systeminfo.md Normal file
View File

@@ -0,0 +1,237 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.systeminfo"></a>
# jc.parsers.systeminfo
jc - JSON Convert `systeminfo` command output parser
Blank or missing elements are set to `null`.
The `original_install_date_epoch` and `system_boot_time_epoch` calculated
timestamp fields are naive. (i.e. based on the local time of the system the
parser is run on)
The `original_install_date_epoch_utc` and `system_boot_time_epoch_utc`
calculated timestamp fields are timezone-aware and are only available if
the timezone field is UTC.
Usage (cli):
$ systeminfo | jc --systeminfo
Usage (module):
import jc
result = jc.parse('systeminfo', systeminfo_command_output)
Schema:
{
"host_name": string,
"os_name": string,
"os_version": string,
"os_manufacturer": string,
"os_configuration": string,
"os_build_type": string,
"registered_owner": string,
"registered_organization": string,
"product_id": string,
"original_install_date": string,
"original_install_date_epoch": integer, # [0]
"original_install_date_epoch_utc": integer, # [1]
"system_boot_time": string,
"system_boot_time_epoch": integer, # [0]
"system_boot_time_epoch_utc": integer, # [1]
"system_manufacturer": string,
"system_model": string,
"system_type": string,
"processors": [
string
],
"bios_version": string,
"windows_directory": string,
"system_directory": string,
"boot_device": string,
"system_locale": string,
"input_locale": string,
"time_zone": string,
"total_physical_memory_mb": string,
"available_physical_memory_mb": integer,
"virtual_memory_max_size_mb": integer,
"virtual_memory_available_mb": integer,
"virtual_memory_in_use_mb": integer,
"page_file_locations": string,
"domain": string,
"logon_server": string,
"hotfixs": [
string
],
"network_cards": [
{
"name": string,
"connection_name": string,
"status": string,
"dhcp_enabled": boolean,
"dhcp_server": string,
"ip_addresses": [
string
]
}
],
"hyperv_requirements": {
"vm_monitor_mode_extensions": boolean,
"virtualization_enabled_in_firmware": boolean,
"second_level_address_translation": boolean,
"data_execution_prevention_available": boolean
}
}
[0] naive timestamp
[1] timezone-aware timestamp
Examples:
$ systeminfo | jc --systeminfo -p
{
"host_name": "TESTLAPTOP",
"os_name": "Microsoft Windows 10 Enterprise",
"os_version": "10.0.17134 N/A Build 17134",
"os_manufacturer": "Microsoft Corporation",
"os_configuration": "Member Workstation",
"os_build_type": "Multiprocessor Free",
"registered_owner": "Test, Inc.",
"registered_organization": "Test, Inc.",
"product_id": "11111-11111-11111-AA111",
"original_install_date": "3/26/2019, 3:51:30 PM",
"system_boot_time": "3/30/2021, 6:13:59 AM",
"system_manufacturer": "Dell Inc.",
"system_model": "Precision 5530",
"system_type": "x64-based PC",
"processors": [
"Intel64 Family 6 Model 158 Stepping 10 GenuineIntel ~2592 Mhz"
],
"bios_version": "Dell Inc. 1.16.2, 4/21/2020",
"windows_directory": "C:\\WINDOWS",
"system_directory": "C:\\WINDOWS\\system32",
"boot_device": "\\Device\\HarddiskVolume2",
"system_locale": "en-us;English (United States)",
"input_locale": "en-us;English (United States)",
"time_zone": "(UTC+00:00) UTC",
"total_physical_memory_mb": 32503,
"available_physical_memory_mb": 19743,
"virtual_memory_max_size_mb": 37367,
"virtual_memory_available_mb": 22266,
"virtual_memory_in_use_mb": 15101,
"page_file_locations": "C:\\pagefile.sys",
"domain": "test.com",
"logon_server": "\\\\TESTDC01",
"hotfixs": [
"KB2693643",
"KB4601054"
],
"network_cards": [
{
"name": "Intel(R) Wireless-AC 9260 160MHz",
"connection_name": "Wi-Fi",
"status": null,
"dhcp_enabled": true,
"dhcp_server": "192.168.2.1",
"ip_addresses": [
"192.168.2.219"
]
}
],
"hyperv_requirements": {
"vm_monitor_mode_extensions": true,
"virtualization_enabled_in_firmware": true,
"second_level_address_translation": false,
"data_execution_prevention_available": true
},
"original_install_date_epoch": 1553640690,
"original_install_date_epoch_utc": 1553615490,
"system_boot_time_epoch": 1617110039,
"system_boot_time_epoch_utc": 1617084839
}
$ systeminfo | jc --systeminfo -p -r
{
"host_name": "TESTLAPTOP",
"os_name": "Microsoft Windows 10 Enterprise",
"os_version": "10.0.17134 N/A Build 17134",
"os_manufacturer": "Microsoft Corporation",
"os_configuration": "Member Workstation",
"os_build_type": "Multiprocessor Free",
"registered_owner": "Test, Inc.",
"registered_organization": "Test, Inc.",
"product_id": "11111-11111-11111-AA111",
"original_install_date": "3/26/2019, 3:51:30 PM",
"system_boot_time": "3/30/2021, 6:13:59 AM",
"system_manufacturer": "Dell Inc.",
"system_model": "Precision 5530",
"system_type": "x64-based PC",
"processors": [
"Intel64 Family 6 Model 158 Stepping 10 GenuineIntel ~2592 Mhz"
],
"bios_version": "Dell Inc. 1.16.2, 4/21/2020",
"windows_directory": "C:\\WINDOWS",
"system_directory": "C:\\WINDOWS\\system32",
"boot_device": "\\Device\\HarddiskVolume2",
"system_locale": "en-us;English (United States)",
"input_locale": "en-us;English (United States)",
"time_zone": "(UTC+00:00) UTC",
"total_physical_memory_mb": "32,503 MB",
"available_physical_memory_mb": "19,743 MB",
"virtual_memory_max_size_mb": "37,367 MB",
"virtual_memory_available_mb": "22,266 MB",
"virtual_memory_in_use_mb": "15,101 MB",
"page_file_locations": "C:\\pagefile.sys",
"domain": "test.com",
"logon_server": "\\\\TESTDC01",
"hotfixs": [
"KB2693643",
"KB4601054"
],
"network_cards": [
{
"name": "Intel(R) Wireless-AC 9260 160MHz",
"connection_name": "Wi-Fi",
"status": "",
"dhcp_enabled": "Yes",
"dhcp_server": "192.168.2.1",
"ip_addresses": [
"192.168.2.219"
]
}
],
"hyperv_requirements": {
"vm_monitor_mode_extensions": "Yes",
"virtualization_enabled_in_firmware": "Yes",
"second_level_address_translation": "No",
"data_execution_prevention_available": "Yes"
}
}
<a id="jc.parsers.systeminfo.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: win32
Version 1.2 by Jon Smith (jon@rebelliondefense.com)

158
docs/parsers/time.md Normal file
View File

@@ -0,0 +1,158 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.time"></a>
# jc.parsers.time
jc - JSON Convert `/usr/bin/time` command output parser
Output from `/usr/bin/time` is sent to `STDERR`, so the `-o` option can be
used to redirect the output to a file that can be read by `jc`.
Alternatively, the output from `/usr/bin/time` can be redirected to `STDOUT`
so `jc` can receive it.
Note: `/usr/bin/time` is similar but different from the Bash builtin
`time` command.
Usage (cli):
$ /usr/bin/time -o timefile.out sleep 2; cat timefile.out | \\
jc --time -p
Usage (module):
import jc
result = jc.parse('time', time_command_output)
Schema:
Source: https://www.freebsd.org/cgi/man.cgi?query=getrusage
https://man7.org/linux/man-pages/man1/time.1.html
{
"real_time": float,
"user_time": float,
"system_time": float,
"elapsed_time": string,
"elapsed_time_hours": integer,
"elapsed_time_minutes": integer,
"elapsed_time_seconds": integer,
"elapsed_time_centiseconds": integer,
"elapsed_time_total_seconds": float,
"cpu_percent": integer, # null if ?
"average_shared_text_size": integer,
"average_unshared_data_size": integer,
"average_unshared_stack_size": integer,
"average_shared_memory_size": integer,
"maximum_resident_set_size": integer,
"block_input_operations": integer, # [0]
"block_output_operations": integer, # [1]
"major_pagefaults": integer,
"minor_pagefaults": integer,
"swaps": integer,
"page_reclaims": integer,
"page_faults": integer,
"messages_sent": integer,
"messages_received": integer,
"signals_received": integer,
"voluntary_context_switches": integer,
"involuntary_context_switches": integer
"command_being_timed": string,
"average_stack_size": integer,
"average_total_size": integer,
"average_resident_set_size": integer,
"signals_delivered": integer,
"page_size": integer,
"exit_status": integer
}
[0] aka File system inputs
[1] aka File system outputs
Examples:
$ /usr/bin/time --verbose -o timefile.out sleep 2; cat timefile.out | \\
jc --time -p
{
"command_being_timed": "sleep 2",
"user_time": 0.0,
"system_time": 0.0,
"cpu_percent": 0,
"elapsed_time": "0:02.00",
"average_shared_text_size": 0,
"average_unshared_data_size": 0,
"average_stack_size": 0,
"average_total_size": 0,
"maximum_resident_set_size": 2084,
"average_resident_set_size": 0,
"major_pagefaults": 0,
"minor_pagefaults": 72,
"voluntary_context_switches": 2,
"involuntary_context_switches": 1,
"swaps": 0,
"block_input_operations": 0,
"block_output_operations": 0,
"messages_sent": 0,
"messages_received": 0,
"signals_delivered": 0,
"page_size": 4096,
"exit_status": 0,
"elapsed_time_hours": 0,
"elapsed_time_minutes": 0,
"elapsed_time_seconds": 2,
"elapsed_time_centiseconds": 50,
"elapsed_time_total_seconds": 2.5
}
$ /usr/bin/time --verbose -o timefile.out sleep 2; cat timefile.out | \\
jc --time -p -r
{
"command_being_timed": "\"sleep 2\"",
"user_time": "0.00",
"system_time": "0.00",
"cpu_percent": "0",
"elapsed_time": "0:02.00",
"average_shared_text_size": "0",
"average_unshared_data_size": "0",
"average_stack_size": "0",
"average_total_size": "0",
"maximum_resident_set_size": "2084",
"average_resident_set_size": "0",
"major_pagefaults": "0",
"minor_pagefaults": "72",
"voluntary_context_switches": "2",
"involuntary_context_switches": "0",
"swaps": "0",
"block_input_operations": "0",
"block_output_operations": "0",
"messages_sent": "0",
"messages_received": "0",
"signals_delivered": "0",
"page_size": "4096",
"exit_status": "0"
}
<a id="jc.parsers.time.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -0,0 +1,90 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.timedatectl"></a>
# jc.parsers.timedatectl
jc - JSON Convert `timedatectl` command output parser
The `epoch_utc` calculated timestamp field is timezone-aware and is only
available if the `universal_time` field is available.
Usage (cli):
$ timedatectl | jc --timedatectl
or
$ jc timedatectl
Usage (module):
import jc
result = jc.parse('timedatectl', timedatectl_command_output)
Schema:
{
"local_time": string,
"universal_time": string,
"epoch_utc": integer, # timezone-aware
"rtc_time": string,
"time_zone": string,
"ntp_enabled": boolean,
"ntp_synchronized": boolean,
"system_clock_synchronized": boolean,
"systemd-timesyncd.service_active": boolean,
"rtc_in_local_tz": boolean,
"dst_active": boolean
}
Examples:
$ timedatectl | jc --timedatectl -p
{
"local_time": "Tue 2020-03-10 17:53:21 PDT",
"universal_time": "Wed 2020-03-11 00:53:21 UTC",
"rtc_time": "Wed 2020-03-11 00:53:21",
"time_zone": "America/Los_Angeles (PDT, -0700)",
"ntp_enabled": true,
"ntp_synchronized": true,
"rtc_in_local_tz": false,
"dst_active": true,
"epoch_utc": 1583888001
}
$ timedatectl | jc --timedatectl -p -r
{
"local_time": "Tue 2020-03-10 17:53:21 PDT",
"universal_time": "Wed 2020-03-11 00:53:21 UTC",
"rtc_time": "Wed 2020-03-11 00:53:21",
"time_zone": "America/Los_Angeles (PDT, -0700)",
"ntp_enabled": "yes",
"ntp_synchronized": "yes",
"rtc_in_local_tz": "no",
"dst_active": "yes"
}
<a id="jc.parsers.timedatectl.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)

157
docs/parsers/tracepath.md Normal file
View File

@@ -0,0 +1,157 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.tracepath"></a>
# jc.parsers.tracepath
jc - JSON Convert `tracepath` command output parser
Supports `tracepath` and `tracepath6` output.
Usage (cli):
$ tracepath 1.2.3.4 | jc --tracepath
or
$ jc tracepath 1.2.3.4
Usage (module):
import jc
result = jc.parse('tracepath', tracepath_command_output)
Schema:
{
"pmtu": integer,
"forward_hops": integer,
"return_hops": integer,
"hops": [
{
"ttl": integer,
"guess": boolean,
"host": string,
"reply_ms": float,
"pmtu": integer,
"asymmetric_difference": integer,
"reached": boolean
}
]
}
Examples:
$ tracepath6 3ffe:2400:0:109::2 | jc --tracepath -p
{
"pmtu": 1480,
"forward_hops": 2,
"return_hops": 2,
"hops": [
{
"ttl": 1,
"guess": true,
"host": "[LOCALHOST]",
"reply_ms": null,
"pmtu": 1500,
"asymmetric_difference": null,
"reached": false
},
{
"ttl": 1,
"guess": false,
"host": "dust.inr.ac.ru",
"reply_ms": 0.411,
"pmtu": null,
"asymmetric_difference": null,
"reached": false
},
{
"ttl": 2,
"guess": false,
"host": "dust.inr.ac.ru",
"reply_ms": 0.39,
"pmtu": 1480,
"asymmetric_difference": 1,
"reached": false
},
{
"ttl": 2,
"guess": false,
"host": "3ffe:2400:0:109::2",
"reply_ms": 463.514,
"pmtu": null,
"asymmetric_difference": null,
"reached": true
}
]
}
$ tracepath6 3ffe:2400:0:109::2 | jc --tracepath -p -r
{
"pmtu": "1480",
"forward_hops": "2",
"return_hops": "2",
"hops": [
{
"ttl": "1",
"guess": true,
"host": "[LOCALHOST]",
"reply_ms": null,
"pmtu": "1500",
"asymmetric_difference": null,
"reached": false
},
{
"ttl": "1",
"guess": false,
"host": "dust.inr.ac.ru",
"reply_ms": "0.411",
"pmtu": null,
"asymmetric_difference": null,
"reached": false
},
{
"ttl": "2",
"guess": false,
"host": "dust.inr.ac.ru",
"reply_ms": "0.390",
"pmtu": "1480",
"asymmetric_difference": "1",
"reached": false
},
{
"ttl": "2",
"guess": false,
"host": "3ffe:2400:0:109::2",
"reply_ms": "463.514",
"pmtu": null,
"asymmetric_difference": null,
"reached": true
}
]
}
<a id="jc.parsers.tracepath.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,146 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.traceroute"></a>
# jc.parsers.traceroute
jc - JSON Convert `traceroute` command output parser
Supports `traceroute` and `traceroute6` output.
Note: On some operating systems you will need to redirect `STDERR` to
`STDOUT` for destination info since the header line is sent to
`STDERR`. A warning message will be printed to `STDERR` if the
header row is not found.
e.g. `$ traceroute 8.8.8.8 2>&1 | jc --traceroute`
Usage (cli):
$ traceroute 1.2.3.4 | jc --traceroute
or
$ jc traceroute 1.2.3.4
Usage (module):
import jc
result = jc.parse('traceroute', traceroute_command_output)
Schema:
{
"destination_ip": string,
"destination_name": string,
"hops": [
{
"hop": integer,
"probes": [
{
"annotation": string,
"asn": integer,
"ip": string,
"name": string,
"rtt": float
}
]
}
]
}
Examples:
$ traceroute google.com | jc --traceroute -p
{
"destination_ip": "216.58.194.46",
"destination_name": "google.com",
"hops": [
{
"hop": 1,
"probes": [
{
"annotation": null,
"asn": null,
"ip": "216.230.231.141",
"name": "216-230-231-141.static.houston.tx.oplink.net",
"rtt": 198.574
},
{
"annotation": null,
"asn": null,
"ip": "216.230.231.141",
"name": "216-230-231-141.static.houston.tx.oplink.net",
"rtt": null
},
{
"annotation": null,
"asn": null,
"ip": "216.230.231.141",
"name": "216-230-231-141.static.houston.tx.oplink.net",
"rtt": 198.65
}
]
},
...
]
}
$ traceroute google.com | jc --traceroute -p -r
{
"destination_ip": "216.58.194.46",
"destination_name": "google.com",
"hops": [
{
"hop": "1",
"probes": [
{
"annotation": null,
"asn": null,
"ip": "216.230.231.141",
"name": "216-230-231-141.static.houston.tx.oplink.net",
"rtt": "198.574"
},
{
"annotation": null,
"asn": null,
"ip": "216.230.231.141",
"name": "216-230-231-141.static.houston.tx.oplink.net",
"rtt": null
},
{
"annotation": null,
"asn": null,
"ip": "216.230.231.141",
"name": "216-230-231-141.static.houston.tx.oplink.net",
"rtt": "198.650"
}
]
},
...
]
}
<a id="jc.parsers.traceroute.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, freebsd
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)

226
docs/parsers/ufw.md Normal file
View File

@@ -0,0 +1,226 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ufw"></a>
# jc.parsers.ufw
jc - JSON Convert `ufw status` command output parser
Usage (cli):
$ ufw status | jc --ufw
or
$ jc ufw status
Usage (module):
import jc
result = jc.parse('ufw', ufw_command_output)
Schema:
{
"status": string,
"logging": string,
"logging_level": string,
"default": string,
"new_profiles": string,
"rules": [
{
"action": string,
"action_direction": string, # null if blank
"index": integer, # null if blank
"network_protocol": string,
"to_ip": string,
"to_ip_prefix": integer,
"to_interface": string,
"to_transport": string,
"to_ports": [
integer
],
"to_port_ranges": [
{
"start": integer,
"end": integer
}
],
"to_service": string, # [0]
"from_ip": string,
"from_ip_prefix": integer,
"from_interface": string,
"from_transport": string,
"from_ports": [
integer
],
"from_port_ranges": [
{
"start": integer,
"end": integer
}
],
"from_service": string, # [1]
"comment": string # null if no comment
}
]
}
[0] null if any 'to' ports or port_ranges are set
[1] null if any 'from' ports or port_ranges are set
Examples:
$ ufw status verbose | jc --ufw -p
{
"status": "active",
"logging": "on",
"logging_level": "low",
"default": "deny (incoming), allow (outgoing), disabled (routed)",
"new_profiles": "skip",
"rules": [
{
"action": "ALLOW",
"action_direction": "IN",
"index": null,
"network_protocol": "ipv4",
"to_interface": "any",
"to_transport": "any",
"to_service": null,
"to_ports": [
22
],
"to_ip": "0.0.0.0",
"to_ip_prefix": 0,
"comment": null,
"from_ip": "0.0.0.0",
"from_ip_prefix": 0,
"from_interface": "any",
"from_transport": "any",
"from_port_ranges": [
{
"start": 0,
"end": 65535
}
],
"from_service": null
},
{
"action": "ALLOW",
"action_direction": "IN",
"index": null,
"network_protocol": "ipv4",
"to_interface": "any",
"to_transport": "tcp",
"to_service": null,
"to_ports": [
80,
443
],
"to_ip": "0.0.0.0",
"to_ip_prefix": 0,
"comment": null,
"from_ip": "0.0.0.0",
"from_ip_prefix": 0,
"from_interface": "any",
"from_transport": "any",
"from_port_ranges": [
{
"start": 0,
"end": 65535
}
],
"from_service": null
},
...
]
}
$ ufw status verbose | jc --ufw -p -r
{
"status": "active",
"logging": "on",
"logging_level": "low",
"default": "deny (incoming), allow (outgoing), disabled (routed)",
"new_profiles": "skip",
"rules": [
{
"action": "ALLOW",
"action_direction": "IN",
"index": null,
"network_protocol": "ipv4",
"to_interface": "any",
"to_transport": "any",
"to_service": null,
"to_ports": [
"22"
],
"to_ip": "0.0.0.0",
"to_ip_prefix": "0",
"comment": null,
"from_ip": "0.0.0.0",
"from_ip_prefix": "0",
"from_interface": "any",
"from_transport": "any",
"from_port_ranges": [
{
"start": "0",
"end": "65535"
}
],
"from_service": null
},
{
"action": "ALLOW",
"action_direction": "IN",
"index": null,
"network_protocol": "ipv4",
"to_interface": "any",
"to_transport": "tcp",
"to_service": null,
"to_ports": [
"80",
"443"
],
"to_ip": "0.0.0.0",
"to_ip_prefix": "0",
"comment": null,
"from_ip": "0.0.0.0",
"from_ip_prefix": "0",
"from_interface": "any",
"from_transport": "any",
"from_port_ranges": [
{
"start": "0",
"end": "65535"
}
],
"from_service": null
},
...
]
}
<a id="jc.parsers.ufw.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

164
docs/parsers/ufw_appinfo.md Normal file
View File

@@ -0,0 +1,164 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.ufw_appinfo"></a>
# jc.parsers.ufw\_appinfo
jc - JSON Convert `ufw app info [application]` command
output parser
Supports individual apps via `ufw app info [application]` and all apps list
via `ufw app info all`.
Because `ufw` application definitions allow overlapping ports and port
ranges, this parser preserves that behavior, but also provides `normalized`
lists and ranges that remove duplicate ports and merge overlapping ranges.
Usage (cli):
$ ufw app info OpenSSH | jc --ufw-appinfo
or
$ jc ufw app info OpenSSH
Usage (module):
import jc
result = jc.parse('ufw_appinfo', ufw_appinfo_command_output)
Schema:
[
{
"profile": string,
"title": string,
"description": string,
"tcp_list": [
integer
],
"tcp_ranges": [
{
"start": integer, # [0]
"end": integer
}
],
"udp_list": [
integer
],
"udp_ranges": [
{
"start": integer, # [0]
"end": integer
}
],
"normalized_tcp_list": [
integers # [1]
],
"normalized_tcp_ranges": [
{
"start": integer, # [0]
"end": integers # [2]
}
],
"normalized_udp_list": [
integers # [1]
],
"normalized_udp_ranges": [
{
"start": integer, # [0]
"end": integers # [2]
}
]
}
]
[0] 'any' is converted to start/end: 0/65535
[1] duplicates and overlapping are removed
[2] overlapping are merged
Examples:
$ ufw app info MSN | jc --ufw-appinfo -p
[
{
"profile": "MSN",
"title": "MSN Chat",
"description": "MSN chat protocol (with file transfer and voice)",
"tcp_list": [
1863,
6901
],
"udp_list": [
1863,
6901
],
"tcp_ranges": [
{
"start": 6891,
"end": 6900
}
],
"normalized_tcp_list": [
1863,
6901
],
"normalized_tcp_ranges": [
{
"start": 6891,
"end": 6900
}
],
"normalized_udp_list": [
1863,
6901
]
}
]
$ ufw app info MSN | jc --ufw-appinfo -p -r
[
{
"profile": "MSN",
"title": "MSN Chat",
"description": "MSN chat protocol (with file transfer and voice)",
"tcp_list": [
"1863",
"6901"
],
"udp_list": [
"1863",
"6901"
],
"tcp_ranges": [
{
"start": "6891",
"end": "6900"
}
]
}
]
<a id="jc.parsers.ufw_appinfo.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,73 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.uname"></a>
# jc.parsers.uname
jc - JSON Convert `uname -a` command output parser
Note: Must use `uname -a`
Usage (cli):
$ uname -a | jc --uname
or
$ jc uname -a
Usage (module):
import jc
result = jc.parse('uname', uname_command_output)
Schema:
{
"kernel_name": string,
"node_name": string,
"kernel_release": string,
"operating_system": string,
"hardware_platform": string,
"processor": string,
"machine": string,
"kernel_version": string
}
Example:
$ uname -a | jc --uname -p
{
"kernel_name": "Linux",
"node_name": "user-ubuntu",
"kernel_release": "4.15.0-65-generic",
"operating_system": "GNU/Linux",
"hardware_platform": "x86_64",
"processor": "x86_64",
"machine": "x86_64",
"kernel_version": "#74-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019"
}
<a id="jc.parsers.uname.parse"></a>
### parse
```python
def parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, freebsd
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

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

@@ -0,0 +1,99 @@
# Table of Contents
* [jc.parsers.universal](#jc.parsers.universal)
* [simple\_table\_parse](#jc.parsers.universal.simple_table_parse)
* [sparse\_table\_parse](#jc.parsers.universal.sparse_table_parse)
<a id="jc.parsers.universal"></a>
# jc.parsers.universal
jc - JSON Convert universal parsers
<a id="jc.parsers.universal.simple_table_parse"></a>
### simple\_table\_parse
```python
def simple_table_parse(data: Iterable[str]) -> List[Dict]
```
Parse simple tables. There should be no blank cells. The last column
may contain data with spaces.
Example Table:
col_1 col_2 col_3 col_4 col_5
apple orange pear banana my favorite fruits
carrot squash celery spinach my favorite veggies
chicken beef pork eggs my favorite proteins
[{'col_1': 'apple', 'col_2': 'orange', 'col_3': 'pear', 'col_4':
'banana', 'col_5': 'my favorite fruits'}, {'col_1': 'carrot',
'col_2': 'squash', 'col_3': 'celery', 'col_4': 'spinach', 'col_5':
'my favorite veggies'}, {'col_1': 'chicken', 'col_2': 'beef',
'col_3': 'pork', 'col_4': 'eggs', 'col_5': 'my favorite proteins'}]
Parameters:
data: (iter) Text data to parse that has been split into lines
via .splitlines(). Item 0 must be the header row.
Any spaces in header names should be changed to
underscore '_'. You should also ensure headers are
lowercase by using .lower().
Also, ensure there are no blank lines (list items)
in the data.
Returns:
List of Dictionaries
<a id="jc.parsers.universal.sparse_table_parse"></a>
### sparse\_table\_parse
```python
def sparse_table_parse(data: Iterable[str],
delim: str = '\u2063') -> List[Dict]
```
Parse tables with missing column data or with spaces in column data.
Blank cells are converted to None in the resulting dictionary. Data
elements must line up within column boundaries.
Example Table:
col_1 col_2 col_3 col_4 col_5
apple orange fuzzy peach my favorite fruits
green beans celery spinach my favorite veggies
chicken beef brown eggs my favorite proteins
[{'col_1': 'apple', 'col_2': 'orange', 'col_3': None, 'col_4':
'fuzzy peach', 'col_5': 'my favorite fruits'}, {'col_1':
'green beans', 'col_2': None, 'col_3': 'celery', 'col_4': 'spinach',
'col_5': 'my favorite veggies'}, {'col_1': 'chicken', 'col_2':
'beef', 'col_3': None, 'col_4': 'brown eggs', 'col_5':
'my favorite proteins'}]
Parameters:
data: (iter) An iterable of string lines (e.g. str.splitlines())
Item 0 must be the header row. Any spaces in header
names should be changed to underscore '_'. You
should also ensure headers are lowercase by using
.lower(). Do not change the position of header
names as the positions are used to find the data.
Also, ensure there are no blank line items.
delim: (string) Delimiter to use. By default `u\\2063`
(invisible separator) is used since it is unlikely
to ever be seen in terminal output. You can change
this for troubleshooting purposes or if there is a
delimiter conflict with your data.
Returns:
List of Dictionaries

View File

@@ -0,0 +1,71 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.update_alt_gs"></a>
# jc.parsers.update\_alt\_gs
jc - JSON Convert `update-alternatives --get-selections` command output parser
Usage (cli):
$ update-alternatives --get-selections | jc --update-alt-gs
or
$ jc update-alternatives --get-selections
Usage (module):
import jc
result = jc.parse('update-alt-gs',
update_alternatives_get_selections_command_output)
Schema:
[
{
"name": string,
"status": string,
"current": string
}
]
Examples:
$ update-alternatives --get-selections | jc --update-alt-gs -p
[
{
"name": "arptables",
"status": "auto",
"current": "/usr/sbin/arptables-nft"
},
{
"name": "awk",
"status": "auto",
"current": "/usr/bin/gawk"
}
]
<a id="jc.parsers.update_alt_gs.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@@ -0,0 +1,157 @@
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.update_alt_q"></a>
# jc.parsers.update\_alt\_q
jc - JSON Convert `update-alternatives --query` command output parser
Usage (cli):
$ update-alternatives --query | jc --update-alt-q
or
$ jc update-alternatives --query
Usage (module):
import jc
result = jc.parse('update_alt_q',
update_alternatives_query_command_output)
Schema:
{
"name": string,
"link": string,
"slaves": [
{
"name": string,
"path": string
}
],
"status": string,
"best": string,
"value": string, # (null if 'none')
"alternatives": [
{
"alternative": string,
"priority": integer,
"slaves": [
{
"name": string,
"path": string
}
]
}
]
}
Examples:
$ update-alternatives --query editor | jc --update-alt-q -p
{
"name": "editor",
"link": "/usr/bin/editor",
"slaves": [
{
"name": "editor.1.gz",
"path": "/usr/share/man/man1/editor.1.gz"
},
{
"name": "editor.da.1.gz",
"path": "/usr/share/man/da/man1/editor.1.gz"
}
],
"status": "auto",
"best": "/bin/nano",
"value": "/bin/nano",
"alternatives": [
{
"alternative": "/bin/ed",
"priority": -100,
"slaves": [
{
"name": "editor.1.gz",
"path": "/usr/share/man/man1/ed.1.gz"
}
]
},
{
"alternative": "/bin/nano",
"priority": 40,
"slaves": [
{
"name": "editor.1.gz",
"path": "/usr/share/man/man1/nano.1.gz"
}
]
}
]
}
$ update-alternatives --query | jc --update-alt-q -p -r
{
"name": "editor",
"link": "/usr/bin/editor",
"slaves": [
{
"name": "editor.1.gz",
"path": "/usr/share/man/man1/editor.1.gz"
},
{
"name": "editor.da.1.gz",
"path": "/usr/share/man/da/man1/editor.1.gz"
}
],
"status": "auto",
"best": "/bin/nano",
"value": "/bin/nano",
"alternatives": [
{
"alternative": "/bin/ed",
"priority": "-100",
"slaves": [
{
"name": "editor.1.gz",
"path": "/usr/share/man/man1/ed.1.gz"
}
]
},
{
"alternative": "/bin/nano",
"priority": "40",
"slaves": [
{
"name": "editor.1.gz",
"path": "/usr/share/man/man1/nano.1.gz"
}
]
}
]
}
<a id="jc.parsers.update_alt_q.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)

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