mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-15 01:24:29 +02:00
doc update
This commit is contained in:
@ -415,6 +415,8 @@ def parse(data, raw=False, quiet=False):
|
|||||||
|
|
||||||
contains_colon = ['nl', 'p_raw', 'raw', 'udp', 'tcp', 'v_str', 'icmp6']
|
contains_colon = ['nl', 'p_raw', 'raw', 'udp', 'tcp', 'v_str', 'icmp6']
|
||||||
raw_output = []
|
raw_output = []
|
||||||
|
ONE_SPACE_PATTERN = r'[ ]{1,}'
|
||||||
|
TWO_SPACE_PATTERN = r'[ ]{2,}'
|
||||||
|
|
||||||
# Clear any blank lines
|
# Clear any blank lines
|
||||||
cleandata = list(filter(None, data.splitlines()))
|
cleandata = list(filter(None, data.splitlines()))
|
||||||
@ -423,7 +425,7 @@ def parse(data, raw=False, quiet=False):
|
|||||||
header_text = cleandata[0].lower()
|
header_text = cleandata[0].lower()
|
||||||
|
|
||||||
# get the position of Recv-Q since sometimes it doesn't leave enough space
|
# get the position of Recv-Q since sometimes it doesn't leave enough space
|
||||||
# to parse. need at least two spaces between main fields do differentiate
|
# to parse. need at least two spaces between main fields to differentiate
|
||||||
# from opt fields, which are only separated by one space
|
# from opt fields, which are only separated by one space
|
||||||
recv_q_position = header_text.find('recv-q')
|
recv_q_position = header_text.find('recv-q')
|
||||||
|
|
||||||
@ -445,10 +447,10 @@ def parse(data, raw=False, quiet=False):
|
|||||||
# fix weird ss bug where first two columns have no space between them sometimes
|
# fix weird ss bug where first two columns have no space between them sometimes
|
||||||
entry = entry[:5] + ' ' + entry[5:]
|
entry = entry[:5] + ' ' + entry[5:]
|
||||||
|
|
||||||
entry_list = re.split(r'[ ]{1,}', entry.strip())
|
entry_list = re.split(ONE_SPACE_PATTERN, entry.strip())
|
||||||
|
|
||||||
if len(entry_list) > len(header_list) or extra_opts == True:
|
if len(entry_list) > len(header_list) or extra_opts == True:
|
||||||
entry_list = re.split(r'[ ]{2,}', entry.strip())
|
entry_list = re.split(TWO_SPACE_PATTERN, entry.strip())
|
||||||
extra_opts = True
|
extra_opts = True
|
||||||
|
|
||||||
if entry_list[0] in contains_colon and ':' in entry_list[4]:
|
if entry_list[0] in contains_colon and ':' in entry_list[4]:
|
||||||
|
2
man/jc.1
2
man/jc.1
@ -1,4 +1,4 @@
|
|||||||
.TH jc 1 2024-06-07 1.25.3 "JSON Convert"
|
.TH jc 1 2024-06-09 1.25.3 "JSON Convert"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
\fBjc\fP \- JSON Convert JSONifies the output of many CLI tools, file-types,
|
\fBjc\fP \- JSON Convert JSONifies the output of many CLI tools, file-types,
|
||||||
and strings
|
and strings
|
||||||
|
Reference in New Issue
Block a user