mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-17 00:07:37 +02:00
add ping parser
This commit is contained in:
@ -37,6 +37,7 @@ pydocmd simple jc.parsers.mount+ > ../docs/parsers/mount.md
|
|||||||
pydocmd simple jc.parsers.netstat+ > ../docs/parsers/netstat.md
|
pydocmd simple jc.parsers.netstat+ > ../docs/parsers/netstat.md
|
||||||
pydocmd simple jc.parsers.ntpq+ > ../docs/parsers/ntpq.md
|
pydocmd simple jc.parsers.ntpq+ > ../docs/parsers/ntpq.md
|
||||||
pydocmd simple jc.parsers.passwd+ > ../docs/parsers/passwd.md
|
pydocmd simple jc.parsers.passwd+ > ../docs/parsers/passwd.md
|
||||||
|
pydocmd simple jc.parsers.ping+ > ../docs/parsers/ping.md
|
||||||
pydocmd simple jc.parsers.pip_list+ > ../docs/parsers/pip_list.md
|
pydocmd simple jc.parsers.pip_list+ > ../docs/parsers/pip_list.md
|
||||||
pydocmd simple jc.parsers.pip_show+ > ../docs/parsers/pip_show.md
|
pydocmd simple jc.parsers.pip_show+ > ../docs/parsers/pip_show.md
|
||||||
pydocmd simple jc.parsers.ps+ > ../docs/parsers/ps.md
|
pydocmd simple jc.parsers.ps+ > ../docs/parsers/ps.md
|
||||||
|
64
docs/parsers/ping.md
Normal file
64
docs/parsers/ping.md
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
# jc.parsers.ping
|
||||||
|
jc - JSON CLI output utility ping Parser
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
specify --ping as the first argument if the piped input is coming from ping
|
||||||
|
|
||||||
|
Compatibility:
|
||||||
|
|
||||||
|
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
$ ping | jc --ping -p
|
||||||
|
[]
|
||||||
|
|
||||||
|
$ ping | jc --ping -p -r
|
||||||
|
[]
|
||||||
|
|
||||||
|
## info
|
||||||
|
```python
|
||||||
|
info(self, /, *args, **kwargs)
|
||||||
|
```
|
||||||
|
|
||||||
|
## process
|
||||||
|
```python
|
||||||
|
process(proc_data)
|
||||||
|
```
|
||||||
|
|
||||||
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
proc_data: (dictionary) raw structured data to process
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
List of dictionaries. Structured data with the following schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"ping": string,
|
||||||
|
"bar": boolean,
|
||||||
|
"baz": integer
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
## parse
|
||||||
|
```python
|
||||||
|
parse(data, raw=False, quiet=False)
|
||||||
|
```
|
||||||
|
|
||||||
|
Main text parsing function
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
data: (string) text data to parse
|
||||||
|
raw: (boolean) output preprocessed JSON if True
|
||||||
|
quiet: (boolean) suppress warning messages if True
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
List of dictionaries. Raw or processed structured data.
|
||||||
|
|
@ -21,7 +21,7 @@ import jc.appdirs as appdirs
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.12.1'
|
version = '1.13.0'
|
||||||
description = 'JSON conversion tool for CLI output'
|
description = 'JSON conversion tool for CLI output'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -63,6 +63,7 @@ parsers = [
|
|||||||
'netstat',
|
'netstat',
|
||||||
'ntpq',
|
'ntpq',
|
||||||
'passwd',
|
'passwd',
|
||||||
|
'ping',
|
||||||
'pip-list',
|
'pip-list',
|
||||||
'pip-show',
|
'pip-show',
|
||||||
'ps',
|
'ps',
|
||||||
|
Reference in New Issue
Block a user