mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-28 21:33:32 +00:00
fix(nvs_flash/nvs_tool): Fix nvs_tool.py to output required values
nvs_tool.py did not provide the minimal output support which outputs the only necessary data. nvs_tool.py minimal text ouptut, the deliminators were not handled in the output Closes https://github.com/espressif/esp-idf/issues/15274
This commit is contained in:

committed by
Hrushikesh Bhosale

parent
7d365f7b42
commit
930e643a71
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
import argparse
|
||||
import os
|
||||
@@ -90,12 +90,10 @@ def main() -> None:
|
||||
def cmd_not_implemented(_: nvs_parser.NVS_Partition) -> None:
|
||||
raise RuntimeError(f'{args.dump} is not implemented')
|
||||
|
||||
formats = {
|
||||
'text': noop,
|
||||
'json': nvs_logger.print_json,
|
||||
}
|
||||
formats.get(args.format, format_not_implemented)(nvs)
|
||||
if args.format not in ['text', 'json']:
|
||||
format_not_implemented(nvs)
|
||||
|
||||
cmds = {}
|
||||
if args.format == 'text':
|
||||
cmds = {
|
||||
'all': nvs_logger.dump_everything,
|
||||
@@ -106,11 +104,19 @@ def main() -> None:
|
||||
'storage_info': nvs_logger.storage_stats,
|
||||
'none': noop,
|
||||
}
|
||||
cmds.get(args.dump, cmd_not_implemented)(nvs) # type: ignore
|
||||
|
||||
if args.integrity_check:
|
||||
nvs_log.info()
|
||||
nvs_check.integrity_check(nvs, nvs_log)
|
||||
if args.format == 'json':
|
||||
cmds = {
|
||||
'all': nvs_logger.print_json,
|
||||
'minimal': nvs_logger.print_minimal_json,
|
||||
'none': noop,
|
||||
}
|
||||
|
||||
cmds.get(args.dump, cmd_not_implemented)(nvs)
|
||||
|
||||
if args.integrity_check:
|
||||
nvs_log.info()
|
||||
nvs_check.integrity_check(nvs, nvs_log)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Reference in New Issue
Block a user