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

compatibility function call

This commit is contained in:
Kelly Brazil
2019-11-05 17:00:36 -06:00
parent 721b546659
commit 7f99677806
2 changed files with 19 additions and 1 deletions

View File

@ -68,12 +68,26 @@ def helptext(message):
Example:
ls -al | jc --ls -p
'''
print(textwrap.dedent(helptext_string), file=sys.stderr)
def errormessage(message):
error_string = f'''
jc: {message}
'''
print(textwrap.dedent(error_string), file=sys.stderr)
def compatibility(mod_name, compatible):
if sys.platform not in compatible:
mod = mod_name.split('.')[-1]
errormessage(f'{mod} parser not compatible with your OS ({sys.platform}).\n Compatible platforms: {compatible}')
exit()
def main():
signal.signal(signal.SIGINT, ctrlc)

View File

@ -79,6 +79,7 @@ $ lsblk | jc --lsblk -p
]
"""
import string
import jc
def process(proc_data):
@ -129,6 +130,9 @@ def process(proc_data):
def parse(data, raw=False):
jc.jc.compatibility(__name__,
['linux'])
raw_output = []
linedata = data.splitlines()
# Clear any blank lines