mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-19 00:17:51 +02:00
add verbose debug option
This commit is contained in:
@ -1,5 +1,8 @@
|
|||||||
jc changelog
|
jc changelog
|
||||||
|
|
||||||
|
20200625 v1.11.8
|
||||||
|
- Add verbose debug option using -dd argument
|
||||||
|
|
||||||
20200622 v1.11.7
|
20200622 v1.11.7
|
||||||
- Fix iptables parser issue which would not output the last chain
|
- Fix iptables parser issue which would not output the last chain
|
||||||
|
|
||||||
|
17
jc/cli.py
17
jc/cli.py
@ -21,7 +21,7 @@ import jc.appdirs as appdirs
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.11.7'
|
version = '1.11.8'
|
||||||
description = 'jc cli output JSON conversion tool'
|
description = 'jc cli output JSON conversion tool'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -247,7 +247,7 @@ def helptext(message):
|
|||||||
{parsers_string}
|
{parsers_string}
|
||||||
Options:
|
Options:
|
||||||
-a about jc
|
-a about jc
|
||||||
-d debug - show trace messages
|
-d debug - show traceback (-dd for verbose traceback)
|
||||||
-m monochrome output
|
-m monochrome output
|
||||||
-p pretty print output
|
-p pretty print output
|
||||||
-q quiet - suppress warnings
|
-q quiet - suppress warnings
|
||||||
@ -264,12 +264,12 @@ def helptext(message):
|
|||||||
|
|
||||||
|
|
||||||
def json_out(data, pretty=False, mono=False, piped_out=False):
|
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:
|
if not mono and not piped_out:
|
||||||
|
# set colors
|
||||||
|
class JcStyle(Style):
|
||||||
|
styles = set_env_colors()
|
||||||
|
|
||||||
if pretty:
|
if pretty:
|
||||||
print(highlight(json.dumps(data, indent=2), JsonLexer(), Terminal256Formatter(style=JcStyle))[0:-1])
|
print(highlight(json.dumps(data, indent=2), JsonLexer(), Terminal256Formatter(style=JcStyle))[0:-1])
|
||||||
else:
|
else:
|
||||||
@ -370,6 +370,7 @@ def main():
|
|||||||
options.extend(opt[1:])
|
options.extend(opt[1:])
|
||||||
|
|
||||||
debug = 'd' in options
|
debug = 'd' in options
|
||||||
|
verbose_debug = True if options.count('d') > 1 else False
|
||||||
mono = 'm' in options
|
mono = 'm' in options
|
||||||
pretty = 'p' in options
|
pretty = 'p' in options
|
||||||
quiet = 'q' in options
|
quiet = 'q' in options
|
||||||
@ -388,6 +389,10 @@ def main():
|
|||||||
found = False
|
found = False
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
|
if verbose_debug:
|
||||||
|
import cgitb
|
||||||
|
cgitb.enable(display=1, logdir=None, context=5, format="text")
|
||||||
|
|
||||||
for arg in sys.argv:
|
for arg in sys.argv:
|
||||||
parser_name = parser_shortname(arg)
|
parser_name = parser_shortname(arg)
|
||||||
|
|
||||||
|
2
setup.py
2
setup.py
@ -5,7 +5,7 @@ with open('README.md', 'r') as f:
|
|||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name='jc',
|
name='jc',
|
||||||
version='1.11.7',
|
version='1.11.8',
|
||||||
author='Kelly Brazil',
|
author='Kelly Brazil',
|
||||||
author_email='kellyjonbrazil@gmail.com',
|
author_email='kellyjonbrazil@gmail.com',
|
||||||
description='Converts the output of popular command-line tools and file-types to JSON.',
|
description='Converts the output of popular command-line tools and file-types to JSON.',
|
||||||
|
Reference in New Issue
Block a user