mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-09 01:05:53 +02:00
add hashsum documentation
This commit is contained in:
@ -1,5 +1,9 @@
|
|||||||
jc changelog
|
jc changelog
|
||||||
|
|
||||||
|
20201229 v1.14.0
|
||||||
|
- Add hashsum parser tested on linux, macos
|
||||||
|
- Add python 3.9 to github automation tests
|
||||||
|
|
||||||
20200805 v1.13.4
|
20200805 v1.13.4
|
||||||
- Update crontab and crontab-u parsers to tighten up variable detection
|
- Update crontab and crontab-u parsers to tighten up variable detection
|
||||||
- Update ping parser to tighten linux/bsd detection
|
- Update ping parser to tighten linux/bsd detection
|
||||||
|
@ -23,6 +23,7 @@ pydocmd simple jc.parsers.free+ > ../docs/parsers/free.md
|
|||||||
pydocmd simple jc.parsers.fstab+ > ../docs/parsers/fstab.md
|
pydocmd simple jc.parsers.fstab+ > ../docs/parsers/fstab.md
|
||||||
pydocmd simple jc.parsers.group+ > ../docs/parsers/group.md
|
pydocmd simple jc.parsers.group+ > ../docs/parsers/group.md
|
||||||
pydocmd simple jc.parsers.gshadow+ > ../docs/parsers/gshadow.md
|
pydocmd simple jc.parsers.gshadow+ > ../docs/parsers/gshadow.md
|
||||||
|
pydocmd simple jc.parsers.hashsum+ > ../docs/parsers/hashsum.md
|
||||||
pydocmd simple jc.parsers.history+ > ../docs/parsers/history.md
|
pydocmd simple jc.parsers.history+ > ../docs/parsers/history.md
|
||||||
pydocmd simple jc.parsers.hosts+ > ../docs/parsers/hosts.md
|
pydocmd simple jc.parsers.hosts+ > ../docs/parsers/hosts.md
|
||||||
pydocmd simple jc.parsers.id+ > ../docs/parsers/id.md
|
pydocmd simple jc.parsers.id+ > ../docs/parsers/id.md
|
||||||
|
99
docs/parsers/hashsum.md
Normal file
99
docs/parsers/hashsum.md
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
|
||||||
|
# jc.parsers.hashsum
|
||||||
|
jc - JSON CLI output utility `hash sum` command output parser
|
||||||
|
|
||||||
|
Usage (cli):
|
||||||
|
|
||||||
|
$ md5sum file.txt | jc --hashsum
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
$ jc md5sum file.txt
|
||||||
|
|
||||||
|
Usage (module):
|
||||||
|
|
||||||
|
import jc.parsers.hashsum
|
||||||
|
result = jc.parsers.hashsum.parse(md5sum_command_output)
|
||||||
|
|
||||||
|
Compatibility:
|
||||||
|
|
||||||
|
'linux', 'darwin', 'cygwin', 'aix', 'freebsd'
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
$ md5sum * | jc --hashsum -p
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"filename": "devtoolset-3-gcc-4.9.2-6.el7.x86_64.rpm",
|
||||||
|
"hash": "65fc958c1add637ec23c4b137aecf3d3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "digout",
|
||||||
|
"hash": "5b9312ee5aff080927753c63a347707d"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "dmidecode.out",
|
||||||
|
"hash": "716fd11c2ac00db109281f7110b8fb9d"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "file with spaces in the name",
|
||||||
|
"hash": "d41d8cd98f00b204e9800998ecf8427e"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "id-centos.out",
|
||||||
|
"hash": "4295be239a14ad77ef3253103de976d2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "ifcfg.json",
|
||||||
|
"hash": "01fda0d9ba9a75618b072e64ff512b43"
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
## 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,
|
||||||
|
"hash": string,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
Reference in New Issue
Block a user