mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-08-08 22:36:48 +02:00
use dict constructor for xmltodict to suppress !!omap comments in YAML output
This commit is contained in:
@ -1,8 +1,13 @@
|
||||
jc changelog
|
||||
|
||||
20221101 v1.22.2
|
||||
20221102 v1.22.2
|
||||
- add `sshd_conf` parser
|
||||
- add `findmnt` parser
|
||||
- enhance `xml` parser with optional `_` prefix for attributes instead of
|
||||
`@` by using the `--raw` option. This can make it easier to filter the
|
||||
JSON output in some tools.
|
||||
- fix the `xml` parser to output a normal Dictionary instead of OrderdDict.
|
||||
This cleans up YAML output. (No `!!omap` comments)
|
||||
- fix `csv` and `csv-s` parsers for UTF-8 encoded CSV files with leading BOM bytes
|
||||
- fix exit code to be non-zero on interrupt
|
||||
- allow parser module objects to be used as arguments to `jc.get_help()` and `jc.parser_info()`
|
||||
|
@ -108,7 +108,7 @@ def _process(proc_data, has_data=False):
|
||||
|
||||
if has_data:
|
||||
# standard output with @ prefix for attributes
|
||||
raw_output = xmltodict.parse(proc_data)
|
||||
raw_output = xmltodict.parse(proc_data, dict_constructor=dict)
|
||||
|
||||
return raw_output
|
||||
|
||||
@ -139,7 +139,7 @@ def parse(data, raw=False, quiet=False):
|
||||
if raw:
|
||||
if has_data:
|
||||
# modified output with _ prefix for attributes
|
||||
raw_output = xmltodict.parse(data, attr_prefix='_')
|
||||
raw_output = xmltodict.parse(data, dict_constructor=dict, attr_prefix='_')
|
||||
|
||||
return raw_output
|
||||
|
||||
|
Reference in New Issue
Block a user