From: Andrea Righi Date: Mon, 4 Dec 2023 11:02:43 +0000 (+0100) Subject: annotations: dump all the structure as JSON if no argument is specified X-Git-Tag: v0.2~15 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=4050d26a6623434e10715b0981d2aa6d6ce3ddc8;p=annotations.git annotations: dump all the structure as JSON if no argument is specified Signed-off-by: Andrea Righi --- 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)