mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-21 00:19:42 +02:00
doc update
This commit is contained in:
@ -83,13 +83,69 @@ Schema:
|
||||
Examples:
|
||||
|
||||
$ 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>
|
||||
|
||||
### parse
|
||||
|
||||
```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
|
||||
@ -102,7 +158,7 @@ Parameters:
|
||||
|
||||
Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||
|
@ -78,6 +78,62 @@ Schema:
|
||||
Examples:
|
||||
|
||||
$ 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
|
||||
from typing import Dict, List, Optional, Union
|
||||
@ -287,7 +343,7 @@ def _parse_mode(line: str) -> Optional[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
|
||||
|
||||
@ -299,7 +355,7 @@ def parse(data: str, raw: bool =False, quiet: bool =False):
|
||||
|
||||
Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
Dictionary. Raw or processed structured data.
|
||||
"""
|
||||
jc.utils.compatibility(__name__, info.compatible, quiet)
|
||||
jc.utils.input_type_check(data)
|
||||
|
Reference in New Issue
Block a user