From 4050d26a6623434e10715b0981d2aa6d6ce3ddc8 Mon Sep 17 00:00:00 2001 From: Andrea Righi Date: Mon, 4 Dec 2023 12:02:43 +0100 Subject: [PATCH] annotations: dump all the structure as JSON if no argument is specified Signed-off-by: Andrea Righi --- kconfig/run.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/kconfig/run.py b/kconfig/run.py index 27431d5..743ae79 100644 --- a/kconfig/run.py +++ b/kconfig/run.py @@ -129,8 +129,8 @@ _ARGPARSER = make_parser() def print_result(config, res): - if res is not None and config not in res: - res = {config or "*": res} + if res is not None and config is not None and config not in res: + res = {config: res} print(json.dumps(res, indent=4)) @@ -139,6 +139,14 @@ def do_query(args): arg_fail(_ARGPARSER, "error: --flavour requires --arch") a = Annotation(args.file) res = a.search_config(config=args.config, arch=args.arch, flavour=args.flavour) + # If no arguments are specified dump the whole annotations structure + if args.config is None and args.arch is None and args.flavour is None: + res = { + "arch": a.arch, + "flavour": a.flavour, + "flavour_dep": a.flavour_dep, + "config": res, + } print_result(args.config, res) -- 2.31.1