mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-15 01:24:29 +02:00
@ -1,5 +1,12 @@
|
||||
jc changelog
|
||||
|
||||
20220127 v1.18.2
|
||||
- Fix for plugin parsers with underscores in the name
|
||||
- Add type hints to public API functions
|
||||
- Add plugin attribute to plugin parser metadata
|
||||
- Add C locale hint to parsing error messages
|
||||
- Refactor more cli code into lib
|
||||
|
||||
20220121 v1.18.1
|
||||
- Minor fix for MacOS binary
|
||||
|
||||
|
@ -1,3 +1,2 @@
|
||||
include jc/man/jc.1.gz
|
||||
include man/jc.1
|
||||
include CHANGELOG
|
||||
|
@ -1,7 +1,7 @@
|
||||

|
||||

|
||||
|
||||
> `jc` was just featured in the [Console Open Source Newsletter](https://console.substack.com/p/console-89)
|
||||
> `jc` was recently featured in the [Console Open Source Newsletter](https://console.substack.com/p/console-89)
|
||||
|
||||
> Check out the `jc` Python [package documentation](https://github.com/kellyjonbrazil/jc/tree/master/docs) for developers
|
||||
|
||||
|
91
docgen.sh
91
docgen.sh
@ -1,31 +1,104 @@
|
||||
#!/bin/bash
|
||||
# Generate docs.md
|
||||
# requires pydoc-markdown 2.1.0.post1
|
||||
# requires pydoc-markdown 4.5.0
|
||||
readme_config=$(cat <<'EOF'
|
||||
{
|
||||
"processors": [
|
||||
{
|
||||
"type": "filter"
|
||||
},
|
||||
{
|
||||
"type": "pydocmd"
|
||||
}
|
||||
],
|
||||
"renderer": {
|
||||
"type": "markdown",
|
||||
"header_level_by_type": {
|
||||
"Module": 1,
|
||||
"Class": 3,
|
||||
"Method": 3,
|
||||
"Function": 3,
|
||||
"Data": 3
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
)
|
||||
|
||||
toc_config=$(cat <<'EOF'
|
||||
{
|
||||
"processors": [
|
||||
{
|
||||
"type": "filter"
|
||||
},
|
||||
{
|
||||
"type": "pydocmd"
|
||||
}
|
||||
],
|
||||
"renderer": {
|
||||
"type": "markdown",
|
||||
"render_toc": true,
|
||||
"header_level_by_type": {
|
||||
"Module": 1,
|
||||
"Class": 3,
|
||||
"Method": 3,
|
||||
"Function": 3,
|
||||
"Data": 3
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
)
|
||||
|
||||
parser_config=$(cat <<'EOF'
|
||||
{
|
||||
"processors": [
|
||||
{
|
||||
"type": "filter",
|
||||
"expression": "not name == \"info\" and not name.startswith(\"_\") and default()"
|
||||
},
|
||||
{
|
||||
"type": "pydocmd"
|
||||
}
|
||||
],
|
||||
"renderer": {
|
||||
"type": "markdown",
|
||||
"header_level_by_type": {
|
||||
"Module": 1,
|
||||
"Class": 3,
|
||||
"Method": 3,
|
||||
"Function": 3,
|
||||
"Data": 3
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
)
|
||||
|
||||
cd jc
|
||||
echo Building docs for: package
|
||||
pydocmd simple jc+ > ../docs/readme.md
|
||||
pydoc-markdown -m jc "${readme_config}" > ../docs/readme.md
|
||||
|
||||
echo Building docs for: lib
|
||||
pydocmd simple lib+ > ../docs/lib.md
|
||||
pydoc-markdown -m jc.lib "${toc_config}" > ../docs/lib.md
|
||||
|
||||
echo Building docs for: utils
|
||||
pydocmd simple utils+ > ../docs/utils.md
|
||||
pydoc-markdown -m jc.utils "${toc_config}" > ../docs/utils.md
|
||||
|
||||
echo Building docs for: universal parser
|
||||
pydocmd simple jc.parsers.universal+ > ../docs/parsers/universal.md
|
||||
pydoc-markdown -m jc.parsers.universal "${toc_config}" > ../docs/parsers/universal.md
|
||||
|
||||
# a bit of inception here... jc is being used to help
|
||||
# automate the generation of its own documentation. :)
|
||||
|
||||
# pull jc parser objects into a bash array from jq
|
||||
# filter out any plugin parsers
|
||||
parsers=()
|
||||
while read -r value
|
||||
do
|
||||
parsers+=("$value")
|
||||
done < <(jc -a | jq -c '.parsers[]')
|
||||
done < <(jc -a | jq -c '.parsers[] | select(.plugin != true)')
|
||||
|
||||
# iterate over the bash array
|
||||
for parser in "${parsers[@]}"
|
||||
do
|
||||
parser_name=$(jq -r '.name' <<< "$parser")
|
||||
@ -36,8 +109,8 @@ do
|
||||
|
||||
echo "Building docs for: ${parser_name}"
|
||||
echo "[Home](https://kellyjonbrazil.github.io/jc/)" > ../docs/parsers/"${parser_name}".md
|
||||
pydocmd simple jc.parsers."${parser_name}"+ >> ../docs/parsers/"${parser_name}".md
|
||||
echo "## Parser Information" >> ../docs/parsers/"${parser_name}".md
|
||||
pydoc-markdown -m jc.parsers."${parser_name}" "${parser_config}" >> ../docs/parsers/"${parser_name}".md
|
||||
echo "### Parser Information" >> ../docs/parsers/"${parser_name}".md
|
||||
echo "Compatibility: ${compatible}" >> ../docs/parsers/"${parser_name}".md
|
||||
echo >> ../docs/parsers/"${parser_name}".md
|
||||
echo "Version ${version} by ${author} (${author_email})" >> ../docs/parsers/"${parser_name}".md
|
||||
|
78
docs/lib.md
78
docs/lib.md
@ -1,17 +1,26 @@
|
||||
# Table of Contents
|
||||
|
||||
* [jc.lib](#jc.lib)
|
||||
* [parse](#jc.lib.parse)
|
||||
* [parser\_mod\_list](#jc.lib.parser_mod_list)
|
||||
* [plugin\_parser\_mod\_list](#jc.lib.plugin_parser_mod_list)
|
||||
* [parser\_info](#jc.lib.parser_info)
|
||||
* [all\_parser\_info](#jc.lib.all_parser_info)
|
||||
* [get\_help](#jc.lib.get_help)
|
||||
|
||||
<a id="jc.lib"></a>
|
||||
|
||||
# jc.lib
|
||||
|
||||
# lib
|
||||
jc - JSON CLI output utility
|
||||
JC lib module
|
||||
|
||||
<a id="jc.lib.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(parser_mod_name,
|
||||
data,
|
||||
quiet=False,
|
||||
raw=False,
|
||||
ignore_exceptions=None,
|
||||
**kwargs)
|
||||
def parse(parser_mod_name: str, data: Union[str, Iterable[str]], quiet: bool = False, raw: bool = False, ignore_exceptions: bool = None, **kwargs) -> Union[Dict, List[Dict], Iterator[Dict]]
|
||||
```
|
||||
|
||||
Parse the string data using the supplied parser module.
|
||||
@ -49,7 +58,10 @@ parsers without this API:
|
||||
|
||||
Parameters:
|
||||
|
||||
parser_mod_name: (string) name of the parser module
|
||||
parser_mod_name: (string) name of the parser module. This
|
||||
function will accept module_name,
|
||||
cli-name, and --argument-name
|
||||
variants of the module name.
|
||||
|
||||
data: (string or data to parse (string for normal
|
||||
iterator) parsers, iterator of strings for
|
||||
@ -67,24 +79,60 @@ Returns:
|
||||
Standard Parsers: Dictionary or List of Dictionaries
|
||||
Streaming Parsers: Generator Object containing Dictionaries
|
||||
|
||||
<a id="jc.lib.parser_mod_list"></a>
|
||||
|
||||
### parser\_mod\_list
|
||||
|
||||
## parser_mod_list
|
||||
```python
|
||||
parser_mod_list()
|
||||
def parser_mod_list() -> List[str]
|
||||
```
|
||||
|
||||
Returns a list of all available parser module names.
|
||||
|
||||
## plugin_parser_mod_list
|
||||
<a id="jc.lib.plugin_parser_mod_list"></a>
|
||||
|
||||
### plugin\_parser\_mod\_list
|
||||
|
||||
```python
|
||||
plugin_parser_mod_list()
|
||||
def plugin_parser_mod_list() -> List[str]
|
||||
```
|
||||
|
||||
Returns a list of plugin parser module names. This function is a
|
||||
subset of `parser_mod_list()`.
|
||||
|
||||
<a id="jc.lib.parser_info"></a>
|
||||
|
||||
### parser\_info
|
||||
|
||||
## get_help
|
||||
```python
|
||||
get_help(parser_mod_name)
|
||||
def parser_info(parser_mod_name: str) -> Union[Dict, None]
|
||||
```
|
||||
|
||||
Returns a dictionary that includes the module metadata.
|
||||
|
||||
This function will accept **module_name**, **cli-name**, and
|
||||
**--argument-name** variants of the module name string.
|
||||
|
||||
<a id="jc.lib.all_parser_info"></a>
|
||||
|
||||
### all\_parser\_info
|
||||
|
||||
```python
|
||||
def all_parser_info() -> List[Optional[Dict]]
|
||||
```
|
||||
|
||||
Returns a list of dictionaris that includes metadata for all modules.
|
||||
|
||||
<a id="jc.lib.get_help"></a>
|
||||
|
||||
### get\_help
|
||||
|
||||
```python
|
||||
def get_help(parser_mod_name: str) -> None
|
||||
```
|
||||
|
||||
Show help screen for the selected parser.
|
||||
|
||||
This function will accept **module_name**, **cli-name**, and
|
||||
**--argument-name** variants of the module name string.
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.acpi"></a>
|
||||
|
||||
# jc.parsers.acpi
|
||||
|
||||
jc - JSON CLI output utility `acpi` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -230,16 +232,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.acpi.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -254,7 +252,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.airport"></a>
|
||||
|
||||
# jc.parsers.airport
|
||||
|
||||
jc - JSON CLI output utility `airport -I` command output parser
|
||||
|
||||
The `airport` program can be found at `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport`.
|
||||
@ -83,16 +85,12 @@ Examples:
|
||||
"channel": "48,80"
|
||||
}
|
||||
|
||||
<a id="jc.parsers.airport.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -107,7 +105,7 @@ Returns:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: darwin
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.airport_s"></a>
|
||||
|
||||
# jc.parsers.airport\_s
|
||||
|
||||
# jc.parsers.airport_s
|
||||
jc - JSON CLI output utility `airport -s` command output parser
|
||||
|
||||
The `airport` program can be found at `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport`.
|
||||
@ -111,16 +113,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.airport_s.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -135,7 +133,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: darwin
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.arp"></a>
|
||||
|
||||
# jc.parsers.arp
|
||||
|
||||
jc - JSON CLI output utility `arp` command output parser
|
||||
|
||||
Supports `arp` and `arp -a` output.
|
||||
@ -120,16 +122,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.arp.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -144,7 +142,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, aix, freebsd, darwin
|
||||
|
||||
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.blkid"></a>
|
||||
|
||||
# jc.parsers.blkid
|
||||
|
||||
jc - JSON CLI output utility `blkid` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -88,7 +90,7 @@ Examples:
|
||||
{
|
||||
"id_fs_uuid": "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM",
|
||||
"id_fs_uuid_enc": "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM",
|
||||
"id_fs_version": "LVM2\x20001",
|
||||
"id_fs_version": "LVM2\\x20001",
|
||||
"id_fs_type": "LVM2_member",
|
||||
"id_fs_usage": "raid",
|
||||
"id_iolimit_minimum_io_size": 512,
|
||||
@ -123,16 +125,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.blkid.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -147,7 +145,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.cksum"></a>
|
||||
|
||||
# jc.parsers.cksum
|
||||
|
||||
jc - JSON CLI output utility `cksum` command output parser
|
||||
|
||||
This parser works with the following checksum calculation utilities:
|
||||
@ -57,16 +59,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.cksum.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -81,7 +79,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.crontab"></a>
|
||||
|
||||
# jc.parsers.crontab
|
||||
|
||||
jc - JSON CLI output utility `crontab -l` command output and crontab
|
||||
file parser
|
||||
|
||||
@ -176,16 +178,12 @@ Examples:
|
||||
]
|
||||
}
|
||||
|
||||
<a id="jc.parsers.crontab.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -200,7 +198,7 @@ Returns:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, aix, freebsd
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.crontab_u"></a>
|
||||
|
||||
# jc.parsers.crontab\_u
|
||||
|
||||
# jc.parsers.crontab_u
|
||||
jc - JSON CLI output utility `crontab -l` command output and crontab
|
||||
file parser
|
||||
|
||||
@ -173,16 +175,12 @@ Examples:
|
||||
]
|
||||
}
|
||||
|
||||
<a id="jc.parsers.crontab_u.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -197,7 +195,7 @@ Returns:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, aix, freebsd
|
||||
|
||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.csv"></a>
|
||||
|
||||
# jc.parsers.csv
|
||||
|
||||
jc - JSON CLI output utility `csv` file parser
|
||||
|
||||
The `csv` parser will attempt to automatically detect the delimiter
|
||||
@ -80,16 +82,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.csv.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -104,7 +102,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.csv_s"></a>
|
||||
|
||||
# jc.parsers.csv\_s
|
||||
|
||||
# jc.parsers.csv_s
|
||||
jc - JSON CLI output utility `csv` file streaming parser
|
||||
|
||||
> This streaming parser outputs JSON Lines
|
||||
@ -66,16 +68,12 @@ Examples:
|
||||
{"Sell":"129","List":"132","Living":"13","Rooms":"6","Beds":"3"...}
|
||||
...
|
||||
|
||||
<a id="jc.parsers.csv_s.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False, ignore_exceptions=False)
|
||||
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
|
||||
```
|
||||
|
||||
Main text parsing generator function. Returns an iterator object.
|
||||
@ -97,7 +95,7 @@ Returns:
|
||||
|
||||
Iterator object
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.date"></a>
|
||||
|
||||
# jc.parsers.date
|
||||
|
||||
jc - JSON CLI output utility `date` command output parser
|
||||
|
||||
The `epoch` calculated timestamp field is naive. (i.e. based on the local
|
||||
@ -80,16 +82,12 @@ Examples:
|
||||
"timezone_aware": true
|
||||
}
|
||||
|
||||
<a id="jc.parsers.date.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -104,7 +102,7 @@ Returns:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 2.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.df"></a>
|
||||
|
||||
# jc.parsers.df
|
||||
|
||||
jc - JSON CLI output utility `df` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -100,16 +102,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.df.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -124,7 +122,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.dig"></a>
|
||||
|
||||
# jc.parsers.dig
|
||||
|
||||
jc - JSON CLI output utility `dig` command output parser
|
||||
|
||||
Options supported:
|
||||
@ -325,16 +327,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.dig.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -349,7 +347,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, aix, freebsd, darwin, win32, cygwin
|
||||
|
||||
Version 2.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.dir"></a>
|
||||
|
||||
# jc.parsers.dir
|
||||
|
||||
jc - JSON CLI output utility `dir` command output parser
|
||||
|
||||
Options supported:
|
||||
@ -53,7 +55,7 @@ Examples:
|
||||
"dir": true,
|
||||
"size": null,
|
||||
"filename": ".",
|
||||
"parent": "C:\Program Files\Internet Explorer",
|
||||
"parent": "C:\\Program Files\\Internet Explorer",
|
||||
"epoch": 1616624100
|
||||
},
|
||||
{
|
||||
@ -62,7 +64,7 @@ Examples:
|
||||
"dir": true,
|
||||
"size": null,
|
||||
"filename": "..",
|
||||
"parent": "C:\Program Files\Internet Explorer",
|
||||
"parent": "C:\\Program Files\\Internet Explorer",
|
||||
"epoch": 1616624100
|
||||
},
|
||||
{
|
||||
@ -71,7 +73,7 @@ Examples:
|
||||
"dir": true,
|
||||
"size": null,
|
||||
"filename": "en-US",
|
||||
"parent": "C:\Program Files\Internet Explorer",
|
||||
"parent": "C:\\Program Files\\Internet Explorer",
|
||||
"epoch": 1575715740
|
||||
},
|
||||
{
|
||||
@ -80,7 +82,7 @@ Examples:
|
||||
"dir": false,
|
||||
"size": 54784,
|
||||
"filename": "ExtExport.exe",
|
||||
"parent": "C:\Program Files\Internet Explorer",
|
||||
"parent": "C:\\Program Files\\Internet Explorer",
|
||||
"epoch": 1575713340
|
||||
},
|
||||
...
|
||||
@ -94,7 +96,7 @@ Examples:
|
||||
"dir": true,
|
||||
"size": null,
|
||||
"filename": ".",
|
||||
"parent": "C:\Program Files\Internet Explorer"
|
||||
"parent": "C:\\Program Files\\Internet Explorer"
|
||||
},
|
||||
{
|
||||
"date": "03/24/2021",
|
||||
@ -102,7 +104,7 @@ Examples:
|
||||
"dir": true,
|
||||
"size": null,
|
||||
"filename": "..",
|
||||
"parent": "C:\Program Files\Internet Explorer"
|
||||
"parent": "C:\\Program Files\\Internet Explorer"
|
||||
},
|
||||
{
|
||||
"date": "12/07/2019",
|
||||
@ -110,7 +112,7 @@ Examples:
|
||||
"dir": true,
|
||||
"size": null,
|
||||
"filename": "en-US",
|
||||
"parent": "C:\Program Files\Internet Explorer"
|
||||
"parent": "C:\\Program Files\\Internet Explorer"
|
||||
},
|
||||
{
|
||||
"date": "12/07/2019",
|
||||
@ -118,21 +120,17 @@ Examples:
|
||||
"dir": false,
|
||||
"size": "54,784",
|
||||
"filename": "ExtExport.exe",
|
||||
"parent": "C:\Program Files\Internet Explorer"
|
||||
"parent": "C:\\Program Files\\Internet Explorer"
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.dir.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -147,7 +145,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: win32
|
||||
|
||||
Version 1.4 by Rasheed Elsaleh (rasheed@rebelliondefense.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.dmidecode"></a>
|
||||
|
||||
# jc.parsers.dmidecode
|
||||
|
||||
jc - JSON CLI output utility `dmidecode` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -128,16 +130,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.dmidecode.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -152,7 +150,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.dpkg_l"></a>
|
||||
|
||||
# jc.parsers.dpkg\_l
|
||||
|
||||
# jc.parsers.dpkg_l
|
||||
jc - JSON CLI output utility `dpkg -l` command output parser
|
||||
|
||||
Set the `COLUMNS` environment variable to a large value to avoid field
|
||||
@ -134,16 +136,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.dpkg_l.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -158,7 +156,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.du"></a>
|
||||
|
||||
# jc.parsers.du
|
||||
|
||||
jc - JSON CLI output utility `du` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -90,16 +92,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.du.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -114,7 +112,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, aix, freebsd
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.env"></a>
|
||||
|
||||
# jc.parsers.env
|
||||
|
||||
jc - JSON CLI output utility `env` and `printenv` command output parser
|
||||
|
||||
This parser will output a list of dictionaries each containing `name` and
|
||||
@ -75,16 +77,12 @@ Examples:
|
||||
"_": "/usr/bin/env"
|
||||
}
|
||||
|
||||
<a id="jc.parsers.env.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -100,7 +98,7 @@ Returns:
|
||||
Dictionary of raw structured data or
|
||||
List of Dictionaries of processed structured data
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.file"></a>
|
||||
|
||||
# jc.parsers.file
|
||||
|
||||
jc - JSON CLI output utility `file` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -65,16 +67,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.file.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -89,7 +87,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, aix, freebsd, darwin
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.finger"></a>
|
||||
|
||||
# jc.parsers.finger
|
||||
|
||||
jc - JSON CLI output utility `finger` command output parser
|
||||
|
||||
Supports `-s` output option. Does not support the `-l` detail option.
|
||||
@ -93,16 +95,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.finger.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -117,7 +115,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, freebsd
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.free"></a>
|
||||
|
||||
# jc.parsers.free
|
||||
|
||||
jc - JSON CLI output utility `free` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -75,16 +77,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.free.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -99,7 +97,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.fstab"></a>
|
||||
|
||||
# jc.parsers.fstab
|
||||
|
||||
jc - JSON CLI output utility `fstab` file parser
|
||||
|
||||
Usage (cli):
|
||||
@ -88,16 +90,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.fstab.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -112,7 +110,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, freebsd
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.group"></a>
|
||||
|
||||
# jc.parsers.group
|
||||
|
||||
jc - JSON CLI output utility `/etc/group` file parser
|
||||
|
||||
Usage (cli):
|
||||
@ -112,16 +114,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.group.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -136,7 +134,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, aix, freebsd
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.gshadow"></a>
|
||||
|
||||
# jc.parsers.gshadow
|
||||
|
||||
jc - JSON CLI output utility `/etc/gshadow` file parser
|
||||
|
||||
Usage (cli):
|
||||
@ -80,16 +82,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.gshadow.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -104,7 +102,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, aix, freebsd
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.hash"></a>
|
||||
|
||||
# jc.parsers.hash
|
||||
|
||||
jc - JSON CLI output utility `hash` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -40,16 +42,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.hash.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -64,7 +62,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.hashsum"></a>
|
||||
|
||||
# jc.parsers.hashsum
|
||||
|
||||
jc - JSON CLI output utility `hash sum` command output parser
|
||||
|
||||
This parser works with the following hash calculation utilities:
|
||||
@ -71,16 +73,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.hashsum.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -95,7 +93,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.hciconfig"></a>
|
||||
|
||||
# jc.parsers.hciconfig
|
||||
|
||||
jc - JSON CLI output utility `hciconfig` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -320,16 +322,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.hciconfig.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -344,7 +342,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.history"></a>
|
||||
|
||||
# jc.parsers.history
|
||||
|
||||
jc - JSON CLI output utility `history` command output parser
|
||||
|
||||
This parser will output a list of dictionaries each containing `line` and
|
||||
@ -48,7 +50,7 @@ Examples:
|
||||
},
|
||||
{
|
||||
"line": 120,
|
||||
"command": "echo "hello""
|
||||
"command": "echo \"hello\""
|
||||
},
|
||||
{
|
||||
"line": 121,
|
||||
@ -61,21 +63,17 @@ Examples:
|
||||
{
|
||||
"118": "sleep 100",
|
||||
"119": "ls /bin",
|
||||
"120": "echo "hello"",
|
||||
"120": "echo \"hello\"",
|
||||
"121": "docker images",
|
||||
...
|
||||
}
|
||||
|
||||
<a id="jc.parsers.history.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -91,7 +89,7 @@ Returns:
|
||||
Dictionary of raw structured data or
|
||||
List of Dictionaries of processed structured data
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.hosts"></a>
|
||||
|
||||
# jc.parsers.hosts
|
||||
|
||||
jc - JSON CLI output utility `/etc/hosts` file parser
|
||||
|
||||
Usage (cli):
|
||||
@ -77,16 +79,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.hosts.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -101,7 +99,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.id"></a>
|
||||
|
||||
# jc.parsers.id
|
||||
|
||||
jc - JSON CLI output utility `id` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -108,16 +110,12 @@ Examples:
|
||||
}
|
||||
}
|
||||
|
||||
<a id="jc.parsers.id.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -132,7 +130,7 @@ Returns:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, aix, freebsd
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ifconfig"></a>
|
||||
|
||||
# jc.parsers.ifconfig
|
||||
|
||||
jc - JSON CLI output utility `ifconfig` command output parser
|
||||
|
||||
Note: No `ifconfig` options are supported.
|
||||
@ -189,16 +191,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.ifconfig.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -213,7 +211,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, aix, freebsd, darwin
|
||||
|
||||
Version 1.11 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ini"></a>
|
||||
|
||||
# jc.parsers.ini
|
||||
|
||||
jc - JSON CLI output utility `INI` file parser
|
||||
|
||||
Parses standard `INI` files and files containing simple key/value pairs.
|
||||
@ -69,16 +71,12 @@ Examples:
|
||||
}
|
||||
}
|
||||
|
||||
<a id="jc.parsers.ini.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -93,7 +91,7 @@ Returns:
|
||||
|
||||
Dictionary representing the ini file
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.iostat"></a>
|
||||
|
||||
# jc.parsers.iostat
|
||||
|
||||
jc - JSON CLI output utility `iostat` command output parser
|
||||
|
||||
Note: `iostat` version 11 and higher include a JSON output option
|
||||
@ -162,16 +164,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.iostat.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -186,7 +184,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.iostat_s"></a>
|
||||
|
||||
# jc.parsers.iostat\_s
|
||||
|
||||
# jc.parsers.iostat_s
|
||||
jc - JSON CLI output utility `iostat` command output streaming parser
|
||||
|
||||
> This streaming parser outputs JSON Lines
|
||||
@ -103,16 +105,12 @@ Examples:
|
||||
{"device":"sda","tps":"0.24","kb_read_s":"5.28","kb_wrtn_s":"1.10"...}
|
||||
...
|
||||
|
||||
<a id="jc.parsers.iostat_s.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False, ignore_exceptions=False)
|
||||
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
|
||||
```
|
||||
|
||||
Main text parsing generator function. Returns an iterator object.
|
||||
@ -134,7 +132,7 @@ Returns:
|
||||
|
||||
Iterator object
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.iptables"></a>
|
||||
|
||||
# jc.parsers.iptables
|
||||
|
||||
jc - JSON CLI output utility `iptables` command output parser
|
||||
|
||||
Supports `-vLn` and `--line-numbers` for all tables.
|
||||
@ -166,16 +168,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.iptables.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -190,7 +188,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.iw_scan"></a>
|
||||
|
||||
# jc.parsers.iw\_scan
|
||||
|
||||
# jc.parsers.iw_scan
|
||||
jc - JSON CLI output utility `iw dev <device> scan` command output parser
|
||||
|
||||
This parser is considered beta quality. Not all fields are parsed and there
|
||||
@ -124,16 +126,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.iw_scan.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -148,7 +146,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 0.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.jar_manifest"></a>
|
||||
|
||||
# jc.parsers.jar\_manifest
|
||||
|
||||
# jc.parsers.jar_manifest
|
||||
jc - JSON CLI output utility `MANIFEST.MF` file parser
|
||||
|
||||
Usage (cli):
|
||||
@ -29,16 +31,16 @@ Schema:
|
||||
Examples:
|
||||
|
||||
$ cat MANIFEST.MF | jc --jar-manifest -p
|
||||
$ unzip -c log4j-core-2.16.0.jar META-INF/MANIFEST.MF | \
|
||||
$ unzip -c log4j-core-2.16.0.jar META-INF/MANIFEST.MF | \\
|
||||
jc --jar-manifest -p
|
||||
$ unzip -c 'apache-log4j-2.16.0-bin/*.jar' META-INF/MANIFEST.MF | \
|
||||
$ unzip -c 'apache-log4j-2.16.0-bin/*.jar' META-INF/MANIFEST.MF | \\
|
||||
jc --jar-manifest -p
|
||||
|
||||
$ cat MANIFEST.MF | jc --jar-manifest -p
|
||||
[
|
||||
{
|
||||
"Import_Package": "com.conversantmedia.util.concurrent;resoluti...",
|
||||
"Export_Package": "org.apache.logging.log4j.core;uses:="org.ap...",
|
||||
"Export_Package": "org.apache.logging.log4j.core;uses:=\"org.ap...",
|
||||
"Manifest_Version": "1.0",
|
||||
"Bundle_License": "https://www.apache.org/licenses/LICENSE-2.0.txt",
|
||||
"Bundle_SymbolicName": "org.apache.logging.log4j.core",
|
||||
@ -51,7 +53,7 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
$ unzip -c 'apache-log4j-2.16.0-bin/*.jar' META-INF/MANIFEST.MF | \
|
||||
$ unzip -c 'apache-log4j-2.16.0-bin/*.jar' META-INF/MANIFEST.MF | \\
|
||||
jc --jar-manifest -p
|
||||
[
|
||||
...
|
||||
@ -80,16 +82,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.jar_manifest.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -104,7 +102,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 0.01 by Matt J (https://github.com/listuser)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.jobs"></a>
|
||||
|
||||
# jc.parsers.jobs
|
||||
|
||||
jc - JSON CLI output utility `jobs` command output parser
|
||||
|
||||
Also supports the `-l` option.
|
||||
@ -96,16 +98,12 @@ Example:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.jobs.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -120,7 +118,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.kv"></a>
|
||||
|
||||
# jc.parsers.kv
|
||||
|
||||
jc - JSON CLI output utility `Key/Value` file parser
|
||||
|
||||
Supports files containing simple key/value pairs. Delimiter can be `=` or
|
||||
@ -56,16 +58,12 @@ Examples:
|
||||
"occupation": "Engineer"
|
||||
}
|
||||
|
||||
<a id="jc.parsers.kv.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -82,7 +80,7 @@ Returns:
|
||||
|
||||
Dictionary representing the key/value file
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.last"></a>
|
||||
|
||||
# jc.parsers.last
|
||||
|
||||
jc - JSON CLI output utility `last` and `lastb` command output parser
|
||||
|
||||
Supports `-w` and `-F` options.
|
||||
@ -107,17 +109,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.last.parse"></a>
|
||||
|
||||
### parse
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -132,7 +129,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, aix, freebsd
|
||||
|
||||
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ls"></a>
|
||||
|
||||
# jc.parsers.ls
|
||||
|
||||
jc - JSON CLI output utility `ls` and `vdir` command output parser
|
||||
|
||||
Options supported:
|
||||
@ -119,16 +121,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.ls.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -143,7 +141,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.10 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ls_s"></a>
|
||||
|
||||
# jc.parsers.ls\_s
|
||||
|
||||
# jc.parsers.ls_s
|
||||
jc - JSON CLI output utility `ls` and `vdir` command output streaming
|
||||
parser
|
||||
|
||||
@ -80,16 +82,12 @@ Examples:
|
||||
{"filename":"AssetCacheLocatorUtil","flags":"-rwxr-xr-x","links":"1...}
|
||||
...
|
||||
|
||||
<a id="jc.parsers.ls_s.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False, ignore_exceptions=False)
|
||||
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
|
||||
```
|
||||
|
||||
Main text parsing generator function. Returns an iterator object.
|
||||
@ -111,7 +109,7 @@ Returns:
|
||||
|
||||
Iterator object
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 0.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.lsblk"></a>
|
||||
|
||||
# jc.parsers.lsblk
|
||||
|
||||
jc - JSON CLI output utility `lsblk` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -93,9 +95,9 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
$ lsblk -o +KNAME,FSTYPE,LABEL,UUID,PARTLABEL,PARTUUID,RA,MODEL,SERIAL,\
|
||||
STATE,OWNER,GROUP,MODE,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,\
|
||||
SCHED,RQ-SIZE,DISC-ALN,DISC-GRAN,DISC-MAX,DISC-ZERO,WSAME,WWN,RAND,\
|
||||
$ lsblk -o +KNAME,FSTYPE,LABEL,UUID,PARTLABEL,PARTUUID,RA,MODEL,SERIAL,\\
|
||||
STATE,OWNER,GROUP,MODE,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,\\
|
||||
SCHED,RQ-SIZE,DISC-ALN,DISC-GRAN,DISC-MAX,DISC-ZERO,WSAME,WWN,RAND,\\
|
||||
PKNAME,HCTL,TRAN,REV,VENDOR | jc --lsblk -p
|
||||
[
|
||||
{
|
||||
@ -185,9 +187,9 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
$ lsblk -o +KNAME,FSTYPE,LABEL,UUID,PARTLABEL,PARTUUID,RA,MODEL,SERIAL,\
|
||||
STATE,OWNER,GROUP,MODE,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,\
|
||||
SCHED,RQ-SIZE,DISC-ALN,DISC-GRAN,DISC-MAX,DISC-ZERO,WSAME,WWN,RAND,\
|
||||
$ lsblk -o +KNAME,FSTYPE,LABEL,UUID,PARTLABEL,PARTUUID,RA,MODEL,SERIAL,\\
|
||||
STATE,OWNER,GROUP,MODE,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,\\
|
||||
SCHED,RQ-SIZE,DISC-ALN,DISC-GRAN,DISC-MAX,DISC-ZERO,WSAME,WWN,RAND,\\
|
||||
PKNAME,HCTL,TRAN,REV,VENDOR | jc --lsblk -p -r
|
||||
[
|
||||
{
|
||||
@ -277,16 +279,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.lsblk.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -301,7 +299,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.lsmod"></a>
|
||||
|
||||
# jc.parsers.lsmod
|
||||
|
||||
jc - JSON CLI output utility `lsmod` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -128,16 +130,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.lsmod.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -152,7 +150,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.lsof"></a>
|
||||
|
||||
# jc.parsers.lsof
|
||||
|
||||
jc - JSON CLI output utility `lsof` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -122,16 +124,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.lsof.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -146,7 +144,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.lsusb"></a>
|
||||
|
||||
# jc.parsers.lsusb
|
||||
|
||||
jc - JSON CLI output utility `lsusb` command output parser
|
||||
|
||||
Supports the `-v` option or no options.
|
||||
@ -264,16 +266,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.lsusb.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -288,7 +286,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.mount"></a>
|
||||
|
||||
# jc.parsers.mount
|
||||
|
||||
jc - JSON CLI output utility `mount` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -78,16 +80,12 @@ Example:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.mount.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -102,7 +100,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.netstat"></a>
|
||||
|
||||
# jc.parsers.netstat
|
||||
|
||||
jc - JSON CLI output utility `netstat` command output parser
|
||||
|
||||
Caveats:
|
||||
@ -358,16 +360,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.netstat.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -382,7 +380,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 1.12 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ntpq"></a>
|
||||
|
||||
# jc.parsers.ntpq
|
||||
|
||||
jc - JSON CLI output utility `ntpq -p` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -209,16 +211,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.ntpq.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -233,7 +231,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, freebsd
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.passwd"></a>
|
||||
|
||||
# jc.parsers.passwd
|
||||
|
||||
jc - JSON CLI output utility `/etc/passwd` file Parser
|
||||
|
||||
Usage (cli):
|
||||
@ -97,16 +99,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.passwd.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -121,7 +119,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, aix, freebsd
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ping"></a>
|
||||
|
||||
# jc.parsers.ping
|
||||
|
||||
jc - JSON CLI output utility `ping` command output parser
|
||||
|
||||
Supports `ping` and `ping6` output.
|
||||
@ -165,16 +167,12 @@ Examples:
|
||||
]
|
||||
}
|
||||
|
||||
<a id="jc.parsers.ping.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -189,7 +187,7 @@ Returns:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ping_s"></a>
|
||||
|
||||
# jc.parsers.ping\_s
|
||||
|
||||
# jc.parsers.ping_s
|
||||
jc - JSON CLI output utility `ping` command output streaming parser
|
||||
|
||||
> This streaming parser outputs JSON Lines
|
||||
@ -86,16 +88,12 @@ Examples:
|
||||
{"type":"reply","destination_ip":"1.1.1.1","sent_bytes":"56","patte...}
|
||||
...
|
||||
|
||||
<a id="jc.parsers.ping_s.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False, ignore_exceptions=False)
|
||||
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
|
||||
```
|
||||
|
||||
Main text parsing generator function. Returns an iterator object.
|
||||
@ -117,7 +115,7 @@ Returns:
|
||||
|
||||
Iterator object
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 0.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.pip_list"></a>
|
||||
|
||||
# jc.parsers.pip\_list
|
||||
|
||||
# jc.parsers.pip_list
|
||||
jc - JSON CLI output utility `pip-list` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -50,16 +52,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.pip_list.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -74,7 +72,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.pip_show"></a>
|
||||
|
||||
# jc.parsers.pip\_show
|
||||
|
||||
# jc.parsers.pip_show
|
||||
jc - JSON CLI output utility `pip-show` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -68,16 +70,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.pip_show.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -92,7 +90,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ps"></a>
|
||||
|
||||
# jc.parsers.ps
|
||||
|
||||
jc - JSON CLI output utility `ps` command output parser
|
||||
|
||||
`ps` options supported:
|
||||
@ -209,16 +211,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.ps.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -233,7 +231,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.route"></a>
|
||||
|
||||
# jc.parsers.route
|
||||
|
||||
jc - JSON CLI output utility `route` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -111,16 +113,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.route.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -135,7 +133,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.rpm_qi"></a>
|
||||
|
||||
# jc.parsers.rpm\_qi
|
||||
|
||||
# jc.parsers.rpm_qi
|
||||
jc - JSON CLI output utility `rpm -qi` command output parser
|
||||
|
||||
Works with `rpm -qi [package]` or `rpm -qia`.
|
||||
@ -164,16 +166,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.rpm_qi.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -188,7 +186,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.sfdisk"></a>
|
||||
|
||||
# jc.parsers.sfdisk
|
||||
|
||||
jc - JSON CLI output utility `sfdisk` command output parser
|
||||
|
||||
Supports the following `sfdisk` options:
|
||||
@ -205,16 +207,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.sfdisk.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -229,7 +227,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.shadow"></a>
|
||||
|
||||
# jc.parsers.shadow
|
||||
|
||||
jc - JSON CLI output utility `/etc/shadow` file parser
|
||||
|
||||
Usage (cli):
|
||||
@ -104,16 +106,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.shadow.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -128,7 +126,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, aix, freebsd
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ss"></a>
|
||||
|
||||
# jc.parsers.ss
|
||||
|
||||
jc - JSON CLI output utility `ss` command output parser
|
||||
|
||||
Extended information options like -e and -p are not supported and may cause
|
||||
@ -283,16 +285,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.ss.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -307,7 +305,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.stat"></a>
|
||||
|
||||
# jc.parsers.stat
|
||||
|
||||
jc - JSON CLI output utility `stat` command output parser
|
||||
|
||||
The `xxx_epoch` calculated timestamp fields are naive. (i.e. based on the
|
||||
@ -173,16 +175,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.stat.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -197,7 +195,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 1.10 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.stat_s"></a>
|
||||
|
||||
# jc.parsers.stat\_s
|
||||
|
||||
# jc.parsers.stat_s
|
||||
jc - JSON CLI output utility `stat` command output streaming parser
|
||||
|
||||
> This streaming parser outputs JSON Lines
|
||||
@ -84,16 +86,12 @@ Examples:
|
||||
$ stat | jc --stat-s -r
|
||||
{"file":"(stdin)","unix_device":"1027739696","inode":"1155","flag...}
|
||||
|
||||
<a id="jc.parsers.stat_s.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False, ignore_exceptions=False)
|
||||
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
|
||||
```
|
||||
|
||||
Main text parsing generator function. Returns an iterator object.
|
||||
@ -115,7 +113,7 @@ Returns:
|
||||
|
||||
Iterator object
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 0.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.sysctl"></a>
|
||||
|
||||
# jc.parsers.sysctl
|
||||
|
||||
jc - JSON CLI output utility `sysctl -a` command output parser
|
||||
|
||||
Note: Since `sysctl` output is not easily parsable only a very simple
|
||||
@ -60,16 +62,12 @@ Examples:
|
||||
...
|
||||
}
|
||||
|
||||
<a id="jc.parsers.sysctl.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -84,7 +82,7 @@ Returns:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.systemctl"></a>
|
||||
|
||||
# jc.parsers.systemctl
|
||||
|
||||
jc - JSON CLI output utility `systemctl` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -61,16 +63,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.systemctl.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -85,7 +83,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.systemctl_lj"></a>
|
||||
|
||||
# jc.parsers.systemctl\_lj
|
||||
|
||||
# jc.parsers.systemctl_lj
|
||||
jc - JSON CLI output utility `systemctl list-jobs` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -78,16 +80,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.systemctl_lj.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -102,7 +100,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.systemctl_ls"></a>
|
||||
|
||||
# jc.parsers.systemctl\_ls
|
||||
|
||||
# jc.parsers.systemctl_ls
|
||||
jc - JSON CLI output utility `systemctl list-sockets` command output
|
||||
parser
|
||||
|
||||
@ -54,16 +56,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.systemctl_ls.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -78,7 +76,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.systemctl_luf"></a>
|
||||
|
||||
# jc.parsers.systemctl\_luf
|
||||
|
||||
# jc.parsers.systemctl_luf
|
||||
jc - JSON CLI output utility `systemctl list-unit-files` command output
|
||||
parser
|
||||
|
||||
@ -50,16 +52,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.systemctl_luf.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -74,7 +72,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.systeminfo"></a>
|
||||
|
||||
# jc.parsers.systeminfo
|
||||
|
||||
jc - JSON CLI output utility `systeminfo` command output parser
|
||||
|
||||
Blank or missing elements are set to `null`.
|
||||
@ -114,9 +116,9 @@ Examples:
|
||||
"Intel64 Family 6 Model 158 Stepping 10 GenuineIntel ~2592 Mhz"
|
||||
],
|
||||
"bios_version": "Dell Inc. 1.16.2, 4/21/2020",
|
||||
"windows_directory": "C:\WINDOWS",
|
||||
"system_directory": "C:\WINDOWS\system32",
|
||||
"boot_device": "\Device\HarddiskVolume2",
|
||||
"windows_directory": "C:\\WINDOWS",
|
||||
"system_directory": "C:\\WINDOWS\\system32",
|
||||
"boot_device": "\\Device\\HarddiskVolume2",
|
||||
"system_locale": "en-us;English (United States)",
|
||||
"input_locale": "en-us;English (United States)",
|
||||
"time_zone": "(UTC+00:00) UTC",
|
||||
@ -125,9 +127,9 @@ Examples:
|
||||
"virtual_memory_max_size_mb": 37367,
|
||||
"virtual_memory_available_mb": 22266,
|
||||
"virtual_memory_in_use_mb": 15101,
|
||||
"page_file_locations": "C:\pagefile.sys",
|
||||
"page_file_locations": "C:\\pagefile.sys",
|
||||
"domain": "test.com",
|
||||
"logon_server": "\\TESTDC01",
|
||||
"logon_server": "\\\\TESTDC01",
|
||||
"hotfixs": [
|
||||
"KB2693643",
|
||||
"KB4601054"
|
||||
@ -176,9 +178,9 @@ Examples:
|
||||
"Intel64 Family 6 Model 158 Stepping 10 GenuineIntel ~2592 Mhz"
|
||||
],
|
||||
"bios_version": "Dell Inc. 1.16.2, 4/21/2020",
|
||||
"windows_directory": "C:\WINDOWS",
|
||||
"system_directory": "C:\WINDOWS\system32",
|
||||
"boot_device": "\Device\HarddiskVolume2",
|
||||
"windows_directory": "C:\\WINDOWS",
|
||||
"system_directory": "C:\\WINDOWS\\system32",
|
||||
"boot_device": "\\Device\\HarddiskVolume2",
|
||||
"system_locale": "en-us;English (United States)",
|
||||
"input_locale": "en-us;English (United States)",
|
||||
"time_zone": "(UTC+00:00) UTC",
|
||||
@ -187,9 +189,9 @@ Examples:
|
||||
"virtual_memory_max_size_mb": "37,367 MB",
|
||||
"virtual_memory_available_mb": "22,266 MB",
|
||||
"virtual_memory_in_use_mb": "15,101 MB",
|
||||
"page_file_locations": "C:\pagefile.sys",
|
||||
"page_file_locations": "C:\\pagefile.sys",
|
||||
"domain": "test.com",
|
||||
"logon_server": "\\TESTDC01",
|
||||
"logon_server": "\\\\TESTDC01",
|
||||
"hotfixs": [
|
||||
"KB2693643",
|
||||
"KB4601054"
|
||||
@ -214,16 +216,12 @@ Examples:
|
||||
}
|
||||
}
|
||||
|
||||
<a id="jc.parsers.systeminfo.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -238,7 +236,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: win32
|
||||
|
||||
Version 1.1 by Jon Smith (jon@rebelliondefense.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.time"></a>
|
||||
|
||||
# jc.parsers.time
|
||||
|
||||
jc - JSON CLI output utility `/usr/bin/time` command output parser
|
||||
|
||||
Output from `/usr/bin/time` is sent to `STDERR`, so the `-o` option can be
|
||||
@ -14,7 +16,7 @@ Note: `/usr/bin/time` is similar but different from the Bash builtin
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ /usr/bin/time -o timefile.out sleep 2; cat timefile.out | \
|
||||
$ /usr/bin/time -o timefile.out sleep 2; cat timefile.out | \\
|
||||
jc --time -p
|
||||
|
||||
Usage (module):
|
||||
@ -74,7 +76,7 @@ Schema:
|
||||
|
||||
Examples:
|
||||
|
||||
$ /usr/bin/time --verbose -o timefile.out sleep 2; cat timefile.out | \
|
||||
$ /usr/bin/time --verbose -o timefile.out sleep 2; cat timefile.out | \\
|
||||
jc --time -p
|
||||
{
|
||||
"command_being_timed": "sleep 2",
|
||||
@ -107,10 +109,10 @@ Examples:
|
||||
"elapsed_time_total_seconds": 2.5
|
||||
}
|
||||
|
||||
$ /usr/bin/time --verbose -o timefile.out sleep 2; cat timefile.out | \
|
||||
$ /usr/bin/time --verbose -o timefile.out sleep 2; cat timefile.out | \\
|
||||
jc --time -p -r
|
||||
{
|
||||
"command_being_timed": ""sleep 2"",
|
||||
"command_being_timed": "\"sleep 2\"",
|
||||
"user_time": "0.00",
|
||||
"system_time": "0.00",
|
||||
"cpu_percent": "0",
|
||||
@ -135,16 +137,12 @@ Examples:
|
||||
"exit_status": "0"
|
||||
}
|
||||
|
||||
<a id="jc.parsers.time.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -159,7 +157,7 @@ Returns:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.timedatectl"></a>
|
||||
|
||||
# jc.parsers.timedatectl
|
||||
|
||||
jc - JSON CLI output utility `timedatectl` command output parser
|
||||
|
||||
The `epoch_utc` calculated timestamp field is timezone-aware and is only
|
||||
@ -67,16 +69,12 @@ Examples:
|
||||
"dst_active": "yes"
|
||||
}
|
||||
|
||||
<a id="jc.parsers.timedatectl.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -91,7 +89,7 @@ Returns:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.tracepath"></a>
|
||||
|
||||
# jc.parsers.tracepath
|
||||
|
||||
jc - JSON CLI output utility `tracepath` command output parser
|
||||
|
||||
Supports `tracepath` and `tracepath6` output.
|
||||
@ -134,16 +136,12 @@ Examples:
|
||||
]
|
||||
}
|
||||
|
||||
<a id="jc.parsers.tracepath.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -158,7 +156,7 @@ Returns:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.traceroute"></a>
|
||||
|
||||
# jc.parsers.traceroute
|
||||
|
||||
jc - JSON CLI output utility `traceroute` command output parser
|
||||
|
||||
Supports `traceroute` and `traceroute6` output.
|
||||
@ -123,16 +125,12 @@ Examples:
|
||||
]
|
||||
}
|
||||
|
||||
<a id="jc.parsers.traceroute.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -147,7 +145,7 @@ Returns:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ufw"></a>
|
||||
|
||||
# jc.parsers.ufw
|
||||
|
||||
jc - JSON CLI output utility `ufw status` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -203,16 +205,12 @@ Examples:
|
||||
]
|
||||
}
|
||||
|
||||
<a id="jc.parsers.ufw.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -227,7 +225,7 @@ Returns:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.ufw_appinfo"></a>
|
||||
|
||||
# jc.parsers.ufw\_appinfo
|
||||
|
||||
# jc.parsers.ufw_appinfo
|
||||
jc - JSON CLI output utility `ufw app info [application]` command
|
||||
output parser
|
||||
|
||||
@ -141,16 +143,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.ufw_appinfo.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -165,7 +163,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.uname"></a>
|
||||
|
||||
# jc.parsers.uname
|
||||
|
||||
jc - JSON CLI output utility `uname -a` command output parser
|
||||
|
||||
Note: Must use `uname -a`
|
||||
@ -50,16 +52,12 @@ Example:
|
||||
"kernel_version": "#74-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019"
|
||||
}
|
||||
|
||||
<a id="jc.parsers.uname.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -74,7 +72,7 @@ Returns:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,10 +1,21 @@
|
||||
# Table of Contents
|
||||
|
||||
* [jc.parsers.universal](#jc.parsers.universal)
|
||||
* [simple\_table\_parse](#jc.parsers.universal.simple_table_parse)
|
||||
* [sparse\_table\_parse](#jc.parsers.universal.sparse_table_parse)
|
||||
|
||||
<a id="jc.parsers.universal"></a>
|
||||
|
||||
# jc.parsers.universal
|
||||
|
||||
jc - JSON CLI output utility universal Parsers
|
||||
|
||||
## simple_table_parse
|
||||
<a id="jc.parsers.universal.simple_table_parse"></a>
|
||||
|
||||
### simple\_table\_parse
|
||||
|
||||
```python
|
||||
simple_table_parse(data)
|
||||
def simple_table_parse(data: List[str]) -> List[Dict]
|
||||
```
|
||||
|
||||
Parse simple tables. The last column may contain data with spaces.
|
||||
@ -24,10 +35,12 @@ Returns:
|
||||
|
||||
List of Dictionaries
|
||||
|
||||
<a id="jc.parsers.universal.sparse_table_parse"></a>
|
||||
|
||||
### sparse\_table\_parse
|
||||
|
||||
## sparse_table_parse
|
||||
```python
|
||||
sparse_table_parse(data, delim='\u2063')
|
||||
def sparse_table_parse(data: List[str], delim: Optional[str] = '\u2063') -> List[Dict]
|
||||
```
|
||||
|
||||
Parse tables with missing column data or with spaces in column data.
|
||||
@ -45,7 +58,7 @@ Parameters:
|
||||
Also, ensure there are no blank lines (list items)
|
||||
in the data.
|
||||
|
||||
delim: (string) Delimiter to use. By default `u\2063`
|
||||
delim: (string) Delimiter to use. By default `u\\2063`
|
||||
(invisible separator) is used since it is unlikely
|
||||
to ever be seen in terminal output. You can change
|
||||
this for troubleshooting purposes or if there is a
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.upower"></a>
|
||||
|
||||
# jc.parsers.upower
|
||||
|
||||
jc - JSON CLI output utility `upower` command output parser
|
||||
|
||||
The `updated_epoch` calculated timestamp field is naive. (i.e. based on the
|
||||
@ -201,16 +203,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.upower.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -225,7 +223,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.uptime"></a>
|
||||
|
||||
# jc.parsers.uptime
|
||||
|
||||
jc - JSON CLI output utility `uptime` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -68,16 +70,12 @@ Example:
|
||||
"load_15m": "1.94"
|
||||
}
|
||||
|
||||
<a id="jc.parsers.uptime.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -92,7 +90,7 @@ Returns:
|
||||
|
||||
Dictionary. Raw or processed structured data
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.vmstat"></a>
|
||||
|
||||
# jc.parsers.vmstat
|
||||
|
||||
jc - JSON CLI output utility `vmstat` command output parser
|
||||
|
||||
Options supported: `-a`, `-w`, `-d`, `-t`
|
||||
@ -129,16 +131,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.vmstat.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -153,7 +151,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.vmstat_s"></a>
|
||||
|
||||
# jc.parsers.vmstat\_s
|
||||
|
||||
# jc.parsers.vmstat_s
|
||||
jc - JSON CLI output utility `vmstat` command output streaming parser
|
||||
|
||||
> This streaming parser outputs JSON Lines
|
||||
@ -103,16 +105,12 @@ Examples:
|
||||
{"runnable_procs":"2","uninterruptible_sleeping_procs":"0","virtua...}
|
||||
...
|
||||
|
||||
<a id="jc.parsers.vmstat_s.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False, ignore_exceptions=False)
|
||||
def parse(data, raw=False, quiet=False, ignore_exceptions=False)
|
||||
```
|
||||
|
||||
Main text parsing generator function. Returns an iterator object.
|
||||
@ -134,7 +132,7 @@ Returns:
|
||||
|
||||
Iterator object
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux
|
||||
|
||||
Version 0.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.w"></a>
|
||||
|
||||
# jc.parsers.w
|
||||
|
||||
jc - JSON CLI output utility `w` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -106,16 +108,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.w.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -130,7 +128,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.wc"></a>
|
||||
|
||||
# jc.parsers.wc
|
||||
|
||||
jc - JSON CLI output utility `wc` command output parser
|
||||
|
||||
Usage (cli):
|
||||
@ -57,16 +59,12 @@ Examples:
|
||||
...
|
||||
]
|
||||
|
||||
<a id="jc.parsers.wc.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -81,7 +79,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.who"></a>
|
||||
|
||||
# jc.parsers.who
|
||||
|
||||
jc - JSON CLI output utility `who` command output parser
|
||||
|
||||
Accepts any of the following who options (or no options): `-aTH`
|
||||
@ -138,16 +140,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.who.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -162,7 +160,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.xml"></a>
|
||||
|
||||
# jc.parsers.xml
|
||||
|
||||
jc - JSON CLI output utility `XML` file parser
|
||||
|
||||
Usage (cli):
|
||||
@ -73,16 +75,12 @@ Examples:
|
||||
...
|
||||
}
|
||||
|
||||
<a id="jc.parsers.xml.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -97,7 +95,7 @@ Returns:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.yaml"></a>
|
||||
|
||||
# jc.parsers.yaml
|
||||
|
||||
jc - JSON CLI output utility `YAML` file parser
|
||||
|
||||
Usage (cli):
|
||||
@ -87,16 +89,12 @@ Examples:
|
||||
}
|
||||
]
|
||||
|
||||
<a id="jc.parsers.yaml.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -111,7 +109,7 @@ Returns:
|
||||
|
||||
List of Dictionaries representing the YAML documents.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||
|
||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -1,6 +1,8 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.zipinfo"></a>
|
||||
|
||||
# jc.parsers.zipinfo
|
||||
|
||||
jc - JSON CLI output utility `zipinfo` command output parser
|
||||
|
||||
Options supported:
|
||||
@ -82,16 +84,12 @@ Examples:
|
||||
},
|
||||
...
|
||||
|
||||
<a id="jc.parsers.zipinfo.parse"></a>
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
```
|
||||
Provides parser metadata (version, author, etc.)
|
||||
### parse
|
||||
|
||||
## parse
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
@ -106,7 +104,7 @@ Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin
|
||||
|
||||
Version 0.01 by Matt J (https://github.com/listuser)
|
||||
|
@ -1,5 +1,7 @@
|
||||
<a id="jc"></a>
|
||||
|
||||
# jc
|
||||
|
||||
JC - JSON CLI output utility
|
||||
|
||||
* kellyjonbrazil@gmail.com
|
||||
@ -55,19 +57,27 @@ modules directly:
|
||||
|
||||
Use `help(jc.lib)` for details:
|
||||
|
||||
parse(parser_module_name: str, data: str | iterable)
|
||||
parse(parser_module_name: str, data: str | Iterable)
|
||||
-> dict | list[dict] | Iterable[dict]
|
||||
High-level API to easily access the parser. This API will find both
|
||||
built-in parsers and local plugin parsers.
|
||||
|
||||
get_help(parser_module_name: str)
|
||||
parser_info(parser_module_name: str) -> dict
|
||||
Get the metadata for a particular parser.
|
||||
|
||||
all_parser_info() -> list[dict]
|
||||
Get the metadata for all parsers.
|
||||
|
||||
get_help(parser_module_name: str) -> None
|
||||
Convenience function to display the help screen for a parser using
|
||||
its module name.
|
||||
|
||||
parser_mod_list()
|
||||
parser_mod_list() -> list
|
||||
Get a list of all available parser module names to be used in
|
||||
parse() and get_help().
|
||||
parse(), parser_info(), and get_help().
|
||||
|
||||
plugin_parser_mod_list()
|
||||
Get a list of plugin parser module names. This list is a subset of
|
||||
plugin_parser_mod_list() -> list
|
||||
Get a list of plugin parser module names to be used in
|
||||
parse(), parser_info(), and get_help(). This list is a subset of
|
||||
parser_mod_list().
|
||||
|
||||
|
128
docs/utils.md
128
docs/utils.md
@ -1,10 +1,33 @@
|
||||
# Table of Contents
|
||||
|
||||
* [jc.utils](#jc.utils)
|
||||
* [warning\_message](#jc.utils.warning_message)
|
||||
* [error\_message](#jc.utils.error_message)
|
||||
* [compatibility](#jc.utils.compatibility)
|
||||
* [has\_data](#jc.utils.has_data)
|
||||
* [convert\_to\_int](#jc.utils.convert_to_int)
|
||||
* [convert\_to\_float](#jc.utils.convert_to_float)
|
||||
* [convert\_to\_bool](#jc.utils.convert_to_bool)
|
||||
* [stream\_success](#jc.utils.stream_success)
|
||||
* [stream\_error](#jc.utils.stream_error)
|
||||
* [input\_type\_check](#jc.utils.input_type_check)
|
||||
* [streaming\_input\_type\_check](#jc.utils.streaming_input_type_check)
|
||||
* [streaming\_line\_input\_type\_check](#jc.utils.streaming_line_input_type_check)
|
||||
* [timestamp](#jc.utils.timestamp)
|
||||
* [\_\_init\_\_](#jc.utils.timestamp.__init__)
|
||||
|
||||
<a id="jc.utils"></a>
|
||||
|
||||
# jc.utils
|
||||
|
||||
# utils
|
||||
jc - JSON CLI output utility utils
|
||||
|
||||
## warning_message
|
||||
<a id="jc.utils.warning_message"></a>
|
||||
|
||||
### warning\_message
|
||||
|
||||
```python
|
||||
warning_message(message_lines)
|
||||
def warning_message(message_lines: List[str]) -> None
|
||||
```
|
||||
|
||||
Prints warning message for non-fatal issues. The first line is
|
||||
@ -19,10 +42,12 @@ Returns:
|
||||
|
||||
None - just prints output to STDERR
|
||||
|
||||
<a id="jc.utils.error_message"></a>
|
||||
|
||||
### error\_message
|
||||
|
||||
## error_message
|
||||
```python
|
||||
error_message(message_lines)
|
||||
def error_message(message_lines: List[str]) -> None
|
||||
```
|
||||
|
||||
Prints an error message for fatal issues. The first line is
|
||||
@ -37,10 +62,12 @@ Returns:
|
||||
|
||||
None - just prints output to STDERR
|
||||
|
||||
<a id="jc.utils.compatibility"></a>
|
||||
|
||||
### compatibility
|
||||
|
||||
## compatibility
|
||||
```python
|
||||
compatibility(mod_name, compatible, quiet=False)
|
||||
def compatibility(mod_name: str, compatible: List, quiet: Optional[bool] = False) -> None
|
||||
```
|
||||
|
||||
Checks for the parser's compatibility with the running OS
|
||||
@ -60,10 +87,12 @@ Returns:
|
||||
|
||||
None - just prints output to STDERR
|
||||
|
||||
<a id="jc.utils.has_data"></a>
|
||||
|
||||
### has\_data
|
||||
|
||||
## has_data
|
||||
```python
|
||||
has_data(data)
|
||||
def has_data(data: str) -> bool
|
||||
```
|
||||
|
||||
Checks if the input contains data. If there are any non-whitespace
|
||||
@ -78,10 +107,12 @@ Returns:
|
||||
Boolean True if input string (data) contains non-whitespace
|
||||
characters, otherwise False
|
||||
|
||||
<a id="jc.utils.convert_to_int"></a>
|
||||
|
||||
### convert\_to\_int
|
||||
|
||||
## convert_to_int
|
||||
```python
|
||||
convert_to_int(value)
|
||||
def convert_to_int(value: Union[str, float]) -> Union[int, None]
|
||||
```
|
||||
|
||||
Converts string and float input to int. Strips all non-numeric
|
||||
@ -89,16 +120,18 @@ characters from strings.
|
||||
|
||||
Parameters:
|
||||
|
||||
value: (string/integer/float) Input value
|
||||
value: (string/float) Input value
|
||||
|
||||
Returns:
|
||||
|
||||
integer/None Integer if successful conversion, otherwise None
|
||||
|
||||
<a id="jc.utils.convert_to_float"></a>
|
||||
|
||||
### convert\_to\_float
|
||||
|
||||
## convert_to_float
|
||||
```python
|
||||
convert_to_float(value)
|
||||
def convert_to_float(value: Union[str, int]) -> Union[float, None]
|
||||
```
|
||||
|
||||
Converts string and int input to float. Strips all non-numeric
|
||||
@ -106,16 +139,18 @@ characters from strings.
|
||||
|
||||
Parameters:
|
||||
|
||||
value: (string) Input value
|
||||
value: (string/integer) Input value
|
||||
|
||||
Returns:
|
||||
|
||||
float/None Float if successful conversion, otherwise None
|
||||
|
||||
<a id="jc.utils.convert_to_bool"></a>
|
||||
|
||||
### convert\_to\_bool
|
||||
|
||||
## convert_to_bool
|
||||
```python
|
||||
convert_to_bool(value)
|
||||
def convert_to_bool(value: Union[str, int, float]) -> bool
|
||||
```
|
||||
|
||||
Converts string, integer, or float input to boolean by checking
|
||||
@ -130,43 +165,72 @@ Returns:
|
||||
True/False False unless a 'truthy' number or string is found
|
||||
('y', 'yes', 'true', '1', 1, -1, etc.)
|
||||
|
||||
<a id="jc.utils.stream_success"></a>
|
||||
|
||||
### stream\_success
|
||||
|
||||
## stream_success
|
||||
```python
|
||||
stream_success(output_line, ignore_exceptions)
|
||||
def stream_success(output_line: Dict, ignore_exceptions: bool) -> Dict
|
||||
```
|
||||
|
||||
Add `_jc_meta` object to output line if `ignore_exceptions=True`
|
||||
|
||||
## stream_error
|
||||
<a id="jc.utils.stream_error"></a>
|
||||
|
||||
### stream\_error
|
||||
|
||||
```python
|
||||
stream_error(e, ignore_exceptions, line)
|
||||
def stream_error(e: BaseException, ignore_exceptions: bool, line: str) -> Dict
|
||||
```
|
||||
|
||||
Reraise the stream exception with annotation or print an error
|
||||
`_jc_meta` field if `ignore_exceptions=True`.
|
||||
|
||||
<a id="jc.utils.input_type_check"></a>
|
||||
|
||||
### input\_type\_check
|
||||
|
||||
## input_type_check
|
||||
```python
|
||||
input_type_check(data)
|
||||
def input_type_check(data: str) -> None
|
||||
```
|
||||
Ensure input data is a string
|
||||
|
||||
## streaming_input_type_check
|
||||
Ensure input data is a string. Raises `TypeError` if not.
|
||||
|
||||
<a id="jc.utils.streaming_input_type_check"></a>
|
||||
|
||||
### streaming\_input\_type\_check
|
||||
|
||||
```python
|
||||
streaming_input_type_check(data)
|
||||
def streaming_input_type_check(data: Iterable) -> None
|
||||
```
|
||||
Ensure input data is an iterable, but not a string or bytes
|
||||
|
||||
## streaming_line_input_type_check
|
||||
Ensure input data is an iterable, but not a string or bytes. Raises
|
||||
`TypeError` if not.
|
||||
|
||||
<a id="jc.utils.streaming_line_input_type_check"></a>
|
||||
|
||||
### streaming\_line\_input\_type\_check
|
||||
|
||||
```python
|
||||
streaming_line_input_type_check(line)
|
||||
def streaming_line_input_type_check(line: str) -> None
|
||||
```
|
||||
Ensure each line is a string
|
||||
|
||||
## timestamp
|
||||
Ensure each line is a string. Raises `TypeError` if not.
|
||||
|
||||
<a id="jc.utils.timestamp"></a>
|
||||
|
||||
### timestamp Objects
|
||||
|
||||
```python
|
||||
timestamp(datetime_string)
|
||||
class timestamp()
|
||||
```
|
||||
|
||||
<a id="jc.utils.timestamp.__init__"></a>
|
||||
|
||||
### \_\_init\_\_
|
||||
|
||||
```python
|
||||
def __init__(datetime_string: str) -> None
|
||||
```
|
||||
|
||||
Input a date-time text string of several formats and convert to a
|
||||
|
@ -53,21 +53,29 @@ modules directly:
|
||||
|
||||
Use `help(jc.lib)` for details:
|
||||
|
||||
parse(parser_module_name: str, data: str | iterable)
|
||||
parse(parser_module_name: str, data: str | Iterable)
|
||||
-> dict | list[dict] | Iterable[dict]
|
||||
High-level API to easily access the parser. This API will find both
|
||||
built-in parsers and local plugin parsers.
|
||||
|
||||
get_help(parser_module_name: str)
|
||||
parser_info(parser_module_name: str) -> dict
|
||||
Get the metadata for a particular parser.
|
||||
|
||||
all_parser_info() -> list[dict]
|
||||
Get the metadata for all parsers.
|
||||
|
||||
get_help(parser_module_name: str) -> None
|
||||
Convenience function to display the help screen for a parser using
|
||||
its module name.
|
||||
|
||||
parser_mod_list()
|
||||
parser_mod_list() -> list
|
||||
Get a list of all available parser module names to be used in
|
||||
parse() and get_help().
|
||||
parse(), parser_info(), and get_help().
|
||||
|
||||
plugin_parser_mod_list()
|
||||
Get a list of plugin parser module names. This list is a subset of
|
||||
plugin_parser_mod_list() -> list
|
||||
Get a list of plugin parser module names to be used in
|
||||
parse(), parser_info(), and get_help(). This list is a subset of
|
||||
parser_mod_list().
|
||||
"""
|
||||
from .lib import (__version__, parse, parser_mod_list,
|
||||
plugin_parser_mod_list, get_help)
|
||||
from .lib import (__version__, parse, parser_mod_list, plugin_parser_mod_list,
|
||||
parser_info, all_parser_info, get_help)
|
||||
|
56
jc/cli.py
56
jc/cli.py
@ -10,7 +10,8 @@ import signal
|
||||
import shlex
|
||||
import subprocess
|
||||
import json
|
||||
from .lib import __version__, parsers, local_parsers
|
||||
from .lib import (__version__, all_parser_info, parsers,
|
||||
_parser_argument, _get_parser)
|
||||
from . import utils
|
||||
from . import tracebackplus
|
||||
from .exceptions import LibraryNotInstalled, ParseError
|
||||
@ -147,29 +148,12 @@ def parser_shortname(parser_arg):
|
||||
return parser_arg[2:]
|
||||
|
||||
|
||||
def parser_argument(parser):
|
||||
"""Return short name of the parser with dashes and with -- prefix"""
|
||||
return f'--{parser}'
|
||||
|
||||
|
||||
def parser_mod_shortname(parser):
|
||||
"""Return short name of the parser's module name (no -- prefix and dashes converted to underscores)"""
|
||||
return parser.replace('--', '').replace('-', '_')
|
||||
|
||||
|
||||
def parser_module(parser):
|
||||
"""Import the module just in time and return the module object"""
|
||||
shortname = parser_mod_shortname(parser)
|
||||
path = ('jcparsers.' if shortname in local_parsers else 'jc.parsers.')
|
||||
return importlib.import_module(path + shortname)
|
||||
|
||||
|
||||
def parsers_text(indent=0, pad=0):
|
||||
"""Return the argument and description information from each parser"""
|
||||
ptext = ''
|
||||
for parser in parsers:
|
||||
parser_arg = parser_argument(parser)
|
||||
parser_mod = parser_module(parser)
|
||||
parser_arg = _parser_argument(parser)
|
||||
parser_mod = _get_parser(parser)
|
||||
|
||||
if hasattr(parser_mod, 'info'):
|
||||
parser_desc = parser_mod.info.description
|
||||
@ -184,23 +168,6 @@ def parsers_text(indent=0, pad=0):
|
||||
|
||||
def about_jc():
|
||||
"""Return jc info and the contents of each parser.info as a dictionary"""
|
||||
parser_list = []
|
||||
|
||||
for parser in parsers:
|
||||
parser_mod = parser_module(parser)
|
||||
|
||||
if hasattr(parser_mod, 'info'):
|
||||
info_dict = {}
|
||||
info_dict['name'] = parser_mod.__name__.split('.')[-1]
|
||||
info_dict['argument'] = parser_argument(parser)
|
||||
parser_entry = vars(parser_mod.info)
|
||||
|
||||
for k, v in parser_entry.items():
|
||||
if not k.startswith('__'):
|
||||
info_dict[k] = v
|
||||
|
||||
parser_list.append(info_dict)
|
||||
|
||||
return {
|
||||
'name': 'jc',
|
||||
'version': info.version,
|
||||
@ -210,8 +177,8 @@ def about_jc():
|
||||
'website': info.website,
|
||||
'copyright': info.copyright,
|
||||
'license': info.license,
|
||||
'parser_count': len(parser_list),
|
||||
'parsers': parser_list
|
||||
'parser_count': len(all_parser_info()),
|
||||
'parsers': all_parser_info()
|
||||
}
|
||||
|
||||
|
||||
@ -264,8 +231,7 @@ def help_doc(options):
|
||||
parser_name = parser_shortname(arg)
|
||||
|
||||
if parser_name in parsers:
|
||||
# load parser module just in time so we don't need to load all modules
|
||||
parser = parser_module(arg)
|
||||
parser = _get_parser(arg)
|
||||
compatible = ', '.join(parser.info.compatible)
|
||||
doc_text = \
|
||||
f'{parser.__doc__}\n'\
|
||||
@ -491,7 +457,7 @@ def main():
|
||||
|
||||
# find the correct parser
|
||||
if magic_found_parser:
|
||||
parser = parser_module(magic_found_parser)
|
||||
parser = _get_parser(magic_found_parser)
|
||||
parser_name = parser_shortname(magic_found_parser)
|
||||
|
||||
else:
|
||||
@ -500,7 +466,7 @@ def main():
|
||||
parser_name = parser_shortname(arg)
|
||||
|
||||
if parser_name in parsers:
|
||||
parser = parser_module(arg)
|
||||
parser = _get_parser(arg)
|
||||
found = True
|
||||
break
|
||||
|
||||
@ -553,6 +519,7 @@ def main():
|
||||
|
||||
utils.error_message([f'Parser issue with {parser_name}:',
|
||||
f'{e.__class__.__name__}: {e}',
|
||||
'If this is the correct parser, try setting the locale to C (LANG=C).',
|
||||
'For details use the -d or -dd option. Use "jc -h" for help.'])
|
||||
sys.exit(combined_exit_code(magic_exit_code, JC_ERROR_EXIT))
|
||||
|
||||
@ -573,8 +540,9 @@ def main():
|
||||
streaming_msg = 'Use the -qq option to ignore streaming parser errors.'
|
||||
|
||||
utils.error_message([
|
||||
f'{parser_name} parser could not parse the input data. Did you use the correct parser?',
|
||||
f'{parser_name} parser could not parse the input data.',
|
||||
f'{streaming_msg}',
|
||||
'If this is the correct parser, try setting the locale to C (LANG=C).',
|
||||
'For details use the -d or -dd option. Use "jc -h" for help.'
|
||||
])
|
||||
sys.exit(combined_exit_code(magic_exit_code, JC_ERROR_EXIT))
|
||||
|
93
jc/lib.py
93
jc/lib.py
@ -6,9 +6,10 @@ import sys
|
||||
import os
|
||||
import re
|
||||
import importlib
|
||||
from typing import Dict, List, Iterable, Union, Iterator, Optional
|
||||
from jc import appdirs
|
||||
|
||||
__version__ = '1.18.1'
|
||||
__version__ = '1.18.2'
|
||||
|
||||
parsers = [
|
||||
'acpi',
|
||||
@ -98,6 +99,14 @@ parsers = [
|
||||
'zipinfo'
|
||||
]
|
||||
|
||||
def _cliname_to_modname(parser_cli_name):
|
||||
"""Return real module name (dashes converted to underscores)"""
|
||||
return parser_cli_name.replace('--', '').replace('-', '_')
|
||||
|
||||
def _modname_to_cliname(parser_mod_name):
|
||||
"""Return module's cli name (underscores converted to dashes)"""
|
||||
return parser_mod_name.replace('_', '-')
|
||||
|
||||
# Create the local_parsers list. This is a list of custom or
|
||||
# override parsers from <user_data_dir>/jc/jcparsers/*.py.
|
||||
# Once this list is created, extend the parsers list with it.
|
||||
@ -109,31 +118,36 @@ if os.path.isdir(local_parsers_dir):
|
||||
for name in os.listdir(local_parsers_dir):
|
||||
if re.match(r'\w+\.py$', name) and os.path.isfile(os.path.join(local_parsers_dir, name)):
|
||||
plugin_name = name[0:-3]
|
||||
local_parsers.append(plugin_name)
|
||||
local_parsers.append(_modname_to_cliname(plugin_name))
|
||||
if plugin_name not in parsers:
|
||||
parsers.append(plugin_name)
|
||||
parsers.append(_modname_to_cliname(plugin_name))
|
||||
try:
|
||||
del name
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def _cliname_to_modname(parser_cli_name):
|
||||
"""Return real module name (dashes converted to underscores)"""
|
||||
return parser_cli_name.replace('-', '_')
|
||||
|
||||
def _modname_to_cliname(parser_mod_name):
|
||||
"""Return module's cli name (underscores converted to dashes)"""
|
||||
return parser_mod_name.replace('_', '-')
|
||||
def _parser_argument(parser_mod_name):
|
||||
"""Return short name of the parser with dashes and with -- prefix"""
|
||||
parser = _modname_to_cliname(parser_mod_name)
|
||||
return f'--{parser}'
|
||||
|
||||
def _get_parser(parser_mod_name):
|
||||
"""Return the parser module object"""
|
||||
# ensure parser_mod_name is a true module name and not a cli name
|
||||
parser_mod_name = _cliname_to_modname(parser_mod_name)
|
||||
|
||||
parser_cli_name = _modname_to_cliname(parser_mod_name)
|
||||
modpath = 'jcparsers.' if parser_cli_name in local_parsers else 'jc.parsers.'
|
||||
return importlib.import_module(f'{modpath}{parser_mod_name}')
|
||||
|
||||
def parse(parser_mod_name, data,
|
||||
quiet=False, raw=False, ignore_exceptions=None, **kwargs):
|
||||
def parse(
|
||||
parser_mod_name: str,
|
||||
data: Union[str, Iterable[str]],
|
||||
quiet: bool = False,
|
||||
raw: bool = False,
|
||||
ignore_exceptions: bool = None,
|
||||
**kwargs
|
||||
) -> Union[Dict, List[Dict], Iterator[Dict]]:
|
||||
"""
|
||||
Parse the string data using the supplied parser module.
|
||||
|
||||
@ -170,7 +184,10 @@ def parse(parser_mod_name, data,
|
||||
|
||||
Parameters:
|
||||
|
||||
parser_mod_name: (string) name of the parser module
|
||||
parser_mod_name: (string) name of the parser module. This
|
||||
function will accept module_name,
|
||||
cli-name, and --argument-name
|
||||
variants of the module name.
|
||||
|
||||
data: (string or data to parse (string for normal
|
||||
iterator) parsers, iterator of strings for
|
||||
@ -196,17 +213,57 @@ def parse(parser_mod_name, data,
|
||||
|
||||
return jc_parser.parse(data, quiet=quiet, raw=raw, **kwargs)
|
||||
|
||||
def parser_mod_list():
|
||||
def parser_mod_list() -> List[str]:
|
||||
"""Returns a list of all available parser module names."""
|
||||
return [_cliname_to_modname(p) for p in parsers]
|
||||
|
||||
def plugin_parser_mod_list():
|
||||
def plugin_parser_mod_list() -> List[str]:
|
||||
"""
|
||||
Returns a list of plugin parser module names. This function is a
|
||||
subset of `parser_mod_list()`.
|
||||
"""
|
||||
return [_cliname_to_modname(p) for p in local_parsers]
|
||||
|
||||
def get_help(parser_mod_name):
|
||||
"""Show help screen for the selected parser."""
|
||||
def parser_info(parser_mod_name: str) -> Union[Dict, None]:
|
||||
"""
|
||||
Returns a dictionary that includes the module metadata.
|
||||
|
||||
This function will accept **module_name**, **cli-name**, and
|
||||
**--argument-name** variants of the module name string.
|
||||
"""
|
||||
# ensure parser_mod_name is a true module name and not a cli name
|
||||
parser_mod_name = _cliname_to_modname(parser_mod_name)
|
||||
|
||||
parser_mod = _get_parser(parser_mod_name)
|
||||
|
||||
if hasattr(parser_mod, 'info'):
|
||||
info_dict: Dict = {}
|
||||
info_dict['name'] = parser_mod_name
|
||||
info_dict['argument'] = _parser_argument(parser_mod_name)
|
||||
parser_entry = vars(parser_mod.info)
|
||||
|
||||
for k, v in parser_entry.items():
|
||||
if not k.startswith('__'):
|
||||
info_dict[k] = v
|
||||
|
||||
if _modname_to_cliname(parser_mod_name) in local_parsers:
|
||||
info_dict['plugin'] = True
|
||||
|
||||
return info_dict
|
||||
|
||||
return None
|
||||
|
||||
def all_parser_info() -> List[Optional[Dict]]:
|
||||
"""
|
||||
Returns a list of dictionaris that includes metadata for all modules.
|
||||
"""
|
||||
return [parser_info(_cliname_to_modname(p)) for p in parsers]
|
||||
|
||||
def get_help(parser_mod_name: str) -> None:
|
||||
"""
|
||||
Show help screen for the selected parser.
|
||||
|
||||
This function will accept **module_name**, **cli-name**, and
|
||||
**--argument-name** variants of the module name string.
|
||||
"""
|
||||
help(_get_parser(parser_mod_name))
|
||||
|
@ -39,6 +39,7 @@ Examples:
|
||||
[]
|
||||
"""
|
||||
import jc.utils
|
||||
from typing import List, Dict
|
||||
|
||||
|
||||
class info():
|
||||
@ -57,7 +58,7 @@ class info():
|
||||
__version__ = info.version
|
||||
|
||||
|
||||
def _process(proc_data):
|
||||
def _process(proc_data: List[Dict]) -> List[Dict]:
|
||||
"""
|
||||
Final processing to conform to the schema.
|
||||
|
||||
@ -78,7 +79,11 @@ def _process(proc_data):
|
||||
return proc_data
|
||||
|
||||
|
||||
def parse(data, raw=False, quiet=False):
|
||||
def parse(
|
||||
data: str,
|
||||
raw: bool = False,
|
||||
quiet: bool = False
|
||||
) -> List[Dict]:
|
||||
"""
|
||||
Main text parsing function
|
||||
|
||||
@ -95,7 +100,7 @@ def parse(data, raw=False, quiet=False):
|
||||
jc.utils.compatibility(__name__, info.compatible, quiet)
|
||||
jc.utils.input_type_check(data)
|
||||
|
||||
raw_output = []
|
||||
raw_output: List = []
|
||||
|
||||
if jc.utils.has_data(data):
|
||||
|
||||
|
@ -49,6 +49,7 @@ Examples:
|
||||
{example output}
|
||||
...
|
||||
"""
|
||||
from typing import Dict, Iterable
|
||||
import jc.utils
|
||||
from jc.utils import stream_success, stream_error
|
||||
from jc.exceptions import ParseError
|
||||
@ -69,7 +70,7 @@ class info():
|
||||
__version__ = info.version
|
||||
|
||||
|
||||
def _process(proc_data):
|
||||
def _process(proc_data: Dict) -> Dict:
|
||||
"""
|
||||
Final processing to conform to the schema.
|
||||
|
||||
@ -90,7 +91,12 @@ def _process(proc_data):
|
||||
return proc_data
|
||||
|
||||
|
||||
def parse(data, raw=False, quiet=False, ignore_exceptions=False):
|
||||
def parse(
|
||||
data: Iterable[str],
|
||||
raw: bool = False,
|
||||
quiet: bool = False,
|
||||
ignore_exceptions: bool = False
|
||||
) -> Iterable[Dict]:
|
||||
"""
|
||||
Main text parsing generator function. Returns an iterator object.
|
||||
|
||||
@ -115,7 +121,7 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False):
|
||||
jc.utils.streaming_input_type_check(data)
|
||||
|
||||
for line in data:
|
||||
output_line = {}
|
||||
output_line: Dict = {}
|
||||
try:
|
||||
jc.utils.streaming_line_input_type_check(line)
|
||||
|
||||
|
@ -2,9 +2,10 @@
|
||||
|
||||
|
||||
import string
|
||||
from typing import List, Dict, Optional
|
||||
|
||||
|
||||
def simple_table_parse(data):
|
||||
def simple_table_parse(data: List[str]) -> List[Dict]:
|
||||
"""
|
||||
Parse simple tables. The last column may contain data with spaces.
|
||||
|
||||
@ -32,7 +33,7 @@ def simple_table_parse(data):
|
||||
return raw_output
|
||||
|
||||
|
||||
def sparse_table_parse(data, delim='\u2063'):
|
||||
def sparse_table_parse(data: List[str], delim: Optional[str] ='\u2063') -> List[Dict]:
|
||||
"""
|
||||
Parse tables with missing column data or with spaces in column data.
|
||||
|
||||
|
90
jc/utils.py
90
jc/utils.py
@ -5,9 +5,10 @@ import locale
|
||||
import shutil
|
||||
from datetime import datetime, timezone
|
||||
from textwrap import TextWrapper
|
||||
from typing import Dict, Iterable, List, Union, Optional
|
||||
|
||||
|
||||
def warning_message(message_lines):
|
||||
def warning_message(message_lines: List[str]) -> None:
|
||||
"""
|
||||
Prints warning message for non-fatal issues. The first line is
|
||||
prepended with 'jc: Warning - ' and subsequent lines are indented.
|
||||
@ -43,7 +44,7 @@ def warning_message(message_lines):
|
||||
print(message, file=sys.stderr)
|
||||
|
||||
|
||||
def error_message(message_lines):
|
||||
def error_message(message_lines: List[str]) -> None:
|
||||
"""
|
||||
Prints an error message for fatal issues. The first line is
|
||||
prepended with 'jc: Error - ' and subsequent lines are indented.
|
||||
@ -75,7 +76,7 @@ def error_message(message_lines):
|
||||
print(message, file=sys.stderr)
|
||||
|
||||
|
||||
def compatibility(mod_name, compatible, quiet=False):
|
||||
def compatibility(mod_name: str, compatible: List, quiet: Optional[bool] = False) -> None:
|
||||
"""
|
||||
Checks for the parser's compatibility with the running OS
|
||||
platform.
|
||||
@ -109,7 +110,7 @@ def compatibility(mod_name, compatible, quiet=False):
|
||||
f'Compatible platforms: {compat_list}'])
|
||||
|
||||
|
||||
def has_data(data):
|
||||
def has_data(data: str) -> bool:
|
||||
"""
|
||||
Checks if the input contains data. If there are any non-whitespace
|
||||
characters then return True, else return False.
|
||||
@ -126,14 +127,14 @@ def has_data(data):
|
||||
return bool(data and not data.isspace())
|
||||
|
||||
|
||||
def convert_to_int(value):
|
||||
def convert_to_int(value: Union[str, float]) -> Union[int, None]:
|
||||
"""
|
||||
Converts string and float input to int. Strips all non-numeric
|
||||
characters from strings.
|
||||
|
||||
Parameters:
|
||||
|
||||
value: (string/integer/float) Input value
|
||||
value: (string/float) Input value
|
||||
|
||||
Returns:
|
||||
|
||||
@ -156,14 +157,14 @@ def convert_to_int(value):
|
||||
return None
|
||||
|
||||
|
||||
def convert_to_float(value):
|
||||
def convert_to_float(value: Union[str, int]) -> Union[float, None]:
|
||||
"""
|
||||
Converts string and int input to float. Strips all non-numeric
|
||||
characters from strings.
|
||||
|
||||
Parameters:
|
||||
|
||||
value: (string) Input value
|
||||
value: (string/integer) Input value
|
||||
|
||||
Returns:
|
||||
|
||||
@ -182,7 +183,7 @@ def convert_to_float(value):
|
||||
return None
|
||||
|
||||
|
||||
def convert_to_bool(value):
|
||||
def convert_to_bool(value: Union[str, int, float]) -> bool:
|
||||
"""
|
||||
Converts string, integer, or float input to boolean by checking
|
||||
for 'truthy' values.
|
||||
@ -220,7 +221,7 @@ def convert_to_bool(value):
|
||||
return False
|
||||
|
||||
|
||||
def stream_success(output_line, ignore_exceptions):
|
||||
def stream_success(output_line: Dict, ignore_exceptions: bool) -> Dict:
|
||||
"""Add `_jc_meta` object to output line if `ignore_exceptions=True`"""
|
||||
if ignore_exceptions:
|
||||
output_line.update({'_jc_meta': {'success': True}})
|
||||
@ -228,7 +229,7 @@ def stream_success(output_line, ignore_exceptions):
|
||||
return output_line
|
||||
|
||||
|
||||
def stream_error(e, ignore_exceptions, line):
|
||||
def stream_error(e: BaseException, ignore_exceptions: bool, line: str) -> Dict:
|
||||
"""
|
||||
Reraise the stream exception with annotation or print an error
|
||||
`_jc_meta` field if `ignore_exceptions=True`.
|
||||
@ -247,25 +248,29 @@ def stream_error(e, ignore_exceptions, line):
|
||||
}
|
||||
|
||||
|
||||
def input_type_check(data):
|
||||
"""Ensure input data is a string"""
|
||||
def input_type_check(data: str) -> None:
|
||||
"""Ensure input data is a string. Raises `TypeError` if not."""
|
||||
if not isinstance(data, str):
|
||||
raise TypeError("Input data must be a 'str' object.")
|
||||
|
||||
|
||||
def streaming_input_type_check(data):
|
||||
"""Ensure input data is an iterable, but not a string or bytes"""
|
||||
def streaming_input_type_check(data: Iterable) -> None:
|
||||
"""
|
||||
Ensure input data is an iterable, but not a string or bytes. Raises
|
||||
`TypeError` if not.
|
||||
"""
|
||||
if not hasattr(data, '__iter__') or isinstance(data, (str, bytes)):
|
||||
raise TypeError("Input data must be a non-string iterable object.")
|
||||
|
||||
|
||||
def streaming_line_input_type_check(line):
|
||||
"""Ensure each line is a string"""
|
||||
def streaming_line_input_type_check(line: str) -> None:
|
||||
"""Ensure each line is a string. Raises `TypeError` if not."""
|
||||
if not isinstance(line, str):
|
||||
raise TypeError("Input line must be a 'str' object.")
|
||||
|
||||
|
||||
class timestamp:
|
||||
def __init__(self, datetime_string: str) -> None:
|
||||
"""
|
||||
Input a date-time text string of several formats and convert to a
|
||||
naive or timezone-aware epoch timestamp in UTC.
|
||||
@ -290,8 +295,6 @@ class timestamp:
|
||||
detected in datetime string. None if
|
||||
conversion fails
|
||||
"""
|
||||
|
||||
def __init__(self, datetime_string):
|
||||
self.string = datetime_string
|
||||
dt = self._parse()
|
||||
self.format = dt['format']
|
||||
@ -395,28 +398,33 @@ class timestamp:
|
||||
|
||||
# from https://www.timeanddate.com/time/zones/
|
||||
# only removed UTC timezone and added known non-UTC offsets
|
||||
tz_abbr = ['A', 'ACDT', 'ACST', 'ACT', 'ACWST', 'ADT', 'AEDT', 'AEST', 'AET', 'AFT', 'AKDT', 'AKST', 'ALMT',
|
||||
'AMST', 'AMT', 'ANAST', 'ANAT', 'AQTT', 'ART', 'AST', 'AT', 'AWDT', 'AWST', 'AZOST', 'AZOT',
|
||||
'AZST', 'AZT', 'AoE', 'B', 'BNT', 'BOT', 'BRST', 'BRT', 'BST', 'BTT', 'C', 'CAST', 'CAT', 'CCT',
|
||||
'CDT', 'CEST', 'CET', 'CHADT', 'CHAST', 'CHOST', 'CHOT', 'CHUT', 'CIDST', 'CIST', 'CKT', 'CLST',
|
||||
'CLT', 'COT', 'CST', 'CT', 'CVT', 'CXT', 'ChST', 'D', 'DAVT', 'DDUT', 'E', 'EASST', 'EAST',
|
||||
'EAT', 'ECT', 'EDT', 'EEST', 'EET', 'EGST', 'EGT', 'EST', 'ET', 'F', 'FET', 'FJST', 'FJT', 'FKST',
|
||||
'FKT', 'FNT', 'G', 'GALT', 'GAMT', 'GET', 'GFT', 'GILT', 'GMT', 'GST', 'GYT', 'H', 'HDT', 'HKT',
|
||||
'HOVST', 'HOVT', 'HST', 'I', 'ICT', 'IDT', 'IOT', 'IRDT', 'IRKST', 'IRKT', 'IRST', 'IST', 'JST',
|
||||
'K', 'KGT', 'KOST', 'KRAST', 'KRAT', 'KST', 'KUYT', 'L', 'LHDT', 'LHST', 'LINT', 'M', 'MAGST',
|
||||
'MAGT', 'MART', 'MAWT', 'MDT', 'MHT', 'MMT', 'MSD', 'MSK', 'MST', 'MT', 'MUT', 'MVT', 'MYT', 'N',
|
||||
'NCT', 'NDT', 'NFDT', 'NFT', 'NOVST', 'NOVT', 'NPT', 'NRT', 'NST', 'NUT', 'NZDT', 'NZST', 'O',
|
||||
'OMSST', 'OMST', 'ORAT', 'P', 'PDT', 'PET', 'PETST', 'PETT', 'PGT', 'PHOT', 'PHT', 'PKT', 'PMDT',
|
||||
'PMST', 'PONT', 'PST', 'PT', 'PWT', 'PYST', 'PYT', 'Q', 'QYZT', 'R', 'RET', 'ROTT', 'S', 'SAKT',
|
||||
'SAMT', 'SAST', 'SBT', 'SCT', 'SGT', 'SRET', 'SRT', 'SST', 'SYOT', 'T', 'TAHT', 'TFT', 'TJT', 'TKT',
|
||||
'TLT', 'TMT', 'TOST', 'TOT', 'TRT', 'TVT', 'U', 'ULAST', 'ULAT', 'UYST', 'UYT', 'UZT', 'V', 'VET',
|
||||
'VLAST', 'VLAT', 'VOST', 'VUT', 'W', 'WAKT', 'WARST', 'WAST', 'WAT', 'WEST', 'WET', 'WFT', 'WGST',
|
||||
'WGT', 'WIB', 'WIT', 'WITA', 'WST', 'WT', 'X', 'Y', 'YAKST', 'YAKT', 'YAPT', 'YEKST', 'YEKT', 'Z',
|
||||
'UTC-1200', 'UTC-1100', 'UTC-1000', 'UTC-0930', 'UTC-0900', 'UTC-0800', 'UTC-0700', 'UTC-0600',
|
||||
'UTC-0500', 'UTC-0400', 'UTC-0300', 'UTC-0230', 'UTC-0200', 'UTC-0100', 'UTC+0100', 'UTC+0200',
|
||||
'UTC+0300', 'UTC+0400', 'UTC+0430', 'UTC+0500', 'UTC+0530', 'UTC+0545', 'UTC+0600', 'UTC+0630',
|
||||
'UTC+0700', 'UTC+0800', 'UTC+0845', 'UTC+0900', 'UTC+1000', 'UTC+1030', 'UTC+1100', 'UTC+1200',
|
||||
'UTC+1300', 'UTC+1345', 'UTC+1400']
|
||||
tz_abbr = [
|
||||
'A', 'ACDT', 'ACST', 'ACT', 'ACWST', 'ADT', 'AEDT', 'AEST', 'AET', 'AFT', 'AKDT',
|
||||
'AKST', 'ALMT', 'AMST', 'AMT', 'ANAST', 'ANAT', 'AQTT', 'ART', 'AST', 'AT', 'AWDT',
|
||||
'AWST', 'AZOST', 'AZOT', 'AZST', 'AZT', 'AoE', 'B', 'BNT', 'BOT', 'BRST', 'BRT', 'BST',
|
||||
'BTT', 'C', 'CAST', 'CAT', 'CCT', 'CDT', 'CEST', 'CET', 'CHADT', 'CHAST', 'CHOST',
|
||||
'CHOT', 'CHUT', 'CIDST', 'CIST', 'CKT', 'CLST', 'CLT', 'COT', 'CST', 'CT', 'CVT', 'CXT',
|
||||
'ChST', 'D', 'DAVT', 'DDUT', 'E', 'EASST', 'EAST', 'EAT', 'ECT', 'EDT', 'EEST', 'EET',
|
||||
'EGST', 'EGT', 'EST', 'ET', 'F', 'FET', 'FJST', 'FJT', 'FKST', 'FKT', 'FNT', 'G',
|
||||
'GALT', 'GAMT', 'GET', 'GFT', 'GILT', 'GMT', 'GST', 'GYT', 'H', 'HDT', 'HKT', 'HOVST',
|
||||
'HOVT', 'HST', 'I', 'ICT', 'IDT', 'IOT', 'IRDT', 'IRKST', 'IRKT', 'IRST', 'IST', 'JST',
|
||||
'K', 'KGT', 'KOST', 'KRAST', 'KRAT', 'KST', 'KUYT', 'L', 'LHDT', 'LHST', 'LINT', 'M',
|
||||
'MAGST', 'MAGT', 'MART', 'MAWT', 'MDT', 'MHT', 'MMT', 'MSD', 'MSK', 'MST', 'MT', 'MUT',
|
||||
'MVT', 'MYT', 'N', 'NCT', 'NDT', 'NFDT', 'NFT', 'NOVST', 'NOVT', 'NPT', 'NRT', 'NST',
|
||||
'NUT', 'NZDT', 'NZST', 'O', 'OMSST', 'OMST', 'ORAT', 'P', 'PDT', 'PET', 'PETST', 'PETT',
|
||||
'PGT', 'PHOT', 'PHT', 'PKT', 'PMDT', 'PMST', 'PONT', 'PST', 'PT', 'PWT', 'PYST', 'PYT',
|
||||
'Q', 'QYZT', 'R', 'RET', 'ROTT', 'S', 'SAKT', 'SAMT', 'SAST', 'SBT', 'SCT', 'SGT',
|
||||
'SRET', 'SRT', 'SST', 'SYOT', 'T', 'TAHT', 'TFT', 'TJT', 'TKT', 'TLT', 'TMT', 'TOST',
|
||||
'TOT', 'TRT', 'TVT', 'U', 'ULAST', 'ULAT', 'UYST', 'UYT', 'UZT', 'V', 'VET', 'VLAST',
|
||||
'VLAT', 'VOST', 'VUT', 'W', 'WAKT', 'WARST', 'WAST', 'WAT', 'WEST', 'WET', 'WFT',
|
||||
'WGST', 'WGT', 'WIB', 'WIT', 'WITA', 'WST', 'WT', 'X', 'Y', 'YAKST', 'YAKT', 'YAPT',
|
||||
'YEKST', 'YEKT', 'Z', 'UTC-1200', 'UTC-1100', 'UTC-1000', 'UTC-0930', 'UTC-0900',
|
||||
'UTC-0800', 'UTC-0700', 'UTC-0600', 'UTC-0500', 'UTC-0400', 'UTC-0300', 'UTC-0230',
|
||||
'UTC-0200', 'UTC-0100', 'UTC+0100', 'UTC+0200', 'UTC+0300', 'UTC+0400', 'UTC+0430',
|
||||
'UTC+0500', 'UTC+0530', 'UTC+0545', 'UTC+0600', 'UTC+0630', 'UTC+0700', 'UTC+0800',
|
||||
'UTC+0845', 'UTC+0900', 'UTC+1000', 'UTC+1030', 'UTC+1100', 'UTC+1200', 'UTC+1300',
|
||||
'UTC+1345', 'UTC+1400'
|
||||
]
|
||||
|
||||
# normalize the timezone by taking out any timezone reference, except UTC
|
||||
cleandata = data.replace('(', '').replace(')', '')
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user