1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-23 00:29:59 +02:00

add examples

This commit is contained in:
Kelly Brazil
2022-06-29 18:34:20 -07:00
parent 667dc1976a
commit 207fa232c3
2 changed files with 60 additions and 9 deletions

View File

@ -1121,6 +1121,37 @@ git log --stat | jc --git-log -p or: jc -p git log --stat
}
]
```
### gpg --with-colons
```bash
gpg --with-colons --show-keys file.gpg | jc --gpg -p # or jc -p gpg --with-colons --show-keys file.gpg
```
```json
[
{
"type": "pub",
"validity": "f",
"key_length": "1024",
"pub_key_alg": "17",
"key_id": "6C7EE1B8621CC013",
"creation_date": "899817715",
"expiration_date": "1055898235",
"certsn_uidhash_trustinfo": null,
"owner_trust": "m",
"user_id": null,
"signature_class": null,
"key_capabilities": "scESC",
"cert_fingerprint_other": null,
"flag": null,
"token_sn": null,
"hash_alg": null,
"curve_name": null,
"compliance_flags": null,
"last_update_date": null,
"origin": null,
"comment": null
}
]
```
### /etc/group file
```bash
cat /etc/group | jc --group -p

View File

@ -1,14 +1,12 @@
"""jc - JSON Convert `gpg --with-colons` command output parser
<<Short gpg description and caveats>>
Usage (cli):
$ gpg --with-colons | jc --gpg
$ gpg --with-colons --show-keys file.gpg | jc --gpg
or
$ jc gpg --with-colons
$ jc gpg --with-colons --show-keys file.gpg
Usage (module):
@ -88,11 +86,33 @@ Field definitions from https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=bl
Examples:
$ gpg | jc --gpg -p
[]
$ gpg | jc --gpg -p -r
[]
$ gpg --with-colons --show-keys file.gpg | jc --gpg -p
[
{
"type": "pub",
"validity": "f",
"key_length": "1024",
"pub_key_alg": "17",
"key_id": "6C7EE1B8621CC013",
"creation_date": "899817715",
"expiration_date": "1055898235",
"certsn_uidhash_trustinfo": null,
"owner_trust": "m",
"user_id": null,
"signature_class": null,
"key_capabilities": "scESC",
"cert_fingerprint_other": null,
"flag": null,
"token_sn": null,
"hash_alg": null,
"curve_name": null,
"compliance_flags": null,
"last_update_date": null,
"origin": null,
"comment": null
},
...
]
"""
from typing import List, Dict, Optional
import jc.utils