1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-21 00:19:42 +02:00

doc update

This commit is contained in:
Kelly Brazil
2022-02-14 10:03:52 -08:00
parent 67dbf05016
commit 7ee1e34fc7
2 changed files with 116 additions and 4 deletions

View File

@ -83,13 +83,69 @@ Schema:
Examples: Examples:
$ xrandr | jc --xrandr $ xrandr | jc --xrandr
{
"screens": [
{
"screen_number": 0,
"minimum_width": 8,
"minimum_height": 8,
"current_width": 1920,
"current_height": 1080,
"maximum_width": 32767,
"maximum_height": 32767,
"associated_device": {
"associated_modes": [
{
"resolution_width": 1920,
"resolution_height": 1080,
"is_high_resolution": false,
"frequencies": [
{
"frequency": 60.03,
"is_current": true,
"is_preferred": true
},
{
"frequency": 59.93,
"is_current": false,
"is_preferred": false
}
]
},
{
"resolution_width": 1680,
"resolution_height": 1050,
"is_high_resolution": false,
"frequencies": [
{
"frequency": 59.88,
"is_current": false,
"is_preferred": false
}
]
}
],
"is_connected": true,
"is_primary": true,
"device_name": "eDP1",
"resolution_width": 1920,
"resolution_height": 1080,
"offset_width": 0,
"offset_height": 0,
"dimension_width": 310,
"dimension_height": 170
}
}
],
"unassociated_devices": []
}
<a id="jc.parsers.xrandr.parse"></a> <a id="jc.parsers.xrandr.parse"></a>
### parse ### parse
```python ```python
def parse(data: str, raw: bool = False, quiet: bool = False) def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict
``` ```
Main text parsing function Main text parsing function
@ -102,7 +158,7 @@ Parameters:
Returns: Returns:
List of Dictionaries. Raw or processed structured data. Dictionary. Raw or processed structured data.
### Parser Information ### Parser Information
Compatibility: linux, darwin, cygwin, aix, freebsd Compatibility: linux, darwin, cygwin, aix, freebsd

View File

@ -78,6 +78,62 @@ Schema:
Examples: Examples:
$ xrandr | jc --xrandr $ xrandr | jc --xrandr
{
"screens": [
{
"screen_number": 0,
"minimum_width": 8,
"minimum_height": 8,
"current_width": 1920,
"current_height": 1080,
"maximum_width": 32767,
"maximum_height": 32767,
"associated_device": {
"associated_modes": [
{
"resolution_width": 1920,
"resolution_height": 1080,
"is_high_resolution": false,
"frequencies": [
{
"frequency": 60.03,
"is_current": true,
"is_preferred": true
},
{
"frequency": 59.93,
"is_current": false,
"is_preferred": false
}
]
},
{
"resolution_width": 1680,
"resolution_height": 1050,
"is_high_resolution": false,
"frequencies": [
{
"frequency": 59.88,
"is_current": false,
"is_preferred": false
}
]
}
],
"is_connected": true,
"is_primary": true,
"device_name": "eDP1",
"resolution_width": 1920,
"resolution_height": 1080,
"offset_width": 0,
"offset_height": 0,
"dimension_width": 310,
"dimension_height": 170
}
}
],
"unassociated_devices": []
}
""" """
import re import re
from typing import Dict, List, Optional, Union from typing import Dict, List, Optional, Union
@ -287,7 +343,7 @@ def _parse_mode(line: str) -> Optional[Mode]:
return mode return mode
def parse(data: str, raw: bool =False, quiet: bool =False): def parse(data: str, raw: bool =False, quiet: bool =False) -> Dict:
""" """
Main text parsing function Main text parsing function
@ -299,7 +355,7 @@ def parse(data: str, raw: bool =False, quiet: bool =False):
Returns: Returns:
List of Dictionaries. Raw or processed structured data. Dictionary. Raw or processed structured data.
""" """
jc.utils.compatibility(__name__, info.compatible, quiet) jc.utils.compatibility(__name__, info.compatible, quiet)
jc.utils.input_type_check(data) jc.utils.input_type_check(data)