mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-19 00:17:51 +02:00
compatibility function call
This commit is contained in:
16
jc/jc.py
16
jc/jc.py
@ -68,12 +68,26 @@ def helptext(message):
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
ls -al | jc --ls -p
|
ls -al | jc --ls -p
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
print(textwrap.dedent(helptext_string), file=sys.stderr)
|
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():
|
def main():
|
||||||
signal.signal(signal.SIGINT, ctrlc)
|
signal.signal(signal.SIGINT, ctrlc)
|
||||||
|
|
||||||
|
@ -79,6 +79,7 @@ $ lsblk | jc --lsblk -p
|
|||||||
]
|
]
|
||||||
"""
|
"""
|
||||||
import string
|
import string
|
||||||
|
import jc
|
||||||
|
|
||||||
|
|
||||||
def process(proc_data):
|
def process(proc_data):
|
||||||
@ -129,6 +130,9 @@ def process(proc_data):
|
|||||||
|
|
||||||
|
|
||||||
def parse(data, raw=False):
|
def parse(data, raw=False):
|
||||||
|
jc.jc.compatibility(__name__,
|
||||||
|
['linux'])
|
||||||
|
|
||||||
raw_output = []
|
raw_output = []
|
||||||
linedata = data.splitlines()
|
linedata = data.splitlines()
|
||||||
# Clear any blank lines
|
# Clear any blank lines
|
||||||
|
Reference in New Issue
Block a user