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

95 lines
2.1 KiB
Markdown
Raw Normal View History

2023-12-16 12:55:29 -08:00
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_cmdline"></a>
2024-03-14 22:46:52 -07:00
# jc.parsers.proc_cmdline
2023-12-16 12:55:29 -08:00
jc - JSON Convert `/proc/cmdline` file parser
Usage (cli):
$ cat /proc/cmdline | jc --proc
or
$ jc /proc/cmdline
or
$ cat /proc/cmdline | jc --proc-cmdline
Usage (module):
import jc
result = jc.parse('proc_cmdline', proc_cmdline_file)
Schema:
{
"<key>": string,
"_options": [
string
]
}
Examples:
$ cat /proc/cmdline | jc --proc -p
{
"BOOT_IMAGE": "clonezilla/live/vmlinuz",
"consoleblank": "0",
"keyboard-options": "grp:ctrl_shift_toggle,lctrl_shift_toggle",
"ethdevice-timeout": "130",
"toram": "filesystem.squashfs",
"boot": "live",
"edd": "on",
"ocs_daemonon": "ssh lighttpd",
"ocs_live_run": "sudo screen /usr/sbin/ocs-sr -g auto -e1 auto -e2 -batch -r -j2 -k -scr -p true restoreparts win7-64 sda1",
"ocs_live_extra_param": "",
"keyboard-layouts": "us,ru",
"ocs_live_batch": "no",
"locales": "ru_RU.UTF-8",
"vga": "788",
"net.ifnames": "0",
"union": "overlay",
"fetch": "http://10.1.1.1/tftpboot/clonezilla/live/filesystem.squashfs",
"ocs_postrun99": "sudo reboot",
"initrd": "clonezilla/live/initrd.img",
"_options": [
"config",
"noswap",
"nolocales",
"nomodeset",
"noprompt",
"nosplash",
"nodmraid",
"components"
]
}
<a id="jc.parsers.proc_cmdline.parse"></a>
### parse
```python
2024-03-14 22:46:52 -07:00
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
2023-12-16 12:55:29 -08:00
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux
2023-12-21 14:55:21 -08:00
Source: [`jc/parsers/proc_cmdline.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/proc_cmdline.py)
2023-12-16 12:55:29 -08:00
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)