1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-19 00:17:51 +02:00

cleanup helptext

This commit is contained in:
Kelly Brazil
2019-11-04 08:06:50 -08:00
parent f26c5818bd
commit c220e35b14

View File

@ -7,6 +7,7 @@ Main input module
import sys
import signal
import json
import textwrap
import jc.parsers.arp
import jc.parsers.df
import jc.parsers.dig
@ -36,9 +37,9 @@ def ctrlc(signum, frame):
def main():
helptext = '''
Usage: jc PARSER [OPTIONS]
Usage: jc PARSER [OPTIONS]
Parsers:
Parsers:
--arp arp parser
--df df parser
--dig dig parser
@ -60,18 +61,18 @@ Parsers:
--uptime uptime parser
--w w parser
Options:
Options:
-p pretty print output
Example:
Example:
ls -al | jc --ls -p
'''
'''
signal.signal(signal.SIGINT, ctrlc)
if sys.stdin.isatty():
print('jc: missing piped data' + helptext, file=sys.stderr)
print('jc: missing piped data' + textwrap.dedent(helptext), file=sys.stderr)
exit()
data = sys.stdin.read()
@ -143,7 +144,7 @@ Example:
result = jc.parsers.w.parse(data)
else:
print('jc: missing or incorrect arguments' + helptext, file=sys.stderr)
print('jc: missing or incorrect arguments' + textwrap.dedent(helptext), file=sys.stderr)
exit()
# output resulting dictionary as json