mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-29 00:41:40 +02:00
make all summary docstrings raw
This commit is contained in:
jc/parsers
acpi.pyairport.pyairport_s.pyapt_cache_show.pyapt_get_sqq.pyarp.pyasciitable.pybluetoothctl.pybroken_parser.pycbt.pycertbot.pychage.pycksum.pyclf.pyclf_s.pycrontab.pycrontab_u.pycsv.pycsv_s.pydate.pydatetime_iso.pydebconf_show.pydf.pydig.pydisabled_parser.pydmidecode.pydpkg_l.pydu.pyefibootmgr.pyemail_address.pyenv.pyethtool.pyfile.pyfind.pyfindmnt.pyfinger.pyfoo.pyfoo_s.pyfree.pyfstab.pygit_log.pygit_log_s.pygit_ls_remote.pygpg.pygroup.pygshadow.pyhash.pyhashsum.pyhciconfig.pyhost.pyhosts.pyid.pyifconfig.pyiftop.pyini.pyini_dup.pyiostat.pyiostat_s.pyip_address.pyip_route.pyiptables.pyiw_scan.pyiwconfig.pyjobs.pyjwt.pykv.pykv_dup.pylast.pyls.pyls_s.pylsattr.pylsb_release.pylsmod.pylsof.pylspci.pylsusb.pymdadm.pymount.pympstat.pympstat_s.pyneedrestart.pynetstat.pynetstat_freebsd_osx.pynetstat_linux.pynetstat_windows.pynmcli.pynsd_control.pyntpq.pyopenvpn.pyos_prober.pypasswd.pypath.pypath_list.pypci_ids.pypgpass.pypidstat.pypidstat_s.pyping.pyping_s.pypip_list.pypip_show.pypkg_index_apk.pypkg_index_deb.pyplist.pypostconf.pyproc.pyproc_buddyinfo.pyproc_cmdline.pyproc_consoles.pyproc_cpuinfo.pyproc_crypto.pyproc_devices.pyproc_diskstats.pyproc_driver_rtc.pyproc_filesystems.pyproc_interrupts.pyproc_iomem.pyproc_ioports.pyproc_loadavg.pyproc_locks.pyproc_meminfo.pyproc_modules.pyproc_mtrr.pyproc_net_arp.pyproc_net_dev.pyproc_net_dev_mcast.pyproc_net_if_inet6.pyproc_net_igmp.pyproc_net_igmp6.pyproc_net_ipv6_route.pyproc_net_netlink.pyproc_net_netstat.pyproc_net_packet.pyproc_net_protocols.pyproc_net_route.pyproc_net_tcp.pyproc_net_unix.pyproc_pagetypeinfo.pyproc_partitions.pyproc_pid_fdinfo.pyproc_pid_io.pyproc_pid_maps.pyproc_pid_mountinfo.pyproc_pid_numa_maps.pyproc_pid_smaps.pyproc_pid_stat.pyproc_pid_statm.pyproc_slabinfo.pyproc_softirqs.pyproc_stat.pyproc_swaps.pyproc_uptime.pyproc_version.pyproc_vmallocinfo.pyproc_vmstat.pyproc_zoneinfo.pyps.pyresolve_conf.pyroute.pyroute_windows.pyrpm_qi.pyrsync.pyrsync_s.pysemver.pysfdisk.pyshadow.pysrt.pyss.pyssh_conf.pysshd_conf.pystat.pystat_s.pyswapon.pysysctl.pysyslog_bsd.pysyslog_bsd_s.pysyslog_s.pysystemctl.pysystemctl_lj.pysystemctl_ls.pysystemctl_luf.pytimedatectl.pytimestamp.pytoml.pytop.pytop_s.pytracepath.pytraceroute.pytune2fs.pyufw.pyufw_appinfo.pyuname.pyuniversal.pyupdate_alt_gs.pyupdate_alt_q.pyupower.pyuptime.pyver.pyveracrypt.pyvmstat.pyvmstat_s.pyw.pywc.pywho.pyx509_csr.pyxml.pyxrandr.pyyaml.pyzipinfo.pyzpool_iostat.pyzpool_status.py
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `acpi` command output parser
|
||||
r"""jc - JSON Convert `acpi` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `airport -I` command output parser
|
||||
r"""jc - JSON Convert `airport -I` command output parser
|
||||
|
||||
The `airport` program can be found at `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport`.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `airport -s` command output parser
|
||||
r"""jc - JSON Convert `airport -s` command output parser
|
||||
|
||||
The `airport` program can be found at `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport`.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `apt-cache show` command parser
|
||||
r"""jc - JSON Convert `apt-cache show` command parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `apt-get -sqq` command output parser
|
||||
r"""jc - JSON Convert `apt-get -sqq` command output parser
|
||||
|
||||
Requires the `-sqq` options in `apt-get`.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `arp` command output parser
|
||||
r"""jc - JSON Convert `arp` command output parser
|
||||
|
||||
Supports `arp` and `arp -a` output.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `asciitable` parser
|
||||
r"""jc - JSON Convert `asciitable` parser
|
||||
|
||||
This parser converts ASCII and Unicode text tables with single-line rows.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `bluetoothctl` command output parser
|
||||
r"""jc - JSON Convert `bluetoothctl` command output parser
|
||||
|
||||
Supports the following `bluetoothctl` subcommands:
|
||||
- `bluetoothctl list`
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert broken parser - for testing purposes only"""
|
||||
r"""jc - JSON Convert broken parser - for testing purposes only"""
|
||||
import non_existent_library
|
||||
|
||||
class info():
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `cbt` command output parser (Google Bigtable)
|
||||
r"""jc - JSON Convert `cbt` command output parser (Google Bigtable)
|
||||
|
||||
Parses the human-, but not machine-, friendly output of the cbt command (for
|
||||
Google's Bigtable).
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `certbot` command output parser
|
||||
r"""jc - JSON Convert `certbot` command output parser
|
||||
|
||||
Supports the following `certbot` commands:
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `chage --list` command output parser
|
||||
r"""jc - JSON Convert `chage --list` command output parser
|
||||
|
||||
Supports `chage -l <username>` or `chage --list <username>`
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `cksum` command output parser
|
||||
r"""jc - JSON Convert `cksum` command output parser
|
||||
|
||||
This parser works with the following checksum calculation utilities:
|
||||
- `sum`
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert Common Log Format file parser
|
||||
r"""jc - JSON Convert Common Log Format file parser
|
||||
|
||||
This parser will handle the Common Log Format standard as specified at
|
||||
https://www.w3.org/Daemon/User/Config/Logging.html#common-logfile-format.
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert Common Log Format file streaming parser
|
||||
r"""jc - JSON Convert Common Log Format file streaming parser
|
||||
|
||||
> This streaming parser outputs JSON Lines (cli) or returns an Iterable of
|
||||
> Dictionaries (module)
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `crontab -l` command output and crontab
|
||||
r"""jc - JSON Convert `crontab -l` command output and crontab
|
||||
file parser
|
||||
|
||||
Supports `crontab -l` command output and crontab files.
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `crontab -l` command output and crontab
|
||||
r"""jc - JSON Convert `crontab -l` command output and crontab
|
||||
file parser
|
||||
|
||||
This version of the `crontab -l` parser supports output that contains user
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `csv` file parser
|
||||
r"""jc - JSON Convert `csv` file parser
|
||||
|
||||
The `csv` parser will attempt to automatically detect the delimiter
|
||||
character. If the delimiter cannot be detected it will default to comma.
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `csv` file streaming parser
|
||||
r"""jc - JSON Convert `csv` file streaming parser
|
||||
|
||||
> This streaming parser outputs JSON Lines (cli) or returns an Iterable of
|
||||
> Dictionaries (module)
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `date` command output parser
|
||||
r"""jc - JSON Convert `date` command output parser
|
||||
|
||||
The `epoch` calculated timestamp field is naive. (i.e. based on the local
|
||||
time of the system the parser is run on)
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert ISO 8601 Datetime string parser
|
||||
r"""jc - JSON Convert ISO 8601 Datetime string parser
|
||||
|
||||
This parser supports standard ISO 8601 strings that include both date and
|
||||
time. If no timezone or offset information is available in the string, then
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `debconf-show` command output parser
|
||||
r"""jc - JSON Convert `debconf-show` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `df` command output parser
|
||||
r"""jc - JSON Convert `df` command output parser
|
||||
|
||||
Values are normalized to bytes when using `df -h`.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `dig` command output parser
|
||||
r"""jc - JSON Convert `dig` command output parser
|
||||
|
||||
Options supported:
|
||||
- `+noall +answer` options are supported in cases where only the answer
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert disabled parser
|
||||
r"""jc - JSON Convert disabled parser
|
||||
|
||||
This parser has been disabled due to an error in the parser code.
|
||||
"""
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `dmidecode` command output parser
|
||||
r"""jc - JSON Convert `dmidecode` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `dpkg -l` command output parser
|
||||
r"""jc - JSON Convert `dpkg -l` command output parser
|
||||
|
||||
Set the `COLUMNS` environment variable to a large value to avoid field
|
||||
truncation. For example:
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `du` command output parser
|
||||
r"""jc - JSON Convert `du` command output parser
|
||||
|
||||
The `du -h` option is not supported with the default output. If you
|
||||
would like to use `du -h` or other options that change the output, be sure
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `efibootmgr` command output parser
|
||||
r"""jc - JSON Convert `efibootmgr` command output parser
|
||||
|
||||
The `-v` option is also supported.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert Email Address string parser
|
||||
r"""jc - JSON Convert Email Address string parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `env` and `printenv` command output parser
|
||||
r"""jc - JSON Convert `env` and `printenv` command output parser
|
||||
|
||||
This parser will output a list of dictionaries each containing `name` and
|
||||
`value` keys. If you would like a simple dictionary output, then use the
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `ethtool` command output parser
|
||||
r"""jc - JSON Convert `ethtool` command output parser
|
||||
|
||||
Supports standard `ethtool` output and the `--module-info` option.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `file` command output parser
|
||||
r"""jc - JSON Convert `file` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `find` command output parser
|
||||
r"""jc - JSON Convert `find` command output parser
|
||||
|
||||
This parser returns a list of objects by default and a list of strings if
|
||||
the `--raw` option is used.
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `findmnt` command output parser
|
||||
r"""jc - JSON Convert `findmnt` command output parser
|
||||
|
||||
Supports `-a`, `-l`, or no `findmnt` options.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `finger` command output parser
|
||||
r"""jc - JSON Convert `finger` command output parser
|
||||
|
||||
Supports `-s` output option. Does not support the `-l` detail option.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `foo` command output parser
|
||||
r"""jc - JSON Convert `foo` command output parser
|
||||
|
||||
<<Short foo description and caveats>>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `foo` command output streaming parser
|
||||
r"""jc - JSON Convert `foo` command output streaming parser
|
||||
|
||||
> This streaming parser outputs JSON Lines (cli) or returns an Iterable of
|
||||
> Dictionaries (module)
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `free` command output parser
|
||||
r"""jc - JSON Convert `free` command output parser
|
||||
|
||||
Values are normalized to bytes when using `free -h`.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `fstab` file parser
|
||||
r"""jc - JSON Convert `fstab` file parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `git log` command output parser
|
||||
r"""jc - JSON Convert `git log` command output parser
|
||||
|
||||
Can be used with the following format options:
|
||||
- `oneline`
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `git log` command output streaming parser
|
||||
r"""jc - JSON Convert `git log` command output streaming parser
|
||||
|
||||
> This streaming parser outputs JSON Lines (cli) or returns an Iterable of
|
||||
> Dictionaries (module)
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `git ls-remote` command output parser
|
||||
r"""jc - JSON Convert `git ls-remote` command output parser
|
||||
|
||||
This parser outputs two schemas:
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `gpg --with-colons` command output parser
|
||||
r"""jc - JSON Convert `gpg --with-colons` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `/etc/group` file parser
|
||||
r"""jc - JSON Convert `/etc/group` file parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `/etc/gshadow` file parser
|
||||
r"""jc - JSON Convert `/etc/gshadow` file parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `hash` command output parser
|
||||
r"""jc - JSON Convert `hash` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `hash sum` command output parser
|
||||
r"""jc - JSON Convert `hash sum` command output parser
|
||||
|
||||
This parser works with the following hash calculation utilities:
|
||||
- `md5`
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `hciconfig` command output parser
|
||||
r"""jc - JSON Convert `hciconfig` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `host` command output parser
|
||||
r"""jc - JSON Convert `host` command output parser
|
||||
|
||||
Supports parsing of the most commonly used RR types (A, AAAA, MX, TXT)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `/etc/hosts` file parser
|
||||
r"""jc - JSON Convert `/etc/hosts` file parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `id` command output parser
|
||||
r"""jc - JSON Convert `id` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `ifconfig` command output parser
|
||||
r"""jc - JSON Convert `ifconfig` command output parser
|
||||
|
||||
No `ifconfig` options are supported.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `iftop` command output parser
|
||||
r"""jc - JSON Convert `iftop` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert INI file parser
|
||||
r"""jc - JSON Convert INI file parser
|
||||
|
||||
Parses standard INI files.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert INI with duplicate key file parser
|
||||
r"""jc - JSON Convert INI with duplicate key file parser
|
||||
|
||||
Parses standard INI files and preserves duplicate values. All values are
|
||||
contained in lists/arrays.
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `iostat` command output parser
|
||||
r"""jc - JSON Convert `iostat` command output parser
|
||||
|
||||
> Note: `iostat` version 11 and higher include a JSON output option
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `iostat` command output streaming parser
|
||||
r"""jc - JSON Convert `iostat` command output streaming parser
|
||||
|
||||
> This streaming parser outputs JSON Lines (cli) or returns an Iterable of
|
||||
> Dictionaries (module)
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert IP Address string parser
|
||||
r"""jc - JSON Convert IP Address string parser
|
||||
|
||||
Accepts standard and integer IP address notation for both IPv4 and IPv6
|
||||
addresses. CIDR subnet mask and Scope ID is also allowed for standard
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `ip route` command output parser
|
||||
r"""jc - JSON Convert `ip route` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `iptables` command output parser
|
||||
r"""jc - JSON Convert `iptables` command output parser
|
||||
|
||||
Supports `-vLn` and `--line-numbers` for all tables.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `iw dev <device> scan` command output parser
|
||||
r"""jc - JSON Convert `iw dev <device> scan` command output parser
|
||||
|
||||
This parser is considered beta quality. Not all fields are parsed and there
|
||||
are not enough samples to test.
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `iwconfig` command output parser
|
||||
r"""jc - JSON Convert `iwconfig` command output parser
|
||||
|
||||
No `iwconfig` options are supported.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `jobs` command output parser
|
||||
r"""jc - JSON Convert `jobs` command output parser
|
||||
|
||||
Also supports the `-l` option.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert JWT string parser
|
||||
r"""jc - JSON Convert JWT string parser
|
||||
|
||||
> Note: `jc` will not check the integrity of the JWT payload.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `Key/Value` file and string parser
|
||||
r"""jc - JSON Convert `Key/Value` file and string parser
|
||||
|
||||
Supports files containing simple key/value pairs.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `Key/Value` with duplicate key file and string parser
|
||||
r"""jc - JSON Convert `Key/Value` with duplicate key file and string parser
|
||||
|
||||
Supports files containing simple key/value pairs and preserves duplicate
|
||||
values. All values are contained in lists/arrays.
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `last` and `lastb` command output parser
|
||||
r"""jc - JSON Convert `last` and `lastb` command output parser
|
||||
|
||||
Supports `-w`, `-F`, and `-x` options.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `ls` and `vdir` command output parser
|
||||
r"""jc - JSON Convert `ls` and `vdir` command output parser
|
||||
|
||||
Options supported:
|
||||
- `lbaR1`
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `ls` and `vdir` command output streaming parser
|
||||
r"""jc - JSON Convert `ls` and `vdir` command output streaming parser
|
||||
|
||||
> This streaming parser outputs JSON Lines (cli) or returns an Iterable of
|
||||
> Dictionaries (module)
|
||||
|
@ -1,162 +1,162 @@
|
||||
"""jc - JSON Convert `lsattr` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ lsattr | jc --lsattr
|
||||
|
||||
or
|
||||
|
||||
$ jc lsattr
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('lsattr', lsattr_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
Information from https://github.com/mirror/busybox/blob/2d4a3d9e6c1493a9520b907e07a41aca90cdfd94/e2fsprogs/e2fs_lib.c#L40
|
||||
used to define field names
|
||||
|
||||
[
|
||||
{
|
||||
"file": string,
|
||||
"compressed_file": Optional[boolean],
|
||||
"compressed_dirty_file": Optional[boolean],
|
||||
"compression_raw_access": Optional[boolean],
|
||||
"secure_deletion": Optional[boolean],
|
||||
"undelete": Optional[boolean],
|
||||
"synchronous_updates": Optional[boolean],
|
||||
"synchronous_directory_updates": Optional[boolean],
|
||||
"immutable": Optional[boolean],
|
||||
"append_only": Optional[boolean],
|
||||
"no_dump": Optional[boolean],
|
||||
"no_atime": Optional[boolean],
|
||||
"compression_requested": Optional[boolean],
|
||||
"encrypted": Optional[boolean],
|
||||
"journaled_data": Optional[boolean],
|
||||
"indexed_directory": Optional[boolean],
|
||||
"no_tailmerging": Optional[boolean],
|
||||
"top_of_directory_hierarchies": Optional[boolean],
|
||||
"extents": Optional[boolean],
|
||||
"no_cow": Optional[boolean],
|
||||
"casefold": Optional[boolean],
|
||||
"inline_data": Optional[boolean],
|
||||
"project_hierarchy": Optional[boolean],
|
||||
"verity": Optional[boolean],
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ sudo lsattr /etc/passwd | jc --lsattr
|
||||
[
|
||||
{
|
||||
"file": "/etc/passwd",
|
||||
"extents": true
|
||||
}
|
||||
]
|
||||
"""
|
||||
from typing import List, Dict
|
||||
from jc.jc_types import JSONDictType
|
||||
import jc.utils
|
||||
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.0'
|
||||
description = '`lsattr` command parser'
|
||||
author = 'Mark Rotner'
|
||||
author_email = 'rotner.mr@gmail.com'
|
||||
compatible = ['linux']
|
||||
magic_commands = ['lsattr']
|
||||
tags = ['command']
|
||||
|
||||
|
||||
__version__ = info.version
|
||||
|
||||
|
||||
ERROR_PREFIX = "lsattr:"
|
||||
|
||||
# https://github.com/mirror/busybox/blob/2d4a3d9e6c1493a9520b907e07a41aca90cdfd94/e2fsprogs/e2fs_lib.c#L40
|
||||
# https://github.com/landley/toybox/blob/f1682dc79fd75f64042b5438918fe5a507977e1c/toys/other/lsattr.c#L97
|
||||
ATTRIBUTES = {
|
||||
"B": "compressed_file",
|
||||
"Z": "compressed_dirty_file",
|
||||
"X": "compression_raw_access",
|
||||
"s": "secure_deletion",
|
||||
"u": "undelete",
|
||||
"S": "synchronous_updates",
|
||||
"D": "synchronous_directory_updates",
|
||||
"i": "immutable",
|
||||
"a": "append_only",
|
||||
"d": "no_dump",
|
||||
"A": "no_atime",
|
||||
"c": "compression_requested",
|
||||
"E": "encrypted",
|
||||
"j": "journaled_data",
|
||||
"I": "indexed_directory",
|
||||
"t": "no_tailmerging",
|
||||
"T": "top_of_directory_hierarchies",
|
||||
"e": "extents",
|
||||
"C": "no_cow",
|
||||
"F": "casefold",
|
||||
"N": "inline_data",
|
||||
"P": "project_hierarchy",
|
||||
"V": "verity",
|
||||
}
|
||||
|
||||
|
||||
def parse(
|
||||
data: str,
|
||||
raw: bool = False,
|
||||
quiet: bool = False
|
||||
) -> List[JSONDictType]:
|
||||
"""
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
"""
|
||||
jc.utils.compatibility(__name__, info.compatible, quiet)
|
||||
jc.utils.input_type_check(data)
|
||||
|
||||
output: List = []
|
||||
|
||||
cleandata = list(filter(None, data.splitlines()))
|
||||
|
||||
if not jc.utils.has_data(data):
|
||||
return output
|
||||
|
||||
for line in cleandata:
|
||||
# -R flag returns the output in the format:
|
||||
# Folder:
|
||||
# attributes file_in_folder
|
||||
if line.endswith(':'):
|
||||
continue
|
||||
|
||||
# lsattr: Operation not supported ....
|
||||
if line.startswith(ERROR_PREFIX):
|
||||
continue
|
||||
|
||||
line_output: Dict = {}
|
||||
|
||||
# attributes file
|
||||
# --------------e----- /etc/passwd
|
||||
attributes, file = line.split()
|
||||
line_output['file'] = file
|
||||
for attribute in list(attributes):
|
||||
attribute_key = ATTRIBUTES.get(attribute)
|
||||
if attribute_key:
|
||||
line_output[attribute_key] = True
|
||||
|
||||
if line_output:
|
||||
output.append(line_output)
|
||||
|
||||
return output
|
||||
r"""jc - JSON Convert `lsattr` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ lsattr | jc --lsattr
|
||||
|
||||
or
|
||||
|
||||
$ jc lsattr
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('lsattr', lsattr_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
Information from https://github.com/mirror/busybox/blob/2d4a3d9e6c1493a9520b907e07a41aca90cdfd94/e2fsprogs/e2fs_lib.c#L40
|
||||
used to define field names
|
||||
|
||||
[
|
||||
{
|
||||
"file": string,
|
||||
"compressed_file": Optional[boolean],
|
||||
"compressed_dirty_file": Optional[boolean],
|
||||
"compression_raw_access": Optional[boolean],
|
||||
"secure_deletion": Optional[boolean],
|
||||
"undelete": Optional[boolean],
|
||||
"synchronous_updates": Optional[boolean],
|
||||
"synchronous_directory_updates": Optional[boolean],
|
||||
"immutable": Optional[boolean],
|
||||
"append_only": Optional[boolean],
|
||||
"no_dump": Optional[boolean],
|
||||
"no_atime": Optional[boolean],
|
||||
"compression_requested": Optional[boolean],
|
||||
"encrypted": Optional[boolean],
|
||||
"journaled_data": Optional[boolean],
|
||||
"indexed_directory": Optional[boolean],
|
||||
"no_tailmerging": Optional[boolean],
|
||||
"top_of_directory_hierarchies": Optional[boolean],
|
||||
"extents": Optional[boolean],
|
||||
"no_cow": Optional[boolean],
|
||||
"casefold": Optional[boolean],
|
||||
"inline_data": Optional[boolean],
|
||||
"project_hierarchy": Optional[boolean],
|
||||
"verity": Optional[boolean],
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ sudo lsattr /etc/passwd | jc --lsattr
|
||||
[
|
||||
{
|
||||
"file": "/etc/passwd",
|
||||
"extents": true
|
||||
}
|
||||
]
|
||||
"""
|
||||
from typing import List, Dict
|
||||
from jc.jc_types import JSONDictType
|
||||
import jc.utils
|
||||
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.0'
|
||||
description = '`lsattr` command parser'
|
||||
author = 'Mark Rotner'
|
||||
author_email = 'rotner.mr@gmail.com'
|
||||
compatible = ['linux']
|
||||
magic_commands = ['lsattr']
|
||||
tags = ['command']
|
||||
|
||||
|
||||
__version__ = info.version
|
||||
|
||||
|
||||
ERROR_PREFIX = "lsattr:"
|
||||
|
||||
# https://github.com/mirror/busybox/blob/2d4a3d9e6c1493a9520b907e07a41aca90cdfd94/e2fsprogs/e2fs_lib.c#L40
|
||||
# https://github.com/landley/toybox/blob/f1682dc79fd75f64042b5438918fe5a507977e1c/toys/other/lsattr.c#L97
|
||||
ATTRIBUTES = {
|
||||
"B": "compressed_file",
|
||||
"Z": "compressed_dirty_file",
|
||||
"X": "compression_raw_access",
|
||||
"s": "secure_deletion",
|
||||
"u": "undelete",
|
||||
"S": "synchronous_updates",
|
||||
"D": "synchronous_directory_updates",
|
||||
"i": "immutable",
|
||||
"a": "append_only",
|
||||
"d": "no_dump",
|
||||
"A": "no_atime",
|
||||
"c": "compression_requested",
|
||||
"E": "encrypted",
|
||||
"j": "journaled_data",
|
||||
"I": "indexed_directory",
|
||||
"t": "no_tailmerging",
|
||||
"T": "top_of_directory_hierarchies",
|
||||
"e": "extents",
|
||||
"C": "no_cow",
|
||||
"F": "casefold",
|
||||
"N": "inline_data",
|
||||
"P": "project_hierarchy",
|
||||
"V": "verity",
|
||||
}
|
||||
|
||||
|
||||
def parse(
|
||||
data: str,
|
||||
raw: bool = False,
|
||||
quiet: bool = False
|
||||
) -> List[JSONDictType]:
|
||||
"""
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
"""
|
||||
jc.utils.compatibility(__name__, info.compatible, quiet)
|
||||
jc.utils.input_type_check(data)
|
||||
|
||||
output: List = []
|
||||
|
||||
cleandata = list(filter(None, data.splitlines()))
|
||||
|
||||
if not jc.utils.has_data(data):
|
||||
return output
|
||||
|
||||
for line in cleandata:
|
||||
# -R flag returns the output in the format:
|
||||
# Folder:
|
||||
# attributes file_in_folder
|
||||
if line.endswith(':'):
|
||||
continue
|
||||
|
||||
# lsattr: Operation not supported ....
|
||||
if line.startswith(ERROR_PREFIX):
|
||||
continue
|
||||
|
||||
line_output: Dict = {}
|
||||
|
||||
# attributes file
|
||||
# --------------e----- /etc/passwd
|
||||
attributes, file = line.split()
|
||||
line_output['file'] = file
|
||||
for attribute in list(attributes):
|
||||
attribute_key = ATTRIBUTES.get(attribute)
|
||||
if attribute_key:
|
||||
line_output[attribute_key] = True
|
||||
|
||||
if line_output:
|
||||
output.append(line_output)
|
||||
|
||||
return output
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `lsb_release` command parser
|
||||
r"""jc - JSON Convert `lsb_release` command parser
|
||||
|
||||
This parser is an alias to the Key/Value parser (`--kv`).
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `lsmod` command output parser
|
||||
r"""jc - JSON Convert `lsmod` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `lsof` command output parser
|
||||
r"""jc - JSON Convert `lsof` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `lspci -mmv` command output parser
|
||||
r"""jc - JSON Convert `lspci -mmv` command output parser
|
||||
|
||||
This parser supports the following `lspci` options:
|
||||
- `-mmv`
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `lsusb` command output parser
|
||||
r"""jc - JSON Convert `lsusb` command output parser
|
||||
|
||||
Supports the `-v` option or no options.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `mdadm` command output parser
|
||||
r"""jc - JSON Convert `mdadm` command output parser
|
||||
|
||||
Supports the `--query` and `--examine` options in `mdadm`.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `mount` command output parser
|
||||
r"""jc - JSON Convert `mount` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `mpstat` command output parser
|
||||
r"""jc - JSON Convert `mpstat` command output parser
|
||||
|
||||
> Note: Latest versions of `mpstat` support JSON output (v11.5.1+)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `mpstat` command output streaming parser
|
||||
r"""jc - JSON Convert `mpstat` command output streaming parser
|
||||
|
||||
> This streaming parser outputs JSON Lines (cli) or returns an Iterable of
|
||||
> Dictionaries (module)
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `needrestart -b` command output parser
|
||||
r"""jc - JSON Convert `needrestart -b` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `netstat` command output parser
|
||||
r"""jc - JSON Convert `netstat` command output parser
|
||||
|
||||
Caveats:
|
||||
- Use of multiple `l` options is not supported on OSX (e.g. `netstat -rlll`)
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert FreeBSD and OSX netstat Parser"""
|
||||
r"""jc - JSON Convert FreeBSD and OSX netstat Parser"""
|
||||
|
||||
|
||||
def normalize_headers(header):
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert Linux netstat Parser"""
|
||||
r"""jc - JSON Convert Linux netstat Parser"""
|
||||
import string
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""
|
||||
r"""
|
||||
jc - JSON Convert Windows `netstat` command output parser
|
||||
"""
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `nmcli` command output parser
|
||||
r"""jc - JSON Convert `nmcli` command output parser
|
||||
|
||||
Supports the following `nmcli` subcommands:
|
||||
- `nmcli general`
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `nsd-control` command output parser
|
||||
r"""jc - JSON Convert `nsd-control` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `ntpq -p` command output parser
|
||||
r"""jc - JSON Convert `ntpq -p` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert openvpn-status.log file parser
|
||||
r"""jc - JSON Convert openvpn-status.log file parser
|
||||
|
||||
The `*_epoch` calculated timestamp fields are naive. (i.e. based on
|
||||
the local time of the system the parser is run on)
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `os-prober` command output parser
|
||||
r"""jc - JSON Convert `os-prober` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `/etc/passwd` file Parser
|
||||
r"""jc - JSON Convert `/etc/passwd` file Parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert POSIX path string parser
|
||||
r"""jc - JSON Convert POSIX path string parser
|
||||
|
||||
Parse a POSIX path.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert POSIX path list string parser
|
||||
r"""jc - JSON Convert POSIX path list string parser
|
||||
|
||||
Parse a colon-separated POSIX path list, commonly found in environment
|
||||
variables.
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `pci.ids` file parser
|
||||
r"""jc - JSON Convert `pci.ids` file parser
|
||||
|
||||
This parser converts the pci.ids database file.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert PostgreSQL password file parser
|
||||
r"""jc - JSON Convert PostgreSQL password file parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `pidstat -H` command output parser
|
||||
r"""jc - JSON Convert `pidstat -H` command output parser
|
||||
|
||||
Must use the `-H` (or `-h`, if `-H` is not available) option in `pidstat`.
|
||||
All other `pidstat` options are supported in combination with this option.
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `pidstat -H` command output streaming parser
|
||||
r"""jc - JSON Convert `pidstat -H` command output streaming parser
|
||||
|
||||
> This streaming parser outputs JSON Lines (cli) or returns an Iterable of
|
||||
> Dictionaries (module)
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `ping` command output parser
|
||||
r"""jc - JSON Convert `ping` command output parser
|
||||
|
||||
Supports `ping` and `ping6` output.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `ping` command output streaming parser
|
||||
r"""jc - JSON Convert `ping` command output streaming parser
|
||||
|
||||
> This streaming parser outputs JSON Lines (cli) or returns an Iterable of
|
||||
> Dictionaries (module)
|
||||
|
@ -1,4 +1,4 @@
|
||||
"""jc - JSON Convert `pip-list` command output parser
|
||||
r"""jc - JSON Convert `pip-list` command output parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user