1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-09 01:05:53 +02:00

doc update

This commit is contained in:
Kelly Brazil
2024-04-29 14:09:14 -07:00
parent 5bec53b3f8
commit 846f4fb691
4 changed files with 11 additions and 12 deletions

View File

@ -1,9 +1,10 @@
jc changelog
20240428 v1.25.3
20240429 v1.25.3
- Add `battery_percentage` field to `bluetoothctl` parser output
- Fix `pci-ids` parser to correctly handle multiple subdevices
- Fix `top` parsers to quiet uptime info parsing
- Fix `traceroute` parser to correctly handle hops with multiple IPs
- Optimize some tests by removing timezone settings and using quiet=True
- Documentation updates

View File

@ -145,4 +145,4 @@ Compatibility: linux, darwin, freebsd
Source: [`jc/parsers/traceroute.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/traceroute.py)
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)

View File

@ -123,7 +123,7 @@ from copy import deepcopy
class info():
"""Provides parser metadata (version, author, etc.)"""
version = '1.6'
version = '1.7'
description = '`traceroute` and `traceroute6` command parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
@ -238,6 +238,7 @@ class _Probe(object):
text += "\n"
return text
def _get_probes(hop_string: str):
probes = []
probe_asn_match = [ (match, "ASN") for match in RE_PROBE_ASN.finditer(hop_string)]
@ -272,16 +273,15 @@ def _get_probes(hop_string: str):
# If the last match is a RTT, then copy all probe values and replace RTT field
if is_last_match_rtt:
probe = deepcopy(last_probe)
probe = deepcopy(last_probe) # type: ignore
# Set RTT values
probe.rtt = probe_rtt
probe.annotation = match.groups()[2] or None
# RTT is the last value shown for a hop
if any([probe.ip, probe.asn, probe.annotation, probe.rtt, probe.name]):
probes.append(probe)
probes.append(probe)
last_probe = probe
probe = _Probe()
if match_type == "RTT":
is_last_match_rtt = True
@ -290,6 +290,7 @@ def _get_probes(hop_string: str):
return probes
def _loads(data):
lines = data.splitlines()
@ -325,7 +326,6 @@ def _loads(data):
probes = _get_probes(hop_string)
for probe in probes:
hop.add_probe(probe)
return traceroute
@ -336,6 +336,7 @@ class ParseError(Exception):
########################################################################################
def _process(proc_data):
"""
Final processing to conform to the schema.
@ -441,7 +442,4 @@ def parse(data, raw=False, quiet=False):
'hops': hops_list
}
if raw:
return raw_output
else:
return _process(raw_output)
return raw_output if raw else _process(raw_output)

View File

@ -1,4 +1,4 @@
.TH jc 1 2024-04-28 1.25.3 "JSON Convert"
.TH jc 1 2024-04-29 1.25.3 "JSON Convert"
.SH NAME
\fBjc\fP \- JSON Convert JSONifies the output of many CLI tools, file-types,
and strings