From 8af83b547e950d39507b67cd9478a46340229cbb Mon Sep 17 00:00:00 2001 From: Fahad Ali Date: Sun, 28 May 2023 23:49:15 +0530 Subject: [PATCH 1/4] sdk-for-cli initial commit --- templates/cli/lib/parser.js.twig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/cli/lib/parser.js.twig b/templates/cli/lib/parser.js.twig index 652b4bdfab..411e63a461 100644 --- a/templates/cli/lib/parser.js.twig +++ b/templates/cli/lib/parser.js.twig @@ -8,7 +8,7 @@ const cliConfig = { json: false }; -const parse = (data) => { +const parse = (data, child = false) => { if (cliConfig.json) { drawJSON(data); return; @@ -23,14 +23,14 @@ const parse = (data) => { drawJSON(data[key]); } } else if (typeof data[key] === 'object') { - if (data[key] && data[key].constructor.name === 'BigNumber') { - console.log(`${chalk.yellow.bold(key)} : ${data[key]}`); + if (data[key] && data[key].constructor?.name === 'BigNumber') { + console.log(`${child ? ' ' : ''}${chalk.yellow.bold(key)} : ${data[key]}`); } else { console.log(`${chalk.yellow.bold.underline(key)}`) - parse(data[key]); + parse(data[key], true); } } else { - console.log(`${chalk.yellow.bold(key)} : ${data[key]}`); + console.log(`${child ? ' ' : ''}${chalk.yellow.bold(key)} : ${data[key]}`); } } } From 8681fcaa219d2aaca64b65f2c2896674038c003e Mon Sep 17 00:00:00 2001 From: Fahad Ali Date: Mon, 29 May 2023 02:31:50 +0530 Subject: [PATCH 2/4] comments addressed --- templates/cli/lib/parser.js.twig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/cli/lib/parser.js.twig b/templates/cli/lib/parser.js.twig index 411e63a461..81be763b3a 100644 --- a/templates/cli/lib/parser.js.twig +++ b/templates/cli/lib/parser.js.twig @@ -8,7 +8,7 @@ const cliConfig = { json: false }; -const parse = (data, child = false) => { +const parse = (data) => { if (cliConfig.json) { drawJSON(data); return; @@ -24,13 +24,13 @@ const parse = (data, child = false) => { } } else if (typeof data[key] === 'object') { if (data[key] && data[key].constructor?.name === 'BigNumber') { - console.log(`${child ? ' ' : ''}${chalk.yellow.bold(key)} : ${data[key]}`); + console.log(`${chalk.yellow.bold(key)} : ${data[key]}`); } else { console.log(`${chalk.yellow.bold.underline(key)}`) - parse(data[key], true); + drawTable(data[key]); } } else { - console.log(`${child ? ' ' : ''}${chalk.yellow.bold(key)} : ${data[key]}`); + console.log(`${chalk.yellow.bold(key)} : ${data[key]}`); } } } From 82f971b7c2c4832efa73d48b3b3671504dbf8e78 Mon Sep 17 00:00:00 2001 From: Fahad Ali Date: Mon, 29 May 2023 02:32:55 +0530 Subject: [PATCH 3/4] included in array --- templates/cli/lib/parser.js.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/cli/lib/parser.js.twig b/templates/cli/lib/parser.js.twig index 81be763b3a..fdb103cad5 100644 --- a/templates/cli/lib/parser.js.twig +++ b/templates/cli/lib/parser.js.twig @@ -27,7 +27,7 @@ const parse = (data) => { console.log(`${chalk.yellow.bold(key)} : ${data[key]}`); } else { console.log(`${chalk.yellow.bold.underline(key)}`) - drawTable(data[key]); + drawTable([data[key]]); } } else { console.log(`${chalk.yellow.bold(key)} : ${data[key]}`); From efe32a0bb0a770168ed920d6f815cbcaf510e971 Mon Sep 17 00:00:00 2001 From: Fahad Ali Date: Sat, 3 Jun 2023 17:04:19 +0530 Subject: [PATCH 4/4] comments addressed --- templates/cli/lib/parser.js.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/cli/lib/parser.js.twig b/templates/cli/lib/parser.js.twig index fdb103cad5..a1634c3ed0 100644 --- a/templates/cli/lib/parser.js.twig +++ b/templates/cli/lib/parser.js.twig @@ -23,7 +23,7 @@ const parse = (data) => { drawJSON(data[key]); } } else if (typeof data[key] === 'object') { - if (data[key] && data[key].constructor?.name === 'BigNumber') { + if (data[key]?.constructor?.name === 'BigNumber') { console.log(`${chalk.yellow.bold(key)} : ${data[key]}`); } else { console.log(`${chalk.yellow.bold.underline(key)}`)