mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-23 00:29:59 +02:00
doc update
This commit is contained in:
@ -1,10 +1,11 @@
|
|||||||
jc changelog
|
jc changelog
|
||||||
|
|
||||||
20240510 v1.25.3
|
20240607 v1.25.3
|
||||||
- Enhance `bluetoothctl` parser with added `battery_percentage` field
|
- Enhance `bluetoothctl` parser with added `battery_percentage` field
|
||||||
- Enhance `git-log` standard and streaming parsers with added `lines_changed` field under `file_stats`
|
- Enhance `git-log` standard and streaming parsers with added `lines_changed` field under `file_stats`
|
||||||
- Fix `pci-ids` parser to correctly handle multiple subdevices
|
- Fix `pci-ids` parser to correctly handle multiple subdevices
|
||||||
- Fix `pip-show` parser to handle multi-line fields with a beginning blank line
|
- Fix `pip-show` parser to handle multi-line fields with a beginning blank line
|
||||||
|
- Fix `ss` parser to correctly handle the `Recv-Q` field being too close to the `Status` field
|
||||||
- Fix `top` parsers to quiet uptime info parsing
|
- Fix `top` parsers to quiet uptime info parsing
|
||||||
- Fix `traceroute` parser to correctly handle hops with multiple IPs
|
- Fix `traceroute` parser to correctly handle hops with multiple IPs
|
||||||
- Fix `zpool-status` parser for config items lacking data values
|
- Fix `zpool-status` parser for config items lacking data values
|
||||||
|
@ -47,6 +47,13 @@ field names
|
|||||||
"file_descriptor": string
|
"file_descriptor": string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
"inode_number": string,
|
||||||
|
"cookie": string,
|
||||||
|
"cgroup": string,
|
||||||
|
"v6only": string,
|
||||||
|
"timer_name": string,
|
||||||
|
"expire_time": string,
|
||||||
|
"retrans": string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -310,4 +317,4 @@ Compatibility: linux
|
|||||||
|
|
||||||
Source: [`jc/parsers/ss.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ss.py)
|
Source: [`jc/parsers/ss.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/ss.py)
|
||||||
|
|
||||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -42,6 +42,13 @@ field names
|
|||||||
"file_descriptor": string
|
"file_descriptor": string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
"inode_number": string,
|
||||||
|
"cookie": string,
|
||||||
|
"cgroup": string,
|
||||||
|
"v6only": string,
|
||||||
|
"timer_name": string,
|
||||||
|
"expire_time": string,
|
||||||
|
"retrans": string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -344,13 +351,16 @@ def _parse_opts(proc_data):
|
|||||||
"""
|
"""
|
||||||
o_field = proc_data.split(' ')
|
o_field = proc_data.split(' ')
|
||||||
opts = {}
|
opts = {}
|
||||||
|
|
||||||
for item in o_field:
|
for item in o_field:
|
||||||
# -e option:
|
# -e option:
|
||||||
item = re.sub(
|
item = re.sub(
|
||||||
'uid', 'uid_number',
|
'uid', 'uid_number',
|
||||||
re.sub('sk', 'cookie', re.sub('ino', 'inode_number', item)))
|
re.sub('sk', 'cookie', re.sub('ino', 'inode_number', item)))
|
||||||
|
|
||||||
if ":" in item:
|
if ":" in item:
|
||||||
key, val = item.split(':')
|
key, val = item.split(':')
|
||||||
|
|
||||||
# -o option
|
# -o option
|
||||||
if key == "timer":
|
if key == "timer":
|
||||||
val = val.replace('(', '[').replace(')', ']')
|
val = val.replace('(', '[').replace(')', ']')
|
||||||
@ -361,6 +371,7 @@ def _parse_opts(proc_data):
|
|||||||
'retrans': val[2]
|
'retrans': val[2]
|
||||||
}
|
}
|
||||||
opts[key] = val
|
opts[key] = val
|
||||||
|
|
||||||
# -p option
|
# -p option
|
||||||
if key == "users":
|
if key == "users":
|
||||||
key = 'process_id'
|
key = 'process_id'
|
||||||
@ -380,7 +391,9 @@ def _parse_opts(proc_data):
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
val = data
|
val = data
|
||||||
|
|
||||||
opts[key] = val
|
opts[key] = val
|
||||||
|
|
||||||
return opts
|
return opts
|
||||||
|
|
||||||
def parse(data, raw=False, quiet=False):
|
def parse(data, raw=False, quiet=False):
|
||||||
@ -432,10 +445,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(r'[ ]{1,}', 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(r'[ ]{2,}', 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]:
|
||||||
@ -453,7 +466,8 @@ def parse(data, raw=False, quiet=False):
|
|||||||
entry_list.insert(7, p_port)
|
entry_list.insert(7, p_port)
|
||||||
|
|
||||||
if re.search(r'ino:|uid:|sk:|users:|timer:|cgroup:|v6only:', entry_list[-1]):
|
if re.search(r'ino:|uid:|sk:|users:|timer:|cgroup:|v6only:', entry_list[-1]):
|
||||||
header_list.append('opts')
|
if header_list[-1] != 'opts':
|
||||||
|
header_list.append('opts')
|
||||||
entry_list[-1] = _parse_opts(entry_list[-1])
|
entry_list[-1] = _parse_opts(entry_list[-1])
|
||||||
|
|
||||||
output_line = dict(zip(header_list, entry_list))
|
output_line = dict(zip(header_list, entry_list))
|
||||||
|
2
man/jc.1
2
man/jc.1
@ -1,4 +1,4 @@
|
|||||||
.TH jc 1 2024-05-14 1.25.3 "JSON Convert"
|
.TH jc 1 2024-06-07 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