2020-12-30 12:58:52 -08:00
|
|
|
|
|
|
|
# jc.parsers.hash
|
|
|
|
jc - JSON CLI output utility `hash` command output parser
|
|
|
|
|
|
|
|
Usage (cli):
|
|
|
|
|
|
|
|
$ hash | jc --hash
|
|
|
|
|
|
|
|
Usage (module):
|
|
|
|
|
|
|
|
import jc.parsers.hash
|
|
|
|
result = jc.parsers.hash.parse(hash_command_output)
|
|
|
|
|
2021-04-08 12:42:01 -07:00
|
|
|
Schema:
|
|
|
|
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"command": string,
|
|
|
|
"hits": integer
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2020-12-30 12:58:52 -08:00
|
|
|
Compatibility:
|
|
|
|
|
|
|
|
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
|
|
$ hash | jc --hash -p
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"hits": 2,
|
|
|
|
"command": "/bin/cat"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"hits": 1,
|
|
|
|
"command": "/bin/ls"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
## info
|
|
|
|
```python
|
|
|
|
info()
|
|
|
|
```
|
2021-04-08 12:42:01 -07:00
|
|
|
Provides parser metadata (version, author, etc.)
|
2020-12-30 12:58:52 -08:00
|
|
|
|
|
|
|
## 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:
|
|
|
|
|
2021-01-04 18:01:16 -08:00
|
|
|
List of Dictionaries. Raw or processed structured data.
|
2020-12-30 12:58:52 -08:00
|
|
|
|