From cddea9fa5163b225d5c80678b37a7d0d82b7505d Mon Sep 17 00:00:00 2001 From: Zvi Grinberg Date: Thu, 7 Mar 2024 00:45:08 +0200 Subject: [PATCH] fix: fix broken cli stack analysis summary option Signed-off-by: Zvi Grinberg --- src/cli.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/cli.js b/src/cli.js index b016313..c8ad6ff 100644 --- a/src/cli.js +++ b/src/cli.js @@ -88,9 +88,26 @@ const stack = { let manifest = args['/path/to/manifest'] let html = args['html'] let summary = args['summary'] + let theProvidersSummary = new Map(); + let theProvidersObject ={} let res = await exhort.stackAnalysis(manifest, html) + if(summary) + { + for (let provider in res.providers ) { + if (res.providers[provider].sources !== undefined) { + for(let source in res.providers[provider].sources ) { + if(res.providers[provider].sources[source].summary) { + theProvidersSummary.set(source,res.providers[provider].sources[source].summary) + } + } + } + } + for (let [provider, providerSummary] of theProvidersSummary) { + theProvidersObject[provider]=providerSummary + } + } console.log(html ? res : JSON.stringify( - !html && summary ? res['summary'] : res, + !html && summary ? theProvidersObject : res, null, 2 ))