mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-21 00:19:42 +02:00
add cksum parser
This commit is contained in:
95
docs/parsers/cksum.md
Normal file
95
docs/parsers/cksum.md
Normal file
@ -0,0 +1,95 @@
|
||||
|
||||
# jc.parsers.cksum
|
||||
jc - JSON CLI output utility `cksum` command output parser
|
||||
|
||||
This parser works with the following checksum calculation utilities:
|
||||
- `sum`
|
||||
- `cksum`
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cksum file.txt | jc --cksum
|
||||
|
||||
or
|
||||
|
||||
$ jc cksum file.txt
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc.parsers.cksum
|
||||
result = jc.parsers.cksum.parse(cksum_command_output)
|
||||
|
||||
Compatibility:
|
||||
|
||||
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
||||
|
||||
Examples:
|
||||
|
||||
$ cksum * | jc --cksum -p
|
||||
[
|
||||
{
|
||||
"filename": "__init__.py",
|
||||
"checksum": 4294967295,
|
||||
"blocks": 0
|
||||
},
|
||||
{
|
||||
"filename": "airport.py",
|
||||
"checksum": 2208551092,
|
||||
"blocks": 3745
|
||||
},
|
||||
{
|
||||
"filename": "airport_s.py",
|
||||
"checksum": 1113817598,
|
||||
"blocks": 4572
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
|
||||
|
||||
## 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:
|
||||
|
||||
[
|
||||
{
|
||||
"filename": string,
|
||||
"checksum": integer,
|
||||
"blocks": 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.
|
||||
|
@ -2,7 +2,7 @@
|
||||
# jc.parsers.hashsum
|
||||
jc - JSON CLI output utility `hash sum` command output parser
|
||||
|
||||
This parser works with the following hash calculation programs:
|
||||
This parser works with the following hash calculation utilities:
|
||||
- `md5`
|
||||
- `md5sum`
|
||||
- `shasum`
|
||||
|
Reference in New Issue
Block a user