1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2026-04-05 17:50:11 +02:00

Compare commits

...

2 Commits

Author SHA1 Message Date
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
4 changed files with 16 additions and 8 deletions

View File

@@ -176,7 +176,7 @@ The JSON output can be compact (default) or pretty formatted with the `-p` optio
### Options
- `-a` about `jc`. Prints information about `jc` and the parsers (in JSON, of course!)
- `-d` debug mode. Prints trace messages if parsing issues encountered
- `-d` debug mode. Prints trace messages if parsing issues encountered (use `-dd` for verbose debugging)
- `-m` monochrome JSON output
- `-p` pretty format the JSON output
- `-q` quiet mode. Suppresses warning messages

View File

@@ -1,5 +1,8 @@
jc changelog
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

View File

@@ -21,7 +21,7 @@ import jc.appdirs as appdirs
class info():
version = '1.11.7'
version = '1.11.8'
description = 'jc cli output JSON conversion tool'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
@@ -247,7 +247,7 @@ def helptext(message):
{parsers_string}
Options:
-a about jc
-d debug - show trace messages
-d debug - show traceback (-dd for verbose traceback)
-m monochrome output
-p pretty print output
-q quiet - suppress warnings
@@ -264,12 +264,12 @@ def helptext(message):
def json_out(data, pretty=False, mono=False, piped_out=False):
# set colors
class JcStyle(Style):
styles = set_env_colors()
if not mono and not piped_out:
# set colors
class JcStyle(Style):
styles = set_env_colors()
if pretty:
print(highlight(json.dumps(data, indent=2), JsonLexer(), Terminal256Formatter(style=JcStyle))[0:-1])
else:
@@ -370,6 +370,7 @@ def main():
options.extend(opt[1:])
debug = 'd' in options
verbose_debug = True if options.count('d') > 1 else False
mono = 'm' in options
pretty = 'p' in options
quiet = 'q' in options
@@ -388,6 +389,10 @@ def main():
found = False
if debug:
if verbose_debug:
import cgitb
cgitb.enable(display=1, logdir=None, context=5, format="text")
for arg in sys.argv:
parser_name = parser_shortname(arg)

View File

@@ -5,7 +5,7 @@ with open('README.md', 'r') as f:
setuptools.setup(
name='jc',
version='1.11.7',
version='1.11.8',
author='Kelly Brazil',
author_email='kellyjonbrazil@gmail.com',
description='Converts the output of popular command-line tools and file-types to JSON.',