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

doc update

This commit is contained in:
Kelly Brazil
2020-02-03 16:20:38 -08:00
parent eb37fccd37
commit bf033239a7
2 changed files with 82 additions and 7 deletions

69
docs/parsers/yaml.md Normal file
View File

@ -0,0 +1,69 @@
# jc.parsers.yaml
jc - JSON CLI output utility YAML Parser
Usage:
specify --yaml as the first argument if the piped input is coming from a YAML file
Compatibility:
'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'
Examples:
$ cat example.yaml | jc --yaml -p
[
{
"Description": "This is a YAML document",
"Number": 42
},
{
"Description": "Yet Another YAML document"
"Boolean": true
}
]
## info
```python
info(self, /, *args, **kwargs)
```
## process
```python
process(proc_data)
```
Final processing to conform to the schema.
Parameters:
proc_data: (dictionary) raw structured data to process
Returns:
List of dictionaries. Each dictionary represents a YAML document:
[
{
YAML Document converted to a Dictionary
See https://pypi.org/project/ruamel.yaml for details
}
]
## parse
```python
parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
quiet: (boolean) suppress warning messages if True
Returns:
List of dictionaries. Raw or processed structured data.

View File

@ -1,8 +1,8 @@
"""jc - JSON CLI output utility yaml Parser
"""jc - JSON CLI output utility YAML Parser
Usage:
specify --yaml as the first argument if the piped input is coming from a yaml file
specify --yaml as the first argument if the piped input is coming from a YAML file
Compatibility:
@ -11,10 +11,16 @@ Compatibility:
Examples:
$ cat example.yaml | jc --yaml -p
[]
$ cat example.yaml | jc --yaml -p -r
[]
[
{
"Description": "This is a YAML document",
"Number": 42
},
{
"Description": "Yet Another YAML document"
"Boolean": true
}
]
"""
import jc.utils
from ruamel.yaml import YAML
@ -22,7 +28,7 @@ from ruamel.yaml import YAML
class info():
version = '1.0'
description = 'yaml file parser'
description = 'YAML file parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
details = 'Using the ruamel.yaml library at https://pypi.org/project/ruamel.yaml/'