1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00
Files
jc/docs/parsers/sysctl.md

87 lines
1.8 KiB
Markdown
Raw Normal View History

2020-07-09 16:18:33 -07:00
# jc.parsers.sysctl
jc - JSON CLI output utility sysctl -a Parser
Usage:
specify --sysctl as the first argument if the piped input is coming from sysctl -a
Note: since sysctl output is not easily parsable only a very simple key/value object
will be output. An attempt is made to covert obvious integers and floats. If no
conversion is desired, use the -r (raw) option.
Compatibility:
'linux', 'darwin', 'freebsd'
Examples:
$ sysctl | jc --sysctl -p
{
"user.cs_path": "/usr/bin:/bin:/usr/sbin:/sbin",
"user.bc_base_max": 99,
"user.bc_dim_max": 2048,
"user.bc_scale_max": 99,
"user.bc_string_max": 1000,
"user.coll_weights_max": 2,
"user.expr_nest_max": 32
...
}
$ sysctl | jc --sysctl -p -r
{
"user.cs_path": "/usr/bin:/bin:/usr/sbin:/sbin",
"user.bc_base_max": "99",
"user.bc_dim_max": "2048",
"user.bc_scale_max": "99",
"user.bc_string_max": "1000",
"user.coll_weights_max": "2",
"user.expr_nest_max": "32",
...
}
## info
```python
info(self, /, *args, **kwargs)
```
## process
```python
process(proc_data)
```
Final processing to conform to the schema.
Parameters:
proc_data: (dictionary) raw structured data to process
Returns:
Dictionary. Structured data with the following schema:
[
{
"foo": string/integer/float,
"bar": string/integer/float,
"baz": string/integer/float
}
]
## 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:
Dictionary. Raw or processed structured data.