mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-17 00:07:37 +02:00
73 lines
1.2 KiB
Markdown
73 lines
1.2 KiB
Markdown
![]() |
# jc.parsers.env
|
||
|
jc - JSON CLI output utility env Parser
|
||
|
|
||
|
Usage:
|
||
|
specify --env as the first argument if the piped input is coming from env
|
||
|
|
||
|
Examples:
|
||
|
|
||
|
$ env | jc --env -p
|
||
|
[
|
||
|
{
|
||
|
"name": "XDG_SESSION_ID",
|
||
|
"value": "1"
|
||
|
},
|
||
|
{
|
||
|
"name": "HOSTNAME",
|
||
|
"value": "localhost.localdomain"
|
||
|
},
|
||
|
{
|
||
|
"name": "TERM",
|
||
|
"value": "vt220"
|
||
|
},
|
||
|
{
|
||
|
"name": "SHELL",
|
||
|
"value": "/bin/bash"
|
||
|
},
|
||
|
{
|
||
|
"name": "HISTSIZE",
|
||
|
"value": "1000"
|
||
|
},
|
||
|
...
|
||
|
]
|
||
|
|
||
|
$ env | jc --env -p -r
|
||
|
{
|
||
|
"TERM": "xterm-256color",
|
||
|
"SHELL": "/bin/bash",
|
||
|
"USER": "root",
|
||
|
"PATH": "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",
|
||
|
"PWD": "/root",
|
||
|
"LANG": "en_US.UTF-8",
|
||
|
"HOME": "/root",
|
||
|
"LOGNAME": "root",
|
||
|
"_": "/usr/bin/env"
|
||
|
}
|
||
|
|
||
|
## process
|
||
|
```python
|
||
|
process(proc_data)
|
||
|
```
|
||
|
|
||
|
schema:
|
||
|
|
||
|
[
|
||
|
{
|
||
|
"name": string,
|
||
|
"value": string
|
||
|
}
|
||
|
]
|
||
|
|
||
|
## parse
|
||
|
```python
|
||
|
parse(data, raw=False, quiet=False)
|
||
|
```
|
||
|
|
||
|
Main parsing function
|
||
|
|
||
|
Arguments:
|
||
|
|
||
|
raw: (boolean) output preprocessed JSON if True
|
||
|
quiet: (boolean) suppress warning messages if True
|
||
|
|