From 0296077e9af1a977828cb033d027b75856345f72 Mon Sep 17 00:00:00 2001 From: Peter van der Zee Date: Fri, 28 Feb 2025 16:03:04 +0100 Subject: [PATCH 1/2] Support --json in socket repos list --- src/commands/repos/list-repos.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/commands/repos/list-repos.ts b/src/commands/repos/list-repos.ts index 0408cc62e..6c858b9e5 100644 --- a/src/commands/repos/list-repos.ts +++ b/src/commands/repos/list-repos.ts @@ -48,6 +48,20 @@ export async function listRepos({ return } + spinner.stop('') + + if (outputJson) { + const data = result.data.results.map(o => ({ + id: o.id, + name: o.name, + visibility: o.visibility, + defaultBranch: o.default_branch, + archived: o.archived + })) + console.log(JSON.stringify(data, null, 2)) + return + } + const options = { columns: [ { field: 'id', name: colors.magenta('ID') }, @@ -58,5 +72,5 @@ export async function listRepos({ ] } - spinner.stop(chalkTable(options, result.data.results)) + console.log(chalkTable(options, result.data.results)) } From b1e19cb3a942f51b6d495bf8260c323ec5103ef3 Mon Sep 17 00:00:00 2001 From: Peter van der Zee Date: Fri, 28 Feb 2025 16:35:49 +0100 Subject: [PATCH 2/2] drop the --- src/commands/repos/list-repos.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/repos/list-repos.ts b/src/commands/repos/list-repos.ts index 6c858b9e5..2852592e5 100644 --- a/src/commands/repos/list-repos.ts +++ b/src/commands/repos/list-repos.ts @@ -48,7 +48,7 @@ export async function listRepos({ return } - spinner.stop('') + spinner.stop() if (outputJson) { const data = result.data.results.map(o => ({